hw.report Module#
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. Optional. If not specified, uses currently active report session name
path (str) – Source image file path. Optional
source (str) – Optional. Possible values are ‘graphic’, ‘file’. If not specified, default value is ‘file’
- setAttributes(**kwargs)#
Set multiple attributes
- Parameters:
kwargs (dict) – Valid keywords are name, source, type, path, caption
- property binarydata#
Returns image caption
- Returns:
Image caption
- Return type:
str
- property ensureFit#
Returns ensure fit enabled or not
- Returns:
Ensure fit enabled or disabled
- Return type:
bool
- property path#
Returns image file path
- Returns:
Image file path
- Return type:
str
- property source#
Returns image source type.
- Returns:
Possible values are ‘graphic’, ‘file’
- Return type:
str
- property type#
Returns image type
- Returns:
Possible values are ‘jpg’, ‘png’, ‘bmp’
- Return type:
str
Layout class#
- class Layout(name=None, **kwargs)#
Bases:
object
Layout class creates layout object as child of ReportLayout object. Layout class initializer.
- Parameters:
name (str) – Layout name. Optional parameter.
- getPlaceholderInfo()#
Prints placeholder details of this layout
- property name#
Return layout name
- Returns:
Layout name
- Return type:
str
Location class#
- class Location(layout, **kwargs)#
Bases:
object
Location class creates placeholder object as child of layout.
- Parameters:
layout (Layout) – Layout object
session (ReportSession) – ReportSession object. Optional
- property height#
Returns height value
- Returns:
height value
- Return type:
int
- property name#
Return location name
- Returns:
Location name
- Return type:
str
- property position#
Return location dimension
- Returns:
x y width height
- Return type:
list
- property width#
Returns width value
- Returns:
width value
- Return type:
int
- property x#
Returns x value
- Returns:
x value
- Return type:
int
- property y#
Returns y value
- Returns:
y value
- Return type:
int
Presentation class#
- class Presentation(name=None, **kwargs)#
Bases:
CommonProperties
Presentation class creates new powerpoint presentation object in specified session. If ‘name’ value is None, creates new presentation with unique name. If ‘name’ value is not None and no entity of same name exists in specified report session, then new presentation gets created with given name. If ‘name’ value is not None and entity of same name exists in specified session, then error thrown.
- Parameters:
name (str) – Presentation name.
- exportPresentationReport(output_path)#
- savePDF(path=None, **kwargs)#
Save output PDF file.
- Parameters:
path (str) – Generated presentation file path. Optional parameter
kwargs (dict) – Valid keywords are range, open.
- savePPTX(path=None, **kwargs)#
Save output presentation file.
- Parameters:
path (str) – Resolution type. Possible values are HD, UHD, Desktop, Medium.
kwargs (dict) – Valid keywords are range, mode, path, open.
- setAttributes(**kwargs)#
Set multiple attributes
- Parameters:
kwargs (dict) – Valid keywords are name, resolution, template.
- size(aspect_ratio)#
Set aspect ratio for all slides
- Parameters:
aspect_ratio (str) – Slides aspect ratio
- property resolution#
Returns presentation resolution.
- Returns:
Possible values are ‘HD’, ‘UHD’, ‘Desktop’, ‘Medium’.
- Return type:
str
- property template#
Returns template used for powerpoint export.
- Returns:
Template filepath used for powerpoint export.
- Return type:
str
ReportManager class#
- class ReportManager(**kwargs)#
Bases:
object
ReportManager class can provide informations about all available report session and active report session
- getAllSessionNames()#
Returns list of all available report session names
- Returns:
All report session names
- Return type:
list
- property activeSession#
Returns name of currently active session name
- Returns:
Active report session names
- Return 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
- delete(object)#
Deletes entity from this session.
- Parameters:
object (Table | Text | Image | Presentation | Slide | SlideImage | SlideTable | SlideText | Chapter | Document) – Entity object to be deleted
- get(entity_type, entity_name)#
Find and returns entity based on entity type and name. If not found, returns None
- Parameters:
entity_type (Table | Text | Image | Presentation | Slide | SlideImage | SlideTable | SlideText | Chapter) – Entity class type
entity_name (str) – Name of entity to be found
- Returns:
Report entity object
- Return type:
Table | Text | Image | Presentation | Slide | SlideImage | SlideTable | SlideText | Chapter
- getLayouts(output_type=None)#
Return all Layout objects or layout names in this session.
- Parameters:
output_type (str | None) – Possible values are ‘name’, None
- Returns:
List of layout names or Layout objects
- Return type:
list
- reset()#
Delete all entities present in this report session
- property activePresentation#
Active presentation name of this report session
- Returns:
Active presentation
- Return type:
- property name#
Return report session name
- Returns:
Report session name
- Return type:
str
- property session#
Slide class#
- class Slide(name=None, presentation=None, **kwargs)#
Bases:
object
Slide class creates slide object as child of presentation. If ‘name’ value is None, creates new slide with unique name. If ‘name’ value is not None and no entity of same name exists in specified report session, then new slide gets created with given name. If ‘name’ value is not None and any entity of same name exists in specified session, then error thrown.
- Parameters:
name (str) – Slide name. Optional parameter.
presentation (Presentation) – Presentation object. Optional. If not specified, uses currently active report session name
- add(obj, name, position=None)#
Adds one Text/Image/Table as child of this slide
- Parameters:
obj (Text/Image/Table object) – Clone it as slide child
name (str) – Name of entity to be created. It should be unique name in this session
position (Location or list in [x, y, width, height] format or placeholder name.) – Optional. Position and dimension for ‘obj’
- applySlidePlaceholderList(index)#
Enables this slide to use placeholder information of slide available at ‘index’ in presentation.
- Parameters:
index (int) – Index of slide
- layout(value)#
Set layout for slide.
- Parameters:
value (str) – Layout name
- setAttributes(**kwargs)#
Set multiple attributes
- Parameters:
kwargs (dict) – Keyworded arguments. Valid keywords are name, titleText
- titlePosition(x, y, width, height)#
Set title position for slide title.
- Parameters:
x (int) – Title x position
y (int) – Title y position
width (int) – Title width position
height (int) – Title height position
- property name#
Returns slide name.
- Returns:
Slide name
- Return type:
str
- property presentation#
Returns presentation which owns this slide.
- Returns:
Presentation owning this slide
- Return type:
- property titleText#
Slide title content.
- Returns:
Slide title
- Return type:
str
SlideImage class#
- class SlideImage(**kwargs)#
Bases:
SlideLocation
SlideImage creates reference of already existing image (Parent of existing image is ReportPalette object)
This means, any property value changes made in palette image, gets reflected in SlideImage
If any changes need to be made to ‘SlideImage’, create copy of image and then update the changes. So that, original image remains unchanged
- Parameters:
- setAttributes(**kwargs)#
Set multiple attributes
- Parameters:
kwargs (dict) – Valid keywords are name, source, type, path, caption, position, x, y, width, height
Returns image caption
- Returns:
Image caption
- Return type:
str
- property name#
Returns Slide image name
- Returns:
Name
- Return type:
str
- property path#
Returns image file path
- Returns:
Image file path
- Return type:
str
- property session#
Returns interface of session in which this slideimage object is created
- Returns:
Report session
- Return type:
- property source#
Returns image source type
- Returns:
Possible values are ‘graphic’, ‘file’
- Return type:
str
- property type#
Returns image type
- Returns:
Possible values are ‘jpg’, ‘png’, ‘bmp’
- Return type:
str
SlideLocation class#
- class SlideLocation(**kwargs)#
Bases:
object
Base class for SlideImage, SlideText and SlideTable. SlideLocation class initializer
- setAttributes(key, value)#
Set multiple attributes
- Parameters:
kwargs (dict) – Valid keywords are position, x, y, width, height
- property height#
Returns height value
- Returns:
height value
- Return type:
int
- property position#
Returns x y width height in list format
- Returns:
Dimension
- Return type:
list
- property width#
Returns width value
- Returns:
width value
- Return type:
int
- property x#
Returns x value
- Returns:
x value
- Return type:
int
- property y#
Returns y value
- Returns:
y value
- Return type:
int
SlideTable class#
- class SlideTable(**kwargs)#
Bases:
SlideLocation
SlideTable creates reference of already existing table (Parent of existing table is ReportPalette object)
This means, any property value changes made in palette table, gets reflected in SlideTable
If any changes need to be made to ‘SlideTable’, copy of image gets created and then update the changes. So that, original table remains unchanged
- Parameters:
- setAttributes(**kwargs)#
Set multiple attributes
- Parameters:
kwargs (dict) – Valid keywords are name, csvFile, caption, split, splitBy, maxRows, maxColumns, position, x, y, width, height
Returns table caption
- Returns:
Table caption
- Return type:
str
- property csvFile#
Returns csv file path
- Returns:
Csv file path
- Return type:
str
- property maxColumns#
Returns maximum number of columns in table
- Returns:
Possible values : rows or columns
- Return type:
str
- property maxRows#
Returns maximum number of rows in table
- Returns:
Possible values : rows or columns
- Return type:
str
- property name#
Returns name of slide table
- Returns:
Name
- Return type:
str
- property session#
Returns report session to which this SlideTable belongs
- Returns:
Report session
- Return type:
- property split#
Returns split enabled or disabled
- Returns:
Possible values True or False
- Return type:
bool
- property splitBy#
Returns table splitted by rows or columns.
- Returns:
Possible values : rows or columns
- Return type:
str
SlideText class#
- class SlideText(**kwargs)#
Bases:
SlideLocation
SlideText creates reference of already existing text (Parent of existing text is ReportPalette object)
This means, any property value changes made in palette text, gets reflected in SlideText
If any changes need to be made to ‘SlideText’, copy of text gets created and then update the changes. So that, original text remains unchanged
- Parameters:
- setAttributes(**kwargs)#
Set multiple attributes
- Parameters:
kwargs (dict) – Valid keywords are name, text, position, x, y, width, height
- property name#
Returns name of SlideText
- Returns:
Name
- Return type:
str
- property session#
Returns session interface to which this SlideText belongs
- Returns:
Report session
- Return type:
- property text#
Returns text content
- Returns:
Text content
- Return type:
str
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, then new table gets created with given name. If ‘name’ value is not None and any entity of same name exists in specified session, then error thrown.
- Parameters:
name (str) – Table name.
session (ReportSession) – Session name. Optional. If not specified, uses currently active report session name
datafile (str) – csv file path. Optional
- addColumn()#
Add new column to table
- addToCells(cell)#
Add new table cell
- Parameters:
cell (int) – Cell Object
- cell(row_idx, col_idx)#
Get access to specific cell
- Parameters:
row_idx (int) – Row index
col_idx (int) – Column index
- Returns:
Table cell object
- Return type:
TableCell
- exportCsv(file: str) int #
Exports table content to file
- Parameters:
file (str) – Csv filepath
- getCellValue(row: int, col: int)#
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 #
Loads content of csv file to this table entity
- Parameters:
file (str) – Csv filepath
- mergeCells(cell1, cell2)#
Merge table cells
- Parameters:
cell1 (int) – Cell index
cell2 (int) – Cell index
- removeColumn(col: int)#
Remove column at specified index
- Parameters:
col (int) – Column index
- removeRow(row: int)#
Remove row at specified index
- Parameters:
row (int) – Row index
- setAttributes(**kwargs)#
Set multiple attributes.
- Parameters:
kwargs (dict) – Valid keywords are name, csvFile, caption, split, splitBy, maxRows, maxColumns, stretch
- setCellValue(row: int, col: int, value)#
Set cell value for at particular index
- Parameters:
row (int) – Row index
col (int) – Column index
- setColumnWidth(index: int, width: float)#
- setDT(dtsession_name: str, db_name: str, dtset_name: str)#
- setDimension(rows: int, cols: int)#
Set number of rows and columns for table
- Parameters:
rows (int) – Row count
cols (int) – Column count
- setRowHeight(index: int, height: float)#
Returns table caption
- Returns:
Table caption
- Return type:
str
- property columns#
Returns table column count
- Returns:
Column count
- Return type:
int
- property csvFile#
Returns csv file path
- Returns:
csv file path
- Return type:
str
- property ensureFit#
Return ensure fit enabled or disabled
- Returns:
Ensured fit enabled or disabled
- Return type:
bool
- property maxColumns#
Returns maximum number of columns in table
- Returns:
Maximum number of columns
- Return type:
int
- property maxRows#
Returns maximum number of rows in table
- Returns:
Maximum number of rows
- Return type:
int
- property rows#
Returns table row count
- Returns:
Row count
- Return type:
int
- property split#
Returns split enabled or disabled
- Returns:
Split enabled or disabled
- Return type:
bool
- property splitBy#
Returns table splitted by rows or columns
- Returns:
Possible values : rows or columns
- Return type:
str
- property stretch#
Returns true if table stretch is enabled, otherwise false
- Returns:
Table stretch enabled or not
- Return type:
bool
Text class#
- class Text(name=None, **kwargs)#
Bases:
CommonProperties
Text entity gets created. 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. Optional. If not specified, uses currently active report session name
text (str) – Text content. Optional
- addParagraph()#
Adds new paragraph
- Returns:
Paragraph entity
- Return type:
Paragraph
- getParagraph(index: int = 0)#
Return Paragraph present at ‘index’
- Parameters:
index (int) – Index of paragraph in text runs
- Returns:
Paragraph entity
- Return type:
Paragraph
- removeParagraph(index: int)#
Removes Paragraph present at ‘index’
- Parameters:
index (int) – Index of paragraph in text runs
- setAttributes(**kwargs)#
Set multiple attributes.
- Parameters:
kwargs (dict) – Valid keywords are name, text
- property ensureFit#
Return ensure fit enabled or disabled
- Returns:
Ensured fit enabled or disabled
- Return type:
bool
- property text#
Get default run text content
- Returns:
Default run text content
- Return type:
str