report.hwxdocxtypes Module#

Chapter class#

class Chapter(name=None, parent=None, **kwargs)#

Bases: object

Chapter class creates new chapter object as a child of either a document or and other chapter.

If ‘name’ value is None, creates new chapter with unique name.

If ‘name’ value is not None and no entity of same name exists in the specified report session, new chapter gets created with the given name.

If ‘name’ value is not None and entity of same name exists in the specified session, an error is returned.

Parameters:
  • name (str) – The chapter name.

  • parent (Document | Chapter) – Parent of this chapter.

getChildren(childrenLevel=0, type=[], name=None)#

Returns children of this document as list.

Parameters:
  • childrenLevel (str | int) –

    -1 - Returns all children until last level.

    0 - Returns only direct children of this document. (default)

    1 - Returns children and immediate grand-children of this document. Based on level value, returns all children until that level.

    It also takes string as input. Valid values are:

    ’current’ - Returns only direct children of this document.

    ’next’ - Returns children and immediate grand-children of this document.

    ’all’ - Returns all children until that last level.

  • type (list) – Filters children based on type. By default, no filter is applied. Valid values are ‘DocImage’, ‘DocTable’, ‘DocText’, ‘Chapter’. Default is empty list.

Returns:

List of children of this document.

Return type:

list

property cssclassidHTML#

The CSS class or ID of the chapter. Only for HTML export.

Getter:

Gets the CSS class or ID of the chapter.

Setter:

Sets the CSS class or ID of the chapter.

Type:

str

property layoutid#

Replicates the HyperMesh layout. In docx, images and text can be arranged as per layout. Table not supported. In case of HTML image, text and table are arranged as per layout.

Getter:

Gets layout id.

Setter:

Sets layout id.

Type:

int

property name#

The chapter name.

Getter:

Gets the name of the chapter.

Setter:

Sets the name of the chapter.

Type:

str

property parent#

Returns the parent of the chapter.

Returns:

Parent of the chapter.

Return type:

Document | Chapter

DocImage class#

class DocImage(*args, **kwargs)#

Bases: object

DocImage class constructor can create both new image entity or a reference to an existing image entity present in the library.

In case of a reference, any property changes made on the library image will be reflected in all references. If any changes need to be made to a DocImage, a copy of image gets created and the changes are applied to the copy so the original remains unchanged.

If the specified name does not exists in the report session, a new image/reference is created with given name.

If the specified name exists in the active report session, an error is returned.

Parameters:
  • parent (Document | Chapter) – Parent of the image

  • image (Image | str | numpy-ndarray) – If type is ‘Image’, reference-image gets created. If type is ‘str’ or ‘numpy-ndarray’, a new image gets created.

  • name (str) – Unique name for the image

setAttributes(**kwargs)#

Set multiple attributes.

Parameters:

kwargs (dict) – Valid keywords are name, caption, source, width, height, page, window, and binarydata.

property alignment#

Image alignment. Valid values are ‘none’, ‘left’, ‘right’, ‘center’, ‘justify’ and ‘distribute’.

Getter:

Gets image alignment.

Setter:

Sets image alignment.

Type:

str

property binarydata#

The image content as binary data.

Getter:

Gets the image content as binary data.

Setter:

Sets the image content as binary data.

Type:

numpy-ndarray

property caption#

The image caption.

Getter:

Gets the image caption.

Setter:

Sets the image caption.

Type:

str

property crop#

Flag to crop the image empty white-space around model while getting captured from GUI. Valid only when source is ‘graphic’.

Getter:

Gets status of crop.

Setter:

Sets status of crop.

Type:

bool

property format#

Get or set the format of the image when image is captured from GUI. Valid only when source is ‘graphic’. Valid values are ‘png’, ‘jpg’, ‘gif’, ‘avi’, ‘mp4’, ‘glb’ and ‘h3d’.

Getter:

Gets the image format.

Setter:

Sets the image format.

Type:

str

property name#

The image name.

Getter:

Gets the name of the image.

Setter:

Sets the name of the image.

Type:

str

property page#

The page index to capture image. This is applicable only when source is ‘graphic’.

Getter:

Gets the page index.

Setter:

Sets the page index.

Type:

int

property parent#

The parent of the image.

Getter:

Gets the image parent.

Setter:

Sets the image parent.

Type:

Document | Chapter

property path#

The image file path.

Getter:

Gets the image file path.

Setter:

Sets the image file path.

Type:

str

property source#

The image source type.

Getter:

Gets the image source type.

Setter:

Sets the image source type. Valid values are ‘graphic’ and ‘file’.

Type:

str

property type#

The image type.

Returns:

Image type. Possible values are ‘bmp’, ‘jpg’, ‘jpeg’, ‘png’, ‘gif’, ‘h3d’, and ‘glb’.

Return type:

str

property window#

The window index to capture image. This is applicable only when source is ‘graphic’.

Getter:

Gets the window index.

Setter:

Sets the window index.

Type:

int

DocTable class#

class DocTable(*args, **kwargs)#

Bases: object

DocTable class can create both a new table entity or a reference to an existing table entity present in the library.

In case of reference, any property value changes made in library table, it will reflect in all references. Also in case of reference entity, if any changes need to be made to ‘DocTable’, copy of table gets created and then update the changes. So that, original table remains unchanged.

