I'm using a self-developed document generator add-in in EA V16.1.1628 to create .docx files as output. The following code is the main part of exporting the EA content:
Package package = currentRepository.GetTreeSelectedPackage();
DocumentGenerator docGen = currentRepository.CreateDocumentGenerator();
docGen.NewDocument(cfgHandling.reqSpecSecTemplateName);
docGen.SetPageOrientation(DocumentPageOrientation.pagePortrait);
docGen.InsertCoverPageDocument(cfgHandling.reqSpecSecCoverPageName);
docGen.SetStyleSheetDocument(cfgHandling.reqSpecSecStyleSheetName);
docGen.InsertBreak(DocumentBreak.breakPage);
docGen.InsertTOCDocument(cfgHandling.reqSpecSecTOCName);
docGen.InsertBreak(DocumentBreak.breakPage);
// call the iterative content generation
contentGenerator(docGen, cfgHandling.logwindowName, currentRepository, package, 0, cfgHandling.reqSpecSecTemplateName);
string filepath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + cfgHandling.mainSavePath + "\\" + cfgHandling.project_id + "_Req_Spec." + cfgHandling.mainDocExt;
CleanUpGeneratedFile(filepath);
docGen.SaveDocument(filepath, cfgHandling.mainDocType);
cfgHandling.reqSpecSecTemplateName refers to the name of the template in the repository that contains the desired formatting. (note: I use a MySQL database behind Pro Cloud Server)
The following is the header I use in the document's template:
This is completely ignored in the output document. I get blank header and footer, so the result breaks the rules of corporate guidelines, and renders the output in this form not usable.
Could anyone suggest which part of the code or EA overrides the template's header formatting?
(As backup plan, I'm considering writing a post-processor with Microsoft.Office.Interop.Word if fixing the Sparx EA document build fails.)