|setModified(modified)||Sets the internal modified flag. If true the save button is enabled, otherwise the save button is disabled.|
|getReport()||Returns an object containing the whole report, including report elements, parameters, styles and document properties. This object is used to generate reports in the report-lib package. Use this method to save designed reports on your server.|
|save()||Called when pressing the save button in the ReportBro Designer menu bar. Executes a callback initialized as saveCallback (see configuration options) or saves the report in local storage if localStorageReportKey property is defined. The method needs either saveCallback or localStorageReportKey.|
Takes a report object as parameter and loads it into the ReportBro Designer. The report object
can be obtained with the getReport method.
The usual process is to save a designed report in your web application using getReport and uploading it to your server. Later you retrieve the report from your application and use the load method to initialize the ReportBro Designer with it.
|loadLocalReport()||Loads a report from local storage. The report is retrieved from local storage with the key defined in localStorageReportKey (see configuration options).|
|preview()||Uses the current report and test data to make a request to the report server (using reportServerUrl) to get a report document. PDF documents are displayed in the preview tab within ReportBro Designer.|
|previewWithData(data)||Similar to preview but uses the given data instead of test data. This can be useful in case you want to test a report with real data (usually retrieved by an ajax call from your server in advance). In case there are any errors during report creation the errors are directly displayed in ReportBro Designer.|
|downloadSpreadsheet()||Downloads the xlsx report (using reportDownloadUrl) in a separate tab. It uses the report previously created for preview (with preview or previewWithData method). This is a workaround to preview xlsx reports in ReportBro Designer. Because there is no embedded preview the report must be opened in a separate tab. Since the url cannot contain any post parameters the last previewed report, which is saved server-side and identified by a key, is downloaded.|
To generate reports server-side you have to create an instance of reportbro.Report which takes the following arguments:
|report_definition||The report object containg report elements, parameters, styles and document properties. This object can be obtained in ReportBro Designer by using getReport method.||
|data||Dictionary containing all data for the report. This structure must correspond with
the defined parameters. E.g. if the report contains a list or a date parameter then data must
also contain a list or date parameter with the same name.
For parameters of type image the data has to be provided as base64 encoded in format of "data:image/<image type>;base64,<encoded image data>".
|is_test_data||set to True in case the given data contains test data which is specified within the parameters in ReportBro Designer. Set to False if the data comes from your web application. This setting influences the error messages in case report generation fails due to invalid data.||
|additional_fonts||In case additional (non-standard) fonts are used they must be made available
for reportbro-lib so they can be embedded into the pdf file. This argument is a list of dicts
value: used to identify the font
filename: filename including relative or absolute (preferred) path to .ttf file. The filename has to match the configured value of fonts in reportbro-designer. See the options documentation on how to configure additional fonts in ReportBro Designer.
bold_filename: filename for bold font. If not specified the regular font will be used for bold text.
italic_filename: filename for italic font. If not specified the regular font will be used for italic text.
bold_italic_filename: filename for bold italic font. If not specified the regular font will be used for bold italic text.
uni: TTF Unicode flag, if set to True (default), TrueType font subset embedding will be enabled and text will be treated as utf8 by default.
|generate_pdf(filename='', add_watermark=False)||Generates a pdf report and returns it as a byte string (unless a filename is given). If add_watermark is set to True a watermark image (ReportBro logo) will be displayed on the bottom of each page. If filename is specified the report will be saved to disk under the given filename and no report will be returned by the method.|
|generate_xlsx(filename='')||Generates a xlsx spreadsheet and returns it as a byte string (unless a filename is given). If filename is specified the spreadsheet will be saved to disk under the given filename and no spreadsheet will be returned by the method.|