Question
Anyone who has hints for convenient RTF or MSWord output of TWiki Documents?
Up to now I do the following:
- View document with Print skin
- Edit HTML document in Netscape Composer
- Save as HTML (This helps to convert special chars ÄÖÜäöüß)
- Open with MSWord
- Convert to (= save as) Word Doc
- change H to Heading formats
- remove formatting of undefined TWiki words (light yello BG, Question mark link)
- remove separator lines
- reformat line breaks between sequential paragraphs which get lost somewhere
This is ok for me but not for the majority of our users.
Maybe I have to learn about plugins and connect some CPAN RTF module to TWiki.
Maybe someone already has it.
.
- TWiki version: newest
- Web server: any
- Server OS: any
- Web browser: any
- Client OS: any
--
WolframJahn - 05 Apr 2002
Answer
I am a Nescape user, however when I need to convert TWiki content to Word or Excel I use IE to copy the content of the TWiki topic into the clipboard and paste it into Word or Excel. It should pick up the formatting just fine.
--
PeterThoeny - 11 Apr 2002
If you are using TWiki on Windows, you could investigate launching Word from Perl to do the conversion from HTML to RTF that way -
ActivePerl includes an OLE feature that lets you drive MS Office tools in the same was as Visual Basic for Applications, as in the attached sample script for Excel (based on the one in the docs for Win32::OLE).
This is a bit heavyweight, so you might want to investigate
OpenSource tools for HTML to RTF conversion - there may well be something out there, try searching Google,
http://www.freshmeat.net/, etc. See
http://freshmeat.net/search/?q=rtf+html§ion=projects for some examples, most are RTF to HTML.
Another angle is just to convert to HTML only, perhaps using a special TWiki skin that turns off some formatting (maybe using parameters to a customised
view script as well) - Word will open HTML documents, so try experimenting with that.
--
RichardDonkin - 11 Apr 2002
I just did a CPAN search, and found lots of tools - however, you'd have to write some code to convert from HTML (or TWiki syntax) into RTF:
Distribution P/PV/PVERD/RTF-Parser-1.07.tar.gz
Distribution R/RR/RRWO/RTF-Document-0.64.tar.gz
Distribution R/RR/RRWO/RTF-Generator-1.00.tar.gz
Distribution S/SB/SBURKE/RTF-Writer-1.06.tar.gz
It might not be too hard to write an 'rtfview' type script that renders TWiki syntax as RTF - it would be quite a lot of work, though, as you'd have to do a special version of many functions in TWiki.pm. Probably easier to find an HTML to RTF tool, if that exists, or just load the HTML directly into Word.
If you set the Content-Type appropriately in a plugin, you can have an HTML page delivered by TWiki that causes Word to be loaded on the contents. If you go this route, please note that the relevant plugin API,
writeHeaderHandler, is going to change in the
BeijingRelease to take account of the
BackFromPreviewLosesText bug fix, which requires HTTP headers that can't be overridden by plugins.
In fact, using IE 5.5 on a system with Word 2000 installed, I just did File | Edit with Microsoft Word, and I got this page up imported into Word automatically. Then just do File | Save As ... and specify RTF, and you have an RTF file. See the attached file for an example - this doesn't completely solve your problem, but perhaps if you combine this with some customised rendering in the
view script (best done in a plugin, but core changes may be necessary too) it would do what you need. Since Microsoft Office is so popular, it would be reasonable to incorporate the required core code changes to support a 'TWikiToMSWord' plugin.
--
RichardDonkin - 12 Apr 2002