views:

154

answers:

1

I need to create a .doc document in C# with specific rtf format. I have a document that I need to replicate in my code but I don't know how to view this documents rtf representation? I don't think copying the content to RichTextBox will help cause I need margin settings and other document, not content, related settings to replicate. Any ideas?

Thank you.

A: 

You can save your Word document as RTF which should retain any formatting and style that RTF is able to represent (which should be everything as RTF gets updated with every Word version too).

But don't expect the code to be readable, nicely structured or usable as a basis for your export.

Joey
...and then, open the RTF file in notepad and take a deep breath. Trying to produce modern Word RTF files is a real nightmare. You should consider using the DOCX format instead, for which there are APIs for .NET.
Pierre
Thanks guys. I guess this will not be easy. The document I'm creating doesn't need to be a modern Word file, in fact I'm creating an rtf that I'm saving as .doc. I guess it's going to be a lot of experimenting until I get it to work.
electro