This project has moved and is read-only. For the latest updates, please go here.

create new document using a .DOT file

Oct 18, 2010 at 9:40 PM

Hi,

I am new here and I am looking at using DocX to create and edit a word document from a word template file that I have created.  Using word I would do the following:

Word.Document oWordDoc = new Word.Document();

oTemplatePath = "C:\filename.dot";
oWordDoc = WordApp.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);

Using DocX.Create() I do not have an option to specify a template. 

Thanks for your help.

Elvis

Oct 19, 2010 at 9:48 AM
elvism3,

using DocX you can load the template make your changes and then save it as a new document.

using(DocX document = DocX.load("template.docx"))
{
    // Add to document here

    document.saveAs("newDocument.docx");
}

Is this the kind of functionality you are looking for?
Cathal