Master template

Hi,
I am wondering whether is there a concept called ‘master template’ which will be used by all child templates ?
I am thinking of defining a predefined placeholder located in the footnote of the master template. I will programmatically modify the content of the placeholder after the document is instantiated.
I will place a shapes collection inside the placeholder.
This is related to my current requirements https://forum.aspose.com/t/48620
You have suggested the solution

  1. Using Bookmark:
    There is an issue with using bookmark. For your information, the final word document is obtained by using Aspose mail merge feature. So there is a possibility that a table can span across multiple pages.
    https://forum.aspose.com/t/48620
  2. Using Footnote
    Previously you have suggested the solution by manipulating the Footer (FooterEven and FooterPrimary).
    Apparently it’s not really solving my problem, because in the even pages, i still need to draw custom OMR shapes uniquely. By using ‘FooterEven’, the application will draw exactly the same contents which is not my requirement.
    Using Footer is not really solving my problem because the the similar content will be drawn in Footnote.
    https://forum.aspose.com/t/48620
  3. Using Nested Field IF Update
    This solution is only feasible to insert custom texts. I need to insert shapes collection.
    https://forum.aspose.com/t/48461

Regards,
hadi teo

Hi Hadi,

Thanks for your inquiry. You can open your template document as shown below and insert the contents according to your requirements.

// Open your tempalte
Document doc = new Document(@"yourtempalte.dot");
// Insert content into the document here.
// .......................................
// Save output.
doc.Save(@"out.doc");

You can also attach Template(Dotx) to a Word document by using Document.AttachedTemplate property. Please see the following code snippet.

Document doc = new Document(MyDir + "in.doc");
doc.AttachedTemplate = MyDir + "template.dotx";

// Your code....

doc.Save(MyDir + "AsposeOut.dotx", SaveFormat.Dotx);

Please check my colleague’s reply at following forum thread:
https://forum.aspose.com/t/48620
Hope this answers your query. Please let us know if you have any more queries.