If ‘name’ does not exists in report session, then new table/reference gets created with given name.

If ‘name’ exists in active report-session, then error thrown.

Parameters:
  • parent (Document | Chapter) – Parent of this table.

  • table (Table | str) – If type is ‘Table’, reference-table gets created. If type is csv-filepath, new table gets created.

  • name (str) – Unique name for this table

addColumn()#

Method to add a new column to the table.

cell(row_idx, col_idx)#

Method to get access to a specific cell.

Parameters:
  • row_idx (int) – Row index

  • col_idx (int) – Column index

Returns:

Table cell object

Return type:

TableCell

exportCsv(file: str)#

Method to export table data to a CSV file.

Parameters:

file (str) – The CSV file path.

getCellValue(row: int, col: int)#

Method to get a cell value.

Parameters:
  • row (int) – Row index

  • col (int) – Column index

Returns:

Cell value

Return type:

hwVariant

mergeCells(cell1, cell2)#

Method to merge table cells.

Parameters:
removeColumn(col: int)#

Method to remove a column at specified index.

Parameters:

col (int) – Column index

removeRow(row: int)#

Method to remove a row at specified index.

Parameters:

row (int) – Row index

setAttributes(**kwargs)#

Method to set multiple attributes.

Parameters:

kwargs (dict) – Valid keywords are name, caption, source, file, width, and height.

setCellValue(row: int, col: int, value)#

Method to set a cell value at particular index.

Parameters:
  • row (int) – Row index

  • col (int) – Column index

  • value (str|int|float) – Cell value

setColumnColor(index: int = 0, color: str = [0, 0, 0])#

Method to set column color. Only for HTML export.

Parameters:
  • index (int) – Column index

  • color (list) – Column color

setColumnWidth(index: int, width: float)#

Method to set column width. Only for Docx. Not supported for HTML export.

Parameters:
  • index (int) – Column index

  • width (float) – Column width

setDimension(rows: int, cols: int)#

Method to set number of rows and columns for the table.

Parameters:
  • rows (int) – Row count

  • cols (int) – Column count

setExportRange(row_start: int, col_start: int, row_end: int, col_end: int)#

Method to select cell range of table to export.

Parameters:
  • row_start (int) – Start row index. Starts from 0.

  • col_start (int) – Start column index. Starts from 0.

  • row_end (int) – End row index.

  • col_end (int) – End column index.

setRowColor(index: int = 0, color: str = [0, 0, 0])#

Method to set row color. Only for HTML export.

Parameters:
  • index (int) – Row index

  • color (list) – Row color

setRowHeight(index: int, height: float)#

Method to set row height. Only for Docx. Not supported for HTML export.

Parameters:
  • index (int) – Row index

  • height (float) – Row height

property alignment#

Table alignment. Valid values are ‘none’, ‘left’, ‘right’, ‘center’, ‘justify’ and ‘distribute’.

Getter:

Gets table alignment.

Setter:

Sets table alignment.

Type:

str

property autoSortHTML#

The flag to activate or deactivate the table auto sort. Only for HTML export.

Getter:

Gets the status of the table auto sort.

Setter:

Sets the status of the table auto sort.

Type:

bool

property autoToolTipHTML#

The flag to activate or deactivate the table auto tool tip. Only for HTML export.

Getter:

Gets the status of the table auto tool tip.

Setter:

Sets the status of the table auto tool tip.

Type:

bool

property caption#

The table caption.

Getter:

Gets the caption of the table.

Setter:

Sets the caption of the table.

Type:

str

property captionposition#

The table caption position.

Getter:

Gets the table caption position.

Setter:

Sets the table caption position.

Type:

str

property columnColorGradient#

The column color gradient. Only for HTML export.

Getter:

Gets the column color gradient.

Setter:

Sets the column color gradient.

Type:

list

property columns#

Returns table column count.

Returns:

Column count

Return type:

int

property file#

The path of the CSV file loaded as table data.

Getter:

Gets the table CSV file path.

Setter:

Sets the table CSV file path.

Type:

str

property filterTypeHTML#

Filter type for table. Valid values are ‘none’, ‘combo’, ‘text’. Only for HTML export.

Getter:

Gets filter type for table

Setter:

Sets filter type for table.

Type:

str

property fontsize#

The table font size.

Getter:

Gets the table font size.

Setter:

Sets the table font size.

Type:

int

property height#

The table height.

Getter:

Gets the table height.

Setter:

Sets the table height.

Type:

int

property name#

The table name.

Getter:

Gets the name of the table.

Setter:

Sets the name of the table.

Type:

str

property parent#

The parent of the table.

Getter:

Gets the table parent.

Setter:

Sets the table parent.

Type:

Document | Chapter

property rowColorGradient#

The row color gradient. Only for HTML export.

Getter:

Gets the row color gradient.

Setter:

Sets the row color gradient.

Type:

list

property rows#

Returns table row count.

Returns:

Row count

Return type:

int

property splitAuto#

The flag to activate or deactivate the table auto split.

Getter:

Gets the status of the table auto split.

Setter:

Sets the status of the table auto split.

Type:

bool

property splitMaxColumns#

The maximum number of columns in the table, used in splitting.

Getter:

Gets the maximum number of columns.

Setter:

Sets the maximum number of columns.

Type:

int

property splitMaxRows#

