Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using Word2007 to create a RTF file. And in the end, I want to get the text source of that file like {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Verdana;}}...

Here is how I create a blank RTF file:

  1. New a txt file by the context menu.
  2. Change its extension name to rtf.
  3. Open the file with Word2007.
  4. Type some characters and remove them and then save.

How I get the source:

  1. Open the RTF file with notepad

Then a huge amount of characters ending with a lot of fffff0000 appear which makes me crazy...

Does anyone know why this happens?

Thanks

EDIT
I'm using iText2.1.5(a java library that manipulates PDF) to generate PDF from RTF. The program works fine with an old test RTF file which looks much cleaner than what I get from word2007 now. I am just creating more test RTF files for the program but it turns out that it couldn't recognize the source from word 2007.

I guess maybe I should upgrade iText or downgrade Word(maybe the good old test file is generated by word2003?). But I don't have much time now.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The best way to go is to read up on RTF specs. Also, Wordpad saves as RTF by default, and its relatively clean. Word has a lot of metadata, including styles, etc, which bloats it. The same happens when saving as HTML in Word; it's the bane of web developers to the point where there are dedicated program to clean up Word HTML files.

Basically, Word adds all this metadata so when you reopen the file in Word, as much (Word specific) information as possible is kept.

If you could tell us why you want to open a RTF file as plain text, I may be able to help more.

share|improve this answer
    
Thanks for your answer. Please see my edit. I'll try Wordpad first. Thanks! –  Grant Zhu Mar 16 '12 at 8:16
    
WordPad is exactly what I need for now. I'll check the library and RTF specs later.. –  Grant Zhu Mar 16 '12 at 8:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.