Reputation: 39
I am working on an Enterprise Architect Add-In in C# in Visual Studio Express 2013 to make documentations for a single element/elements in a package. I made a template in EA with the help of the Document Generator, where i want to write some of the element's properties on the output. Example:
package >
element >
Name: {Element.Name}... more attributes of the element
< element
< package
The problem is that when i use my Add-In to generate the document the output will be like this:
package >
Name: Random TestName
< package
between package > < package is blank, and as default the document should not contain these fields in the output, how can i make it disappear? I tried to fill between the package fields with something like {Pkg.Version}, but i only get this text in the output, not the value of it. In the Document Template Designer under Sections window if i check "Element" box it checks the "Package" box too, but if i try to uncheck the "Package" it unchecks the "Element" too - any suggestions how can i make it work? My Add-In works like this:
EA.Element element = repository.GetTreeSelectedObject();
int elementID = element.ElementID;
EA.DocumentGenerator docGen = repository.CreateDocumentGenerator();
docGen.NewDocument("");
docGen.InsertTemplate("RandomTemp");
docGen.DocumentElement(elementID, 2, "RandomTemp"); // gets the element by ID
docGen.SaveDocument("DOCUMENT.pdf", EA.DocumentType.dtPDF);
+: that would work for me either if i can reach somehow the package properties of the element too.
Thanks in advance.
Tamas
Upvotes: 1
Views: 646
Reputation: 794
docGen.insertTemplate
prints out your template as is, without filling in the fields. Remove that line of code and it should be fine
The document will generate the report following your template just fine with the following line of code you put: docGen.DocumentElement(elementID, 2, "RandomTemp");
Upvotes: 2