The maximum number of rows in the table, used in splitting.

Getter:

Gets the maximum number of rows.

Setter:

Sets the maximum number of rows.

Type:

int

property width#

The table width.

Getter:

Gets the table width.

Setter:

Sets the table width.

Type:

int

DocText class#

class DocText(*args, **kwargs)#

Bases: object

DocText class can create both new text entity or reference to existing text entity present in the library.

In case of a reference, any property value changes made in library text will reflect in all references.

In case of a reference entity, if any changes need to be made to ‘DocText’, a copy of text gets created and then changes are applied so the original text remains unchanged.

If ‘name’ does not exists in report session, a new text or reference gets created with the given name.

If ‘name’ exists in active report-session, an error is returned.

Parameters:
  • parent (Document | Chapter) – Parent of this text.

  • text (Text | str) – If type is ‘Text’, reference-text gets created. If type is ‘str’, new text gets created.

  • name (str) – Unique name for this text

addFormatedText(text: str | None = '', equation: str | None = None, font_name: str | None = 'Arial', font_size: int | None = 9, font_color: List[int] | None = [0, 0, 0], bold: bool | None = False, italic: bool | None = False, underline: bool | None = False, line_break: bool | None = False, tab_space: bool | None = False, hyperlink: str | None = '')#

Method to add new run to the first paragraph of a text entity.

Parameters:
  • text (str) – New run text

  • equation (str) – New run equation

  • font_name (str) – New run font name

  • font_size (int) – New run font size

  • bold (bool) – New run bold status

  • italic (bool) – New run italic status

  • underline (bool) – New run underline status

  • line_break (bool) – New run linebreak status

  • tab_space (bool) – New run tabspace status

  • hyperlink (str) – New run hyperlink

addImage(image, lineBreak=False)#

Method to add new image to the first paragraph of text entity.

Parameters:
  • image (str | numpy-ndarray) – Image path or stream

  • lineBreak (bool) – Add line break for image

setAttributes(**kwargs)#

Method to set multiple attributes.

Parameters:

kwargs (dict) – Valid keywords are name, fontName, fontColor, fontSize, boldFont, italicFont, underline, lineBreak, tabSpace, hyperLink, textcontent, and alignment.

property alignment#

The text alignment. Valid values are ‘none’, ‘left’, ‘right’, ‘center’, ‘justify’, ‘justifyLow’, and ‘distribute’.

Getter:

Gets the text alignment.

Setter:

Sets the text alignment.

Type:

str

property boldFont#

The flag to activate or deactivate the bold font.

Getter:

Gets the status of the bolt font.

Setter:

Sets the status of the bolt font.

Type:

bool

property fontColor#

The font color as a list of RGB values [r,g,b]. Valid values range from 0 to 255.

Getter:

Gets the name of the font color.

Setter:

Sets the name of the font color.

Type:

list

property fontName#

The font name.

Getter:

Gets the name of the font.

Setter:

Sets the name of the font.

Type:

str

property fontSize#

The font size.

Getter:

Gets the name of the size.

Setter:

Sets the name of the size.

Type:

str

The hyperlink definition.

Getter:

Gets the hyperlink.

Setter:

Sets the hyperlink.

Type:

str

property italicFont#

The flag to activate or deactivate the italic font.

Getter:

Gets the status of the italic font.

Setter:

Sets the status of the italic font.

Type:

bool

property lineBreak#

The flag to activate or deactivate the line break.

Getter:

Gets the status of the line break.

Setter:

Sets the status of the line break.

Type:

bool

property name#

The text name.

Getter:

Gets the name of the text.

Setter:

Sets the name of the text.

Type:

str

property parent#

The parent of the text.

Getter:

Gets the text parent.

Setter:

Sets the text parent.

Type:

Document | Chapter

property tabSpace#

The flag to activate or deactivate the tabular space.

Getter:

Gets the status of the tabular space.

Setter:

Sets the status of the tabular space.

Type:

bool

property textcontent#

The text to default run of default paragraph.

Getter:

Gets the text.

Setter:

Sets the text.

Type:

str

property underline#

The flag to activate or deactivate the underline.

Getter:

Gets the status of the underline.

Setter:

Sets the status of the underline.

Type:

bool

Document class#

class Document(name=None, **kwargs)#

Bases: CommonProperties

Document class creates document object under Report object.

If ‘name’ value is None, creates new document with unique name.

If ‘name’ value is not None and no entity of same name exists in specified report session, a new image gets created with given name.

If ‘name’ value is not None and any entity of same name exists in specified session, an error is returned.

Parameters:

name (str) – Document name

getChildren(childrenLevel=0, type=[], name=None)#

Returns children of this document as list.

Parameters:
  • childrenLevel (str | int) –

    -1 - Returns all children until last level.

    0 - Returns only direct children of this document. (default)

    1 - Returns children and immediate grand-children of this document. Based on level value, returns all children until that level.

    It also takes string as input:

    ’current’ - Returns only direct children of this document.

    ’next’ - Returns children and immediate grand-children of this document.

    ’all’ - Returns all children until that last level.

  • type (list) – Filters children based on type. By default, no filter is applied. Valid values are ‘DocImage’, ‘DocTable’, ‘DocText’, ‘Chapter’. Default is empty list.

Returns:

Return list of children of this document.

Return type:

list

