Document Generator Interfaces
This document briefly describes the API interfaces available in the document generator plugin.
(Ansys.Ansoft.DocGeneratorPluginDotNet.dll)
Scripting objects available in the script for the Generate function
- oApp = self.GetUDDAppContext()
Gets the application context. Use this interface to get the active project ad the version of the product.
oDesktop = oApp.GetAppDesktop()
if oDesktop != None:
vr = oDesktop.GetVersion()
oProject = oDesktop.GetActiveProject()
- oDesign = self.GetUDDDesignContext()
Gets the design context. Use this interface to get the design name.
oDesign = self.GetUDDDesignContext()
if oDesign != None:
nm = oDesign.GetName()
- IUDDGenerator interface
This interface available in the Generate method of the UDDPluginExtension. This interface can be used to:
- Set the document output file path.
docgen.SetOutput("C:\\Examples\\DocumentOutput.xml")
- Get the document root.
docroot = docgen.GetDocumentRoot()
- Write out to the output file.
docgen.Write()
- Write HTML document
void WriteHTML();
- Write PDF document
void WritePDF();
- Load the HTML transform object
void LoadHTMLTransform();
- Load the cached PDF transform object
void LoadPDFTransform();
- Get script path
string GetScriptPath();
- Get output file path
string GetOutputFilePath();
- Set the document output file path.
- IUDDRoot interface
Calling GetDocumentRoot() on the IUDDGenerator interface provides you with the this interface. This interface can be used to:
- Add a new section to the document. Provide a section title.
section1 = docroot.AddSection("Section title")
- Add a new section to the document. Provide a section title and subtitle.
section1 = docroot.AddSection("Section title", "Section subtitle")
- Add a new title
section1 = docroot.AddTitle("Title")
- Add a new subtitle
section1 = docroot.AddSubtitle("Subtitle")
- Add a new section to the document. Provide a section title.
- IUDDSection interface
Calling AddSection() on the IUDDRoot interface provides you with this interface. This interface can be used to:
- Set an ID for the section for internal links.
section1.SetID("id")
- Add a new table to the document. Provide a table title.
table1 = section1.AddTable("Table title")
- Add a new image to the document. Provide an image title and a file path to the image file.
image1 = section1.AddImage("Image title")
- Add text to the document.
text1 = section1.AddText("Random text........")
- Set an ID for the section for internal links.
- IUDDImage interface
Calling AddImage() on the IUDDSection interface provides you with this interface. In this interface, you can call the following methods:
- Set an ID for the image for internal links.
image1.SetID("id")
- Set alignment information. Can be "center", "left", and "right".
image1.SetAligment("center")
- Set the file path of the image file. Not necessary if image file path is set through the AddImage() method.
image1.SetFileRef("Image path")
- Set the format of the image file. Can be "BMP", "PNG", "JPEG", "JPG", "DVI", etc.
image1.SetFormat("format")
- Set an ID for the image for internal links.
- IUDDText interface
Calling AddText() on the IUDDSection interface provides you with the this interface. In this interface, you can call the following methods:
- Set an ID for the text for internal links.
text1.SetID("id")
- Set the emphasis attribute on the text.
text1.SetEmphasis()
- Set the quotes attribute on the text.
Text1.SetQuotes()
- Set the block quotes attribute on the text.
text1.SetBlockquotes()
- Set quotes on the text.
Text1.SetQuotes()
- Set the wordsize attribute on the text
text1.SetSize(size as an integer)
- Set a link to an ID of any element to provide internal links
text1.SetLink("linkname")
- Set an event link to handle an event. The HandleUDDEvents method should be implemented in the script to handle the event.
text1.SetEventLink("linkname")
- Set an ID for the text for internal links.
- IUDDTable interface
Calling AddTable() on the IUDDSection interface provides you with the this interface. In this interface, you can call the following methods:
- Set an ID for the table for internal links.
table1.SetID("id")
- Set alignment information. Can be "center", "left", and "right".
table1.SetAlignment("center")
- Set the background color of the table
table1.SetBgColor(string bgcolor)
- Set the frame type. Can be "all", "bottom", "top", "sides", and "topbot".
table1.SetFrame(string frame)
- Add a table group and specify the number of columns. A table can have multiple table groups.
IUDDTableGroup table1.SetTableGroup(int columns)
- Set an ID for the table for internal links.
- IUDDTableGroup interface
Calling AddTableGroup() on the IUDDTable interface provides you with the this interface. In this interface, you can call the following methods:
- Set an ID for the table group for internal links.
tgroup1.SetID("id")
- Set alignment information. Can be "center", "left", and "right".
tgroup1.SetAlignment("center")
- Set the column width of a column given the index of the column and the required width. Width can be set in 2 ways.
- Width can be set relative to 1. E.g Setting it to "2*" makes the column width double the width of the others.
- If the entire table width is considered to be 99.99 units. Width can be a number relative to this.
tgroup1.SetColumnWidth(int index, string width)
- Add a header to the table group
IUDDTableRow tgroup1.AddHeader()
- Add a header with multiple rows to the table group. Takes number of sub rows.
IUDDTableRow tgroup1.AddHeader(int rows)
- Add a row of content to the table group
IUDDTableRow tgroup1.AddContent()
- Add content with multiple rows to the table group. Takes number of sub rows.
IUDDTableRow tgroup1.AddContent(int rows)
- Set an ID for the table group for internal links.
- IUDDTableRow interface
Calling AddHeader() & AddContent() on the IUDDTableGroup interface provides you with the this interface. In this interface, you can call the following methods:
- Set an ID for the table row for internal links.
trow1.SetID("id")
- Set alignment information. Can be "center", "left", and "right".
trow1.SetAlignment("center")
- Set cell text. Can be cell content or header text. Takes a column index and a text string. It is added to the first row.
IUDDTextElement trow1.Add(int column, string text)
- Set cell text. Can be cell content or header text. Takes a column index, row index and a text string. Takes in a row number because a table row can have multiple sub rows.
IUDDTextElement trow1.Add(int column, int subrow, string text)
- Set cell content. Takes a column index and an int value. It is added to the first row.
IUDDTextElement trow1.Add(int column, int value)
- Set cell content. Takes a column index, row index and a int value.
IUDDTextElement trow1.Add(int column, int subrow, string text)
- Set cell text. Takes a column index and a double value. It is added to the first row.
IUDDTextElement trow1.Add(int column, double value)
- Set cell text. Takes a column index, row index and a double value.
IUDDTextElement trow1.Add(int column, int subrow, double value)
- Set cell text spanning 2 columns. Can be cell content or header text. Takes a sub row index , starting column index., ending column index and a text string.
IUDDTextElement trow1.AddSpanningcolumnst(int subrow, int columnstart, int columnend, string text)
- Set cell text. Can be cell content or header text. Takes a column index, starting sub row index, ending sub row index and a text string.
IUDDTextElement trow1.AddpanningRows(int column, int subrowstart, int subrowend, string text)
- Set an ID for the table row for internal links.
- IUDDTableRow interface
Calling Add() on the IUDDTableGroup interface provides you with the this interface. In this interface, you can call the following methods :
- Set an ID for the table row for internal links.
trow1.SetID("id")
- Set alignment information . can be "center", "left", and "right".
trow1.SetAlignment("center")
- Set an ID for the table row for internal links.
Includes all the methods exposed by the IUDDText interface.