How to create documents based on a DOT-template

Hi,

we have an application generating MS Word based reports with Office 2003 Primary Interop Assemblies. I am currently evaluating XlsIO and DocIO becuase we are looking for a way to directly produce Word files without using MS Word.

My question is: how can I create a new document based upon an existing DOT-template with DocIO? This is a crucial feature for us because we provide the users with a template (DOT-file) which they can adapt to their individual needs.

Thanks in advance & best regards
Christian

1 Reply

MW Melba Winshia Syncfusion Team June 28, 2007 08:29 AM UTC

Hi Christian,

You can create a new document based upon an existing DOT-template with DocIO by using the following code snippet:

[c#]

WordDocument document = new WordDocument();

//Opening DOT-template
document.Open(@"..\..\Data\Essential DocIO.dot");

//Add a new section to the document.
IWSection section = document.AddSection();

//Adding a new paragraph to the section.
IWParagraph paragraph = section.AddParagraph();

//Insert Text into the paragraph
paragraph.AppendText( "Hello World!" );

//Saving the document to disk.
document.Save("Sample.doc");

Here is the sample for your reference:

http://websamples.syncfusion.com/samples/DocIO.Windows/63057/main.htm

Kindly let me know if you have any other questions.

Thanks,
Melba

Loader.
Up arrow icon