Title: TWiki . Support . TWiKi2RTF
Author: Richard Donkin
Company: Orchestream Ltd

| TWiki > Support > TWiKi2RTF | TWiki webs: Main | TWiki | Codev | Plugins | Support | Test
| Support . { Home | Changes | Index | Search | Go }
Question 
Anyone who has hints for convenient RTF or MSWord output of TWiki Documents? 
Up to now I do the following: 
1.	View document with Print skin 
2.	Edit HTML document in Netscape Composer 
3.	Save as HTML (This helps to convert special chars ÄÖÜäöüß) 
4.	Open with MSWord 
5.	Convert to (= save as) Word Doc 
6.	change H to Heading formats 
7.	remove formatting of undefined TWiki words (light yello BG, Question mark link) 
8.	remove separator lines 
9.	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&section=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.05.tar.gz
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
Module          Embperl::Syntax::RTF (G/GR/GRICHTER/Embperl-2.0b7.tar.gz)
Module          HTML::Embperl::Syntax::RTF (G/GR/GRICHTER/HTML-Embperl-2.0b5.tar
.gz)
Module          IPChains::PortFW (F/FR/FRAJULAC/Fwctl-0.28.tar.gz)
Module          Meta::Baseline::Lang::Rtfx (V/VE/VELTZER/Meta-0.03.tar.gz)
Module          Pod::RTF        (K/KJ/KJALB/PodSimplify-0.04.tar.gz)
Module          Pod::Rtf        (P/PV/PVHP/Pod2WinHlp-0.02.tar.gz)
Module          RTF::Base       (Contact Author Nick Ing-Simmons )
Module          RTF::Character  (R/RR/RRWO/RTF-Generator-1.00.tar.gz)
Module          RTF::Charsets   (P/PV/PVERD/RTF-Parser-1.07.tar.gz)
Module          RTF::ColorTable (R/RR/RRWO/RTF-Generator-1.00.tar.gz)
Module          RTF::Config     (P/PV/PVERD/RTF-Parser-1.07.tar.gz)
Module          RTF::Control    (P/PV/PVERD/RTF-Parser-1.07.tar.gz)
Module          RTF::Document   (R/RR/RRWO/RTF-Document-0.64.tar.gz)
Module          RTF::FontTable  (R/RR/RRWO/RTF-Generator-1.00.tar.gz)
Module          RTF::Generator  (R/RR/RRWO/RTF-Generator-1.00.tar.gz)
Module          RTF::Group      (R/RR/RRWO/RTF-Generator-1.00.tar.gz)
Module          RTF::HTML::Converter (P/PV/PVERD/RTF-Parser-1.07.tar.gz)
Module          RTF::HTML::Output (P/PV/PVERD/RTF-Parser-1.05.tar.gz)
Module          RTF::Paragraph  (R/RR/RRWO/RTF-Generator-1.00.tar.gz)
Module          RTF::Parser     (P/PV/PVERD/RTF-Parser-1.07.tar.gz)
Module          RTF::Section    (R/RR/RRWO/RTF-Generator-1.00.tar.gz)
Module          RTF::StyleSheet (R/RR/RRWO/RTF-Generator-1.00.tar.gz)
Module          RTF::TEXT::Converter (P/PV/PVERD/RTF-Parser-1.07.tar.gz)
Module          RTF::Writer     (S/SB/SBURKE/RTF-Writer-1.06.tar.gz)
Module          RTF::Writer::TableRowDecl (S/SB/SBURKE/RTF-Writer-1.06.tar.gz)
30 items found
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. 
-- RichardDonkin - 12 Apr 2002 
WebForm
SupportStatus: | AnsweredQuestions
Attachment: | Action: | Size: | Date: | Who: | Comment:
testoleauto | action | 892 | 11 Apr 2002 - 09:51 | RichardDonkin | Perl script to drive Microsoft Excel
Topic TWiKi2RTF . { Edit | Attach | Ref-By | Printable | Diffs | r1.4 | > | r1.3 | > | r1.2 | More }

Revision r1.4 - 12 Apr 2002 - 06:54 GMT - RichardDonkin

Copyright © 1999-2002 by the contributing authors. All material on this collaboration tool is the property of the contributing authors. 
Ideas, requests, problems regarding TWiki? Send feedback