Hi All
On a WordPress site, I'm using the Universal Post Manager plugin to enable users to convert (export) posts/pages to Word. A limitation this presents is the lack of complex formatting options akin to what's available in Word.
Does anyone know, please, whether it's possible to either include tags in the HTML of the page/post to be exported, or within the plugin's template files, that would enable the exported page/post, when opened in Word, to automatically:
* add page breaks and section breaks at defined points
* add headers and footers
* add pagination
* add a table of contents based on the H1 or H2 entries?
Any help very much appreciated. I've been wracking my brain over this one.
Thanks in advance.
Richard
John Cotton answers:
It's going to be tricky since the concepts of ToCs, page breaks, footers etc don't really exist (or at least not in the same way) in HTML as they do in Word.
However, the plug-in <em>is</em> using Word XML save into Word so it's on the right path (unfortunately, it slips back into HTML for the tricky bit!).
What you could do is change the template (save_as_word_document.php) to better support the Word features you want (eg a page break is "<w:docPr>").
Probably using shortcodes*, you could put markers in the content that do nothing for to the HTML but when parsing for output to word, create the appropriate ToC, page break or whatever XML.
John
* Or you could use CSS classes to determine content breaks - eg <div class="page">[CONTENT]</div> converts to "<w:docPr/><w:body>[CONTENT OF DIV]</w:body>", but then you'd have to parse the HTML....shortcodes would probably be easier in the short term.
Ehthisham tk answers:
<a /> =<a />
you can try using < and > then it'll display as < and >
Richard comments:
Thanks but I don't follow what you're saying. What function would this code create please and where would one put it?
Joe Jenkins answers:
Place the following in html view:
<br class="blank" />
This will create a line break and, unlike adding some code within html view, it will show up in the visual editor and remain there.
My advice, if you use the visual editor, is to place the following where you want the line break:
XXXXXXXXXXXXXXX
Then, when you go to the html view, you can easily see where you need to add the above code.
Richard comments:
Thanks for commenting - I appreciate it - but I'm not after line breaks. I'm looking for page and section breaks, and the other things mentioned above, that are automatically applied when the page/post is exported into Word via the Universal Post Manager plugin.
Lucas Wynne answers:
I'm sorry Richard, but I don't believe this is possible. On a philosophical basis anything is possible with computers but I believe this would take quite a bit of custom programming to solve. :-(
Here are some solutions, but not what you want necessarily...
- Conver to PDF with [[LINK href="http://wordpress.org/extend/plugins/pdf24-posts-to-pdf/"]]this plugin[[/LINK]], then convert those to Word using [[LINK href="http://www.pdftoword.com/"]]pdftoword.com[[/LINK]]
- You could try to use this after you export a post as an XML file instead:
[[LINK href="http://www.freevbcode.com/ShowCode.asp?ID=969"]]http://www.freevbcode.com/ShowCode.asp?ID=969[[/LINK]]
- Copying and pasting usually maintains most of the formatting