Author Topic: DocumentGenerator NewDocument ignores the template  (Read 3476 times)

ja1234

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
DocumentGenerator NewDocument ignores the template
« 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)



Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: DocumentGenerator NewDocument ignores the template
« Reply #1 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
My theories are always correct, just apply them to the right reality.