saveAsHTML(path=None, outputtemplate='', open=False, **kwargs) None#

Method to export document report as HTML.

Parameters:
  • path (str) – File path for HTML file.

  • outputtemplate (str) – Path of output html template (layout).

  • open (bool) – Opens file after creation (default False)

Returns:

Export result and exported filepath

Return type:

HwxReportResult and str

saveDocx(path=None, **kwargs)#

Save output document file

Parameters:
  • path (str) – Generated document file path

  • kwargs (dict) – Possible keys are open, mode, newname

Returns:

Export result and exported filepath

Return type:

HwxReportResult, str

savePDF(path=None, **kwargs)#

Method to save a PDF file.

Parameters:
  • path (str) – Generated PDF file path

  • kwargs (dict) – Valid keyword is open.

setAttributes(**kwargs)#

Set multiple attributes

Parameters:

kwargs (dict) – Valid keywords are name, template

update(val=None)#

Method to capture specific images/models based on their page and window id from GUI. By default, it captures all the Image/DocImage objects inside the document, in which the source is equal to ‘graphic’.

Parameters:

val (list of Image | DocImage | Chapter) – None or list of objects to be processed in GUI capturing. If none, all children gets processed.

property name#

The name of the entity.

Getter:

Gets the name of the entity.

Setter:

Sets the name of the entity.

Type:

str

property resolution#

Document resolution type. Valid values are ‘HD’, ‘UHD’, ‘Low’, ‘Desktop’, ‘Medium’ and custom values as list [width, height].

Getter:

Gets the presentation resolution type.

Setter:

Sets the presentation resolution type.

Type:

str or list

property session#

Returns session to which this entity belongs.

Returns:

Report session

Return type:

ReportSession

property template#

Returns template filename used for document export.

Returns:

Template filepath used for document export.

Return type:

str

property templateHTML#

Returns template HTML content used for document export.

Returns:

Template HTML content used for document export.

Return type:

str

Note

The HwxReportResult object returned by saveDocx(), saveAsHTML() in an object containing two attributes message, status. If status=0 then report is exported successfully.

Image class#

class Image(name=None, **kwargs)#

Bases: CommonProperties

Image class creates new image entity

If ‘name’ value is None, creates new image with unique name.

If ‘name’ value is not None and session of ‘name’ does not exists, then new image gets created with given name.

If ‘name’ value is not None and session of ‘name’ exists, then error thrown.

Parameters:
  • name (str) – Image name.

  • session (str) – Session name. If not specified, uses currently active report session name

  • path (str) – Source image file path.

  • source (str) – Valid values are ‘graphic’ and ‘file’ (default).

setAttributes(**kwargs)#

Method to set multiple attributes.

Parameters:

kwargs (dict) – Valid keywords are name, source, type, path, caption, page, and window.

property alignment#

Image alignment. Valid values are ‘none’, ‘left’, ‘right’, ‘center’, ‘justify’ and ‘distribute’.

Getter:

Gets image alignment.

Setter:

Sets image alignment.

Type:

str

property binarydata#

The image content as binary data.

Getter:

Gets the image content as binary data.

Setter:

Sets the image content as binary data.

Type:

numpy-ndarray

property caption#

The image caption.

Getter:

Gets the image caption.

Setter:

Sets the image caption.

Type:

str

property captionposition#

Image caption position. Valid values are ‘bottom’ and ‘top’. Default is ‘bottom’.

Getter:

Gets caption position.

Setter:

Sets caption position.

Type:

str

property crop#

Flag to crop the image empty white-space around model while getting captured from GUI. Valid only when source is ‘graphic’.

Getter:

Gets status of crop.

Setter:

Sets status of crop.

Type:

bool

property ensureFit#

The flag to activate or deactivate the ensure fit.

Getter:

Gets the status of the ensure fit.

Setter:

Sets the status of the ensure fit.

Type:

bool

property format#

Get or set the format of the image when image is captured from GUI. Valid only when source is ‘graphic’. Valid values are ‘png’, ‘jpg’, ‘gif’, ‘avi’, ‘mp4’, ‘glb’ and ‘h3d’.

Getter:

Gets the image format.

Setter:

Sets the image format.

Type:

str

property name#

The name of the entity.

Getter:

Gets the name of the entity.

Setter:

Sets the name of the entity.

Type:

str

property page#

Get or set the page id to capture image. Valid only when the source of image is ‘graphic’.

Getter:

Gets page id.

Setter:

Sets page id.

Type:

int

property path#

The image file path.

Getter:

Gets the image file path.

Setter:

Sets the image file path.

Type:

str

property previewImage#

Enable/disable preview image for GLB or H3D model. Enabling this flag assumes preview image is present in the same directory as the model file. The preview image should be PNG image where its name is same as model name with the suffix ‘_pv’.

Getter:

Gets the status of the preview image.

Setter:

Sets the status of the preview image.

Type:

bool

property session#

Returns session to which this entity belongs.

Returns:

Report session

Return type:

ReportSession

property source#

The image source type. Valid values are ‘graphic’ and ‘file’.

Getter:

Gets the image source type.

Setter:

Sets the image source type.

Type:

str

property type#

The image format type. Valid values are ‘jpg’, ‘png’, and ‘bmp’.

Getter:

Gets the image format type.

Setter:

Sets the image format type.

Type:

str

property window#

