Sparx Systems Forum

Enterprise Architect => Bugs and Issues => Topic started by: ja1234 on July 13, 2016, 10:36:15 pm

Title: DocumentGenerator NewDocument ignores the template
Post by: ja1234 on July 13, 2016, 10:36:15 pm
Sparx version: 12.0.1214
Problem:DocumentGenerator doesn't seem to be able to generate a document based on a template.
Reproduce:

Code: [Select]
    var Gentor as EA.DocumentGenerator;
    Gentor = Repository.CreateDocumentGenerator();
    Gentor.NewDocument("custom-reporting");   
where custom-reporting is a template saved in User Templates / Templates

However, 
Code: [Select]
Gentor.insertTemplate("custom-reporting") works OK but will obviously insert a template and NOT generate the whole document based on a template (eg no page numbering etc)


Title: Re: DocumentGenerator NewDocument ignores the template
Post by: Uffe on July 14, 2016, 12:56:19 am
Hello,


Passing an argument passed to NewDocument() doesn't mean anything gets generated at that point. No documentation is generated from a template alone.

In order to get stuff into the document you're creating, call
Code: [Select]
DocumentGenerator.DocumentElement(element.ElementID, 0, "custom-reporting");... or similar for DocumentPackage(), DocumentDiagram(), etc.

For page numbers, headers and footers, look at SetStyleSheetDocument() and InsertLinkedDocument().

HTH,


/Uffe