Using Tables in RTF

This site is useful: http://www.pindari.com/rtf3.html {\rtf1\ansi\deff0 \trowd \cellx1000 \cellx2000 \cellx3000 \intbl cell 1\cell \intbl cell 2\cell \intbl cell 3\cell \row } This will give: ————————— |cell 1 | cell 2 | cell 3 | ————————— A row is delimted with \trowd … \row Each cell ends with \cell \cellx determines the right side of the … Read more

RTF to Plain Text in Java

I use Swing’s RTFEditorKit in Java 6 like this: RTFEditorKit rtfParser = new RTFEditorKit(); Document document = rtfParser.createDefaultDocument(); rtfParser.read(new ByteArrayInputStream(rtfBytes), document, 0); String text = document.getText(0, document.getLength()); and thats working.

Is there a Python module for converting RTF to plain text? [closed]

I’ve been working on a library called Pyth, which can do this: http://pypi.python.org/pypi/pyth/ Converting an RTF file to plaintext looks something like this: from pyth.plugins.rtf15.reader import Rtf15Reader from pyth.plugins.plaintext.writer import PlaintextWriter doc = Rtf15Reader.read(open(‘sample.rtf’)) print PlaintextWriter.write(doc).getvalue() Pyth can also generate RTF files, read and write XHTML, generate documents from Python markup a la Nevow’s stan, … Read more

How to output unicode string to RTF (using C#)

Provided that all the characters that you’re catering for exist in the Basic Multilingual Plane (it’s unlikely that you’ll need anything more), then a simple UTF-16 encoding should suffice. Wikipedia: All possible code points from U+0000 through U+10FFFF, except for the surrogate code points U+D800–U+DFFF (which are not characters), are uniquely mapped by UTF-16 regardless … Read more

Convert RTF (Rich Text Format) code into plain text in Excel

The .Net Framework RichTextBox class can perform the conversion. Fortunately, this class has the ComVisibleAttribute set, so it can be used from VBA without much difficulty. I had to create a .tlb file to Reference. In the %SYSTEMROOT%\Microsoft.NET\Framework\currentver\ directory, run the command regasm /codebase system.windows.forms.dll to create the system.windows.forms.tlb file. I already had this .tlb … Read more

How to convert a string to RTF in C#?

Doesn’t RichTextBox always have the same header/footer? You could just read the content based on off-set location, and continue using it to parse. (I think? please correct me if I’m wrong) There are libraries available, but I’ve never had good luck with them personally (though always just found another method before fully exhausting the possibilities). … Read more

How do I convert HTML to RTF (Rich Text) in .NET without paying for a component? [closed]

Actually there is a simple and free solution: use your browser, ok this is the trick I used: var webBrowser = new WebBrowser(); webBrowser.CreateControl(); // only if needed webBrowser.DocumentText = *yourhtmlstring*; while (_webBrowser.DocumentText != *yourhtmlstring*) Application.DoEvents(); webBrowser.Document.ExecCommand(“SelectAll”, false, null); webBrowser.Document.ExecCommand(“Copy”, false, null); *yourRichTextControl*.Paste(); This could be slower than other methods but at least it’s free … Read more