Get or set window id to capture image. This is applicable only when source is ‘graphic’.

Getter:

Gets window id.

Setter:

Sets window id.

Type:

int

MsBulletType class#

enum MsBulletType(value)#

Valid values are as follows:

BulletMixed = <MsBulletType.BulletMixed: -2>#
BulletNone = <MsBulletType.BulletNone: 0>#
BulletNumbered = <MsBulletType.BulletNumbered: 2>#
BulletPicture = <MsBulletType.BulletPicture: 3>#
BulletUnnumbered = <MsBulletType.BulletUnnumbered: 1>#

Paragraph class#

class Paragraph(parent=None, name: str = None, **kwargs)#

Bases: object

Class representing a Paragraph object. Each paragraph object represents text or a block of different texts formats inserted in a paragraph. Existing paragraph can be fetched using getParagraph method of a Text object. New paragraph can be created/added with Text object as parent.

Parameters:
  • parent (Text) – Parent of this paragraph.

  • name (str) – Name of this Paragraph. Optional

addRun(text: str | None = '', equation: str | None = None, font_name: str | None = '', font_size: int | None = 9, font_color: List[int] | None = [0, 0, 0], bold: bool | None = False, italic: bool | None = False, underline: bool | None = False, line_break: bool | None = False, tab_space: bool | None = False, image_path: str | None = '', hyperlink: str | None = '', image_stream: ndarray | None = None)#

Method to add a Run object (text) in the current Paragraph object.

Parameters:
  • text (str) – New run text.

  • equation (str) – New run equation.

  • font_name (str) – New run font name

  • font_size (int) – New run font size.

  • font_color (List[int]) – New run font color.

  • bold (bool) – New run bold status.

  • italic (bool) – New run italic status.

  • underline (bool) – New run underline status.

  • line_break (bool) – New run linebreak status.

  • tab_space (bool) – New run tabspace status.

  • image_path (str) – New run image path.

  • hyperlink (str) – New run hyperlink.

  • image_stream (numpy.ndarray) – New run image stream.

getRun(index: int = 0)#

Return run or equation object present at ‘index’ in the paragraph.

Parameters:

index (int) – Index of run in paragraph.

Returns:

Run or Equation object.

Return type:

Run or Equation

removeRun(index: int)#

Method to remove run or equation object present at ‘index’ in the paragraph.

Parameters:

index (int) – Index of run or equation in paragraph.

setAttributes(**kwargs)#

Method to set multiple attributes.

Parameters:

kwargs (dict) – Valid keywords are alignment, bulletLevel, bulletStyle, bulletType, lineBreak, lineSpacing, spaceAfter, spaceBefore, text

property alignment#

Paragraph alignment. Valid values are the enums of PARAGRAPH_ALIGN.

Getter:

Gets the Paragraph alignment.

Setter:

Sets the Paragraph alignment.

Type:

PARAGRAPH_ALIGN

property bulletLevel#

Paragraph object indentation when listed (bullet-list, number-list). Valid values are the integers 1-7. Default is 1.

Getter:

Gets the Paragraph bullet level.

Setter:

Sets the Paragraph bullet level.

Type:

int

property bulletStyle#

Paragraph bullet/number style. For pptx, valid enums are from PpBulletCharStyle and PpBulletNumberedStyle. For docx, valid enums are from WdBulletCharStyle and WdBulletNumberedStyle.

Getter:

Gets the Paragraph bullet style.

Setter:

Sets the Paragraph bullet style.

Type:

PpBulletCharStyle or PpBulletNumberedStyle or WdBulletCharStyle or WdBulletNumberedStyle

property bulletType#

Bullet type of Paragraph if it gets listed. If the Paragraph content listed with bullet then we set MsBulletType.BulletUnnumbered. If the paragraph content listed with the number then we set MsBulletType.BulletNumbered.

Getter:

Get paragraph bullet type.

Setter:

Set paragraph bullet type.

Type:

MsBulletType

property lineBreak#

Flag to activate/deactivate line break flag.

Getter:

Gets status of line-break.

Setter:

Sets status of line-break.

Type:

bool

property lineSpacing#

Flag to activate or deactivate the line spacing.

Getter:

Gets status of line spacing.

Setter:

Sets status of line spacing.

Type:

int

property spaceAfter#

Flag to set or not set space after Paragraph.

Getter:

Gets status of space-after.

Setter:

Sets status of space-after.

Type:

int

property spaceBefore#

Flag to set or not set space before Paragraph.

Getter:

Gets status of space-before.

Setter:

Sets status of space-before.

Type:

int

property text#

Flag to get or set text of first Run object.

Getter:

Gets text content of first Run object.

Setter:

Sets text content of first Run object.

Type:

str

PARAGRAPH_ALIGN class#

enum PARAGRAPH_ALIGN(value)#

Valid values are as follows:

NONE = <PARAGRAPH_ALIGN.NONE: 0>#
LEFT = <PARAGRAPH_ALIGN.LEFT: 1>#
RIGHT = <PARAGRAPH_ALIGN.RIGHT: 2>#
CENTER = <PARAGRAPH_ALIGN.CENTER: 3>#
JUSTIFY = <PARAGRAPH_ALIGN.JUSTIFY: 4>#
JUSTIFY_LOW = <PARAGRAPH_ALIGN.JUSTIFY_LOW: 5>#
DISTRIBUTE = <PARAGRAPH_ALIGN.DISTRIBUTE: 6>#

