Python and Javascript version
Function Overview
Name | Restriction | Return type | Parameters |
---|---|---|---|
Report | Object | orientation, unit, format | |
loadDefinition | Boolean | xml | |
loadJsonDefinition | Javascript |
Boolean | data |
setData | Boolean | key, value | |
createReport | Boolean | ||
save2Html | Python |
HTML | details |
save2Pdf | |||
save2PdfFile | filename | ||
save2DataUrl | Javascript |
||
save2Xml | XML | ||
getXmlTemplate | Javascript |
XML | |
insertElement | Object | parent, ename, index, values | |
editElement | Boolean | element, values | |
deleteElement | Boolean | element, parent |
Object Overview
Name | Properties |
---|---|
report | orientation, unit, format, template, images_folder, decode, encode |
template | document, style, margins, elements |
row | height, hgap, visible, columns |
cell | name, value, width, border, align, multiline, link, font-family, font-style, font-size, color, border-color, background-color |
image | src, file, link, width, height, compression |
barcode | code-type, value, visible-value, wide, narrow |
separator | gap |
vgap | height |
hline | width, gap |
html | |
datagrid | width, name, databind, merge, border, color, border-color, background-color, header-color, footer-color, font-size, columns |
column | fieldname, width, label, align, thousands, digit, footer, header-align, footer-align |
Function Details
Report(orientation::String='P', unit::String='mm', format::String='A4')::Object |
Class constructor. The result value is an report object. |
loadDefinition(xml::String)::Boolean |
Load to the report an XML definition. True if the load successfully. |
loadJsonDefinition(data::String/Object)::Boolean |
Load to the report an JSON definition. True if the load successfully. Only Javascript! |
setData(key::String, value::String/Object/List)::Boolean |
Set the template data. key: dictonary/object keyvalue:
True if the load successfully. |
createReport::Boolean |
The report template processing, databind replacement. True if the load successfully. |
save2Html(details::Boolean)::HTML |
Show an HTML Preview. HTML string Only Python! |
save2Pdf::PDF |
Create a PDF output. PDF file |
save2PdfFile(filename::String)::PDF |
Save to the PDF file. PDF file |
save2DataUrl::PDF |
Create a PDF data to the new browser window. PDF file Only Javascript! |
save2Xml::XML |
Create an XML output. Only the values of cells and datagrid rows from header and details. The node name of the cell name (except when name="label"), or datagrid name/column fieldname. XML file |
getXmlTemplate::XML |
Create the current XML template (without data).Create the current XML template (without data). XML file Only Javascript! |
insertElement(parent::Object, ename::String='row', index::Integer=-1, values::Object={})::Object |
Inserts an element in the template. The result value is an element object. Examples: |
editElement(element::Object, values::Object={})::Boolean |
Edit an item from the template. True if the successfully. |
deleteElement(element::Object, parent::Object=None)::Boolean |
Delete an item from the template. True if the successfully. |
Object Properties
report{orientation::String='P', unit::String='mm', format::String='A4', template::Object, images_folder::String=None, decode::String='utf-8', encode::String='latin_1'} |
orientation:
'P','portrait','L','landscape'
unit: 'pt','mm','cm','in' format: 'A3','A4','A5','letter','legal' template images_folder: Deprecated! Only Python! decode, encode: only PDF output, default value 'utf-8' and 'latin_1' Only Python! |
template{document::Object, style::Object, margins::Object, elements::Object} |
document:
|
row{height::Float=None, hgap::Integer=0, visible::String=None, columns::List=[]} |
cell{name::String='head', value::String='', width::String='0', border::String='0', align::String='left', multiline::String='false', link::String=None, font-family::String='times', font-style::String='', font-size::Integer=12, color::String=0, border-color::Integer=0, background-color::Integer=255} |
name: XML output node name
(only details section, default 'head' and except when name='label')
value: static text or databind value width border: 0(no border, default) and 1(frame) or some or all of the following characters: L(left); T(top); R(right); B(bottom) align: left (default value); right; center; justify (Only multiline and Python!) multiline: if 'true', print text with line breaks (default 'false') link: URL Only Python! font-family: 'times' (default), 'helvetica', 'courier' font-style: '' (default), 'bold', 'italic', 'bolditalic' font-size: 12 (default) color: value in hexadecimal (example: #A0522D) or in decimal (example: 10506797) border-color, background-color gray color (in range from 0 to 255) |
image{src::String=None, file::String=None, link::String=None, width::String=None, height::Float=None, compression::String='medium'} |
src: an inlined image (jpg/png), encoded in base64 (or a valid databind key)
file: path or URL of the image Only Python! link: URL Only Python! width height Only Javascript! compression: 'fast', 'medium', 'slow' Only Javascript! |
barcode{code-type::String='code39', value::String='', visible-value::Integer=0, wide::Float=None, narrow::Float=None} |
code-type: 'i2of5' (Interleaved 2of5) or 'code39' (Code 39)
value: barcode text visible-value: 1 (show barcode text) or 0 (default) wide, narrow: optional |
separator{gap::Integer=0} |
Vertical separator line.
gap: greater than 0 = double line |
vgap{height::Float=None} |
Vertical gap.
height |
hline{width::String='100%', gap::Integer=0} |
Horizontal line.
width: if missing or 0, then extends up to the right margin gap: greater than 0 = double line |
html |
Basic HTML elements rendering. Experimental!
|
datagrid{width::String='100%', name::String='items', databind::String, merge::Integer=0, border::Integer=1, color::String='0', border-color::Integer=0, background-color::Integer=255, header-color::Integer=None, footer-color::Integer=None, font-size::Integer=12, columns::List=[]} |
Create a table from python/javascript list (dictonary/object items).
width name: XML output node name (only details section) databind: table data source name merge: 1(all fields will be displayed in a single column) or 0(default) border: 0(no border) or 1(frame, default) color: value in hexadecimal (example: #A0522D) or in decimal (example: 10506797) border-color, background-color, header-background, footer-background gray color (in range from 0 to 255) font-size columns: column |
column{fieldname::String, width::String=None, label::String=None, align::String='left', thousands::String=None, digit::Integer=None, footer::String=None, header-align::String='left', footer-align::String='left'} |
fieldname: dictonary key (special value: counter)
width: value in percent label: column caption align, header-align, footer-align: left (default value); right; center; justify (Python!) thousands: character, only number format digit: number, only number format footer: static text or databind value |