Book a Demo

Author Topic: Missing Header & Footer in generated file  (Read 6119 times)

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Missing Header & Footer in generated file
« on: August 02, 2016, 12:33:17 am »
Hi All,

Once again I stumbled upon a problem.
I wrote a script that generates RTF document, everything works great except one detail: Header & Footer are missing in generated file.

I have them templates (logo and page number) but they are not present in generated file.

Basically my  script is invoked from context menu on diagram OnDiagramScript(); listener function.
Then I get list of all elements on diagram and generate the file
more or less like that:
Code: [Select]
            var docGenerator = Repository.CreateDocumentGenerator();
            if (docGenerator.NewDocument("")) {
                documentCoverPage(docGenerator, elements);
                docGenerator.InsertBreak(0);
                docGenerator.InsertTableOfContents();
                docGenerator.InsertBreak(0);
                docGenerator.SaveDocument(FILENAME, DocxType);
                Session.Prompt("Document successfully generated", promptOK);
            }
Where
Code: [Select]
            documentCoverPage = function (docGenerator, elements) {
            docGenerator.DocumentPackage(packageId, 0,TEMPLATE_COVER_PAGE);
            var documentChanges = filterElements(elements, "Change");
           
            for (var i = 0; i < documentChanges.length; i++) {
                var change = documentChanges[i];
                docGenerator.DocumentElement(change.ElementID, 0, TEMPLATE_CHANGE_HISTORY);
            }
        };
Generaly I don't do anything special.. the only difference is that everything is started and generated in script, not from F8 / Generate Documentation functionality.

Did you guys have problems like that?
Any idea on how to fix it will be appreciated :-)
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Dermot

  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Re: Missing Header & Footer in generated file
« Reply #1 on: August 02, 2016, 12:16:02 pm »

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Missing Header & Footer in generated file
« Reply #2 on: August 02, 2016, 06:09:42 pm »
Thanks Dermot :-)
It works !!!

It also works for EA12.1.

I just wonder why DocumentGenerator.InsertTemplate (string templateName) method does not have the same magical power to insert header and footer.
Now I need to have additional element just to have linked document with header and footer.

But I know... it's EA way  ;D
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239