ReportManager class#

class ReportManager(**kwargs)#

Bases: object

ReportManager class can provide information about all available report sessions and the active report session.

getAllSessionNames()#

Method to return list of all available report session names.

Returns:

All report session names

Return type:

list

property activeSession#

The active session.

Getter:

Gets the active session name.

Setter:

Sets the active session.

Type:

str

ReportSession class#

class ReportSession(name=None, **kwargs)#

Bases: object

ReportSession can create new report session or return an existing report session.

If ‘name’ value is None, ReportSession can create new session with unique name.

If ‘name’ value is not None and session of ‘name’ does not exists, then ReportSession creates new session.

If ‘name’ value is not None and session of ‘name’ exists, then ReportSession returns existing session.

Parameters:

value (str) – Report session name

close()#

Method to close the report session. This method will delete the report session and destroy the model.

delete(objects)#

Method to delete entities from the session.

Parameters:

objects (Single object or list of Table | Text | Image | Presentation | Slide | SlideImage | SlideTable | SlideText | Chapter | Document | DocImage | DocTable | DocText) – Entity object to be deleted or list of entity objects to be deleted

get(entity_type, entity_name)#

Method to find and return an entity object based on entity type and name. If not found, returns None.

Parameters:
Returns:

Report entity object

Return type:

Table | Text | Image | Presentation | Slide | SlideImage | SlideTable | SlideText | Chapter | Document

getLayouts(output_type=None)#

Method to return all layout objects or layout names in the session.

Parameters:

output_type (str | None) – Valid values are ‘name’ and None.

Returns:

List of layout names or layout objects

Return type:

list

paste(paste_objects, destination)#

Method to copy entities and create new entities in the destination.

Parameters:
  • paste_objects (Single object or list of DocImage | DocTable | DocText) – Entity object to be pasted or list of entity objects to be pasted

  • destination (Document | Chapter) – Destination object where entity will be pasted

reset()#

Method to delete all entities present in the report session.

property activePresentation#

The active presentation in the report session.

Getter:

Gets the active presentation name.

Setter:

Sets the active presentation.

Type:

str

property name#

Returns report session name.

Returns:

Report session name

Return type:

str

property session#

Returns session.

Returns:

Report session

Return type:

ReportSession

property tempdir#

Returns temporary path of the report session.

Returns:

Temporary path

Return type:

str

Run class#

class Run(parent, **kwargs)#

Bases: object

Class representing a Run object. Existing Run can be fetched using getRun method of a Paragraph object. New Run can be created/added with Paragraph object as parent.

Parameters:

parent (Paragraph) – Parent of this run.

property boldFont#

Flag to activate or deactivate bold font of run text.

Getter:

Gets bold font status.

Setter:

Sets bold font status.

Type:

bool

property fontColor#

Get or set run font color.

Getter:

Gets font color.

Setter:

Sets font color.

Type:

list[int]

property fontName#

Get or set run font name.

Getter:

Gets font name.

Setter:

Sets font name.

Type:

str

property fontSize#

Get or set run font size.

Getter:

Gets font size.

Setter:

Sets font size.

Type:

int

Get or set the run hyperlink path.

Getter:

Gets path of hyperlink.

Setter:

Sets path of hyperlink.

Type:

str

property italicFont#

Flag to activate or deactivate the run italics.

Getter:

Gets status of run italics.

Setter:

Sets status of run italics.

Type:

bool

property lineBreak#

Flag to activate or deactivate run line break.

Getter:

Gets line-break status.

Setter:

Sets line-break status.

Type:

bool

property runImagePath#

Adds image as run content using image file path.

Getter:

Gets file path of image added as run content.

Setter:

Sets image as run content.

Type:

str

property runImageStream#

Adds image as run content using image binary data.

Getter:

Gets binary data of image added as run content.

Setter:

Sets image as run content.

Type:

numpy.ndarray

property runText#

Text content of this run.

Getter:

Gets run text.

Setter:

Sets run text.

Type:

str

property tabSpace#

Flag to activate or deactivate the run tab space.

Getter:

Gets tab space status.

Setter:

Sets tab space status.

Type:

bool

property underline#

Flag to activate or deactivate the run underline status.

Getter:

Gets status of underline.

Setter:

Sets status of underline.

Type:

bool

Table class#

class Table(name=None, **kwargs)#

Bases: CommonProperties

Table class creates table entity.

If ‘name’ value is None, creates new table with unique name.

If ‘name’ value is not None and no entity of same name exists in specified report session, a new table gets created with given name.

If ‘name’ value is not None and any entity of same name exists in specified session, an error is returned.

Parameters:
  • name (str) – Table name.

  • session (ReportSession) – Session name. If not specified, uses currently active report session name.

  • datafile (str) – CSV file path.

addColumn()#

Method to add new column to table.

cell(row_idx, col_idx)#

Method to get access to a specific cell.

Parameters:
  • row_idx (int) – Row index

  • col_idx (int) – Column index

Returns:

Table cell object

Return type:

TableCell

exportCsv(file: str) int#

Method to export the table content to a CSV file.

Parameters:

file (str) – CSV file path

getCellValue(row: int, col: int)#

Method to get cell value for at particular index.

Parameters:
  • row (int) – Row index

  • col (int) – Column index

Returns:

Cell value

Return type:

hwVariant

loadCsv(file: str) int#

Method to loads content of a CSV file to the table entity.

Parameters:

file (str) – CSV file path

mergeCells(cell1, cell2)#

Method to merge table cells.

Parameters:
removeColumn(index: int)#

Method to remove column at specified index.

Parameters:

col (int) – Column index

removeRow(index: int)#

Method to remove row at specified index.

Parameters:

row (int) – Row index

setAttributes(**kwargs)#

Method to set multiple attributes.

Parameters:

kwargs (dict) – Valid keywords are name, csvFile, caption, split, splitBy, maxRows, maxColumns, and stretch.

setCellValue(row: int, col: int, value)#

Method to set cell value for at particular index.

Parameters:
  • row (int) – Row index

  • col (int) – Column index

  • value (str|int|float) – Cell value

setColumnColor(index: int = 0, color: list = [0, 0, 0])#

Method to set column color. Only for HTML export.

Parameters:
  • index (int) – Column index

  • color (list) – RGB color

setColumnWidth(index: int, width: float)#

Method to set column width.

Parameters:
  • index (int) – Column index

  • width (float) – Column width

setDimension(rows: int, cols: int)#

Method to set number of rows and columns for table.

Parameters:
  • rows (int) – Row count

  • cols (int) – Column count

setExportRange(row_start: int, col_start: int, row_end: int, col_end: int)#

Method to select cell range of table to export.

Parameters:
  • row_start (int) – Start row index. Starts from 0.

  • col_start (int) – Start column index. Starts from 0.

  • row_end (int) – End row index.

  • col_end (int) – End column index.

setRowColor(index: int = 0, color: list = [0, 0, 0])#

Method to set row color. Only for HTML export.

Parameters:
  • index (int) – Row index

  • color (list) – RGB color

setRowHeight(row_index: int, height: float)#

Method to set row height.

Parameters:
  • index (int) – Row index

  • height (float) – Row height

property alignment#

Table alignment. Valid values are ‘none’, ‘left’, ‘right’, ‘center’, ‘justify’ and ‘distribute’.

Getter:

Gets table alignment.

Setter:

Sets table alignment.

Type:

str

property autoSortHTML#

The flag to activate or deactivate autosort. Only for HTML export.

Getter:

Gets the status of the autosort.

Setter:

Sets the status of the autosort.

Type:

bool

property autoToolTipHTML#

The flag to activate or deactivate autotooltip. Only for HTML export.

Getter:

Gets the status of the autotooltip.

Setter:

Sets the status of the autotooltip.

Type:

bool

property borderVisibility#

The table border visibility. An enumeration.

Getter:

Gets the table border visibility.

Setter:

Sets the table border visibility.

Type:

TableBordersVisibility

property caption#

The table caption.

Getter:

Gets the table caption.

Setter:

Sets the table caption.

Type:

str

property captionposition#

Table caption position. Valid values are ‘bottom’ and ‘top’. Default is ‘bottom’.

Getter:

Gets caption position.

Setter:

Sets caption position.

Type:

str

property columnColorGradient#

The flag to activate or deactivate column color gradient. Only for HTML export.

Getter:

Gets the status of the column color gradient.

Setter:

Sets the status of the column color gradient.

Type:

list

property columns#

Returns table column count.

Returns:

Column count

Return type:

int

property csvFile#

The path of the CSV file loaded as the table data.

Getter:

Gets the table CSV file path.

Setter:

Sets the table CSV file path.

Type:

str

property filterTypeHTML#

Filter type for table. Valid values are ‘none’, ‘combo’, ‘text’. Only for HTML export.

Getter:

Gets filter type for table

Setter:

Sets filter type for table.

Type:

str

property fontsize#

The font size.

Getter:

Gets the name of the size.

Setter:

Sets the name of the size.

Type:

str

property name#

The name of the entity.

Getter:

Gets the name of the entity.

Setter:

Sets the name of the entity.

Type:

str

property rowColorGradient#

The flag to activate or deactivate row color gradient. Only for HTML export.

Getter:

Gets the status of the row color gradient.

Setter:

Sets the status of the row color gradient.

Type:

list

property rows#

Returns table row count.

Returns:

Row count

Return type:

int

property session#

Returns session to which this entity belongs.

Returns:

Report session

Return type:

ReportSession

property splitAuto#

The flag to activate or deactivate the table auto split.

Getter:

Gets the status of the table auto split.

Setter:

Sets the status of the table auto split.

Type:

bool

property splitMaxColumns#

The maximum number of columns in the table, used in splitting.

Getter:

Gets the maximum number of columns.

Setter:

Sets the maximum number of columns.

Type:

int

property splitMaxRows#

The maximum number of rows in the table, used in splitting.

Getter:

Gets the maximum number of rows.

Setter:

Sets the maximum number of rows.

Type:

int

property stretch#

The flag to activate or deactivate the table stretch.

Getter:

Gets the status of the table stretch.

Setter:

Sets the status of the table stretch.

Type:

bool

TableBordersVisibility class#

enum TableBordersVisibility(value)#

Valid values are as follows:

ALL_BORDERS = <TableBordersVisibility.ALL_BORDERS: 0>#
NO_BORDERS = <TableBordersVisibility.NO_BORDERS: 1>#
BOTTOM = <TableBordersVisibility.BOTTOM: 2>#
TOP = <TableBordersVisibility.TOP: 3>#
LEFT = <TableBordersVisibility.LEFT: 4>#
RIGHT = <TableBordersVisibility.RIGHT: 5>#
INSIDE_HORIZONTAL = <TableBordersVisibility.INSIDE_HORIZONTAL: 6>#
INSIDE_VERTICAL = <TableBordersVisibility.INSIDE_VERTICAL: 7>#
ALL_OUTSIDE = <TableBordersVisibility.ALL_OUTSIDE: 8>#
ALL_INSIDE = <TableBordersVisibility.ALL_INSIDE: 9>#

TableCell class#

class TableCell(cellmdi, dttable, **kwargs)#

Bases: object

Class to represent a table cell. Users cannot create this object directly. Use the cell() method in Table/DocTable to get a cell object.

getColumnIndex()#

Method to get column index of the cell.

Returns:

Column index

Return type:

int

getRowIndex()#

Method to get row index of the cell.

Returns:

Row index

Return type:

int

getValue()#

Method to get text content of the cell.

Returns:

Cell text content

Return type:

str|int|float

setAttributes(**kwargs)#

Method to set multiple attributes.

Parameters:

kwargs (dict) – Valid keywords are backgroundColor, horizontalAlignment, verticalAlign, fontName, textColor, fontSize, boldFont, italicFont, underline, backgroundColor.

setValue(text=None, imagepath=None, hyperlink=None)#

Method to set cell value which can be either text or image. Hyperlink can be set for both text and image. If text is an equation, then hyperlink is not supported.

Parameters:
  • text (str) – Cell text content

  • imagepath (str) – Image path

  • hyperlink (str) – Hyperlink path

property backgroundColor#

Flag to set the cell background color.

Getter:

Gets the RGB list of background

Setter:

Sets the RGB list of background

Type:

List[int]

property boldFont#

Flag to activate or deactivate the cell text bold status.

Getter:

Gets the bold status of cell text

Setter:

Sets the bold status of cell text

Type:

bool

property fontName#

Flag to get/set font name of cell text content.

Getter:

Gets the font name

Setter:

Sets the font name

Type:

str

property fontSize#

Flag to get/set the font size of cell text.

Getter:

Gets the font size

Setter:

Sets the font size

Type:

int

property horizontalAlignment#

Flag to get/set the horizontal alignment of cell content. Valid values are ‘none’, ‘left’, ‘center’, ‘right’.

Getter:

Gets horizontal alignment of cell.

Setter:

Sets horizontal alignment of cell

Type:

str

property italicFont#

Flag to activate or deactivate the cell text italics status.

Getter:

Gets italics status of cell text

Setter:

Sets italics status of cell text

Type:

bool

property textColor#

Flag to set/get text color of cell text.

Getter:

Gets the RGB list of text color

Setter:

Sets the RGB list of text color

Type:

List[int]

property underline#

Flag to activate or deactivate the cell text undeline status.

Getter:

Gets underline status of cell text

Setter:

Sets underline status of cell text

Type:

bool

property verticalAlignment#

Flag to get/set the vertical alignment of cell content. Valid values are ‘none’, ‘bottom’, ‘center’, ‘top’, ‘mixed’.

Getter:

Gets the cell vertical alignment

Setter:

Sets the cell vertical alignment

Type:

str

Text class#

class Text(name=None, **kwargs)#

Bases: CommonProperties

Text class creates a new text entity.

If ‘name’ value is None, creates new text with unique name.

If ‘name’ value is not None and session of ‘name’ does not exists, then new text gets created with given name

If ‘name’ value is not None and session of ‘name’ exists, then error thrown.

Parameters:
  • name (str) – Text entity name

  • session (ReportSession) – Session name. If not specified, uses currently active report session name.

  • text (str) – Text content

addParagraph()#

Method to add new paragraph.

Returns:

Paragraph entity

Return type:

Paragraph

getParagraph(index: int = 0)#

Method to return paragraph present at ‘index’.

Parameters:

index (int) – Index of paragraph in text runs

Returns:

Paragraph entity

Return type:

Paragraph

removeParagraph(index: int)#

Method to remove paragraph present at ‘index’.

Parameters:

index (int) – Index of paragraph in text runs

setAttributes(**kwargs)#

Method to set multiple attributes.

Parameters:

kwargs (dict) – Valid keywords are name, text, ensureFit, and alignment.

property alignment#

The text alignment.

Getter:

Gets the text alignment.

Setter:

Sets the text alignment.

Type:

int

property name#

The name of the entity.

Getter:

Gets the name of the entity.

Setter:

Sets the name of the entity.

Type:

str

property session#

Returns session to which this entity belongs.

Returns:

Report session

Return type:

ReportSession

property text#

The default run text content.

Getter:

Gets the default run text content.

Setter:

Sets the default run text content.

Type:

str

WdBulletCharStyle class#

enum WdBulletCharStyle(value)#

Valid values are as follows:

bullet = <WdBulletCharStyle.bullet: 200>#

WdBulletNumberedStyle class#

enum WdBulletNumberedStyle(value)#

Valid values are as follows:

decimal = <WdBulletNumberedStyle.decimal: 100>#