Adding a Custom Function

You can extend the report engine with your own functions that authors call from expressions in the designer.

Adding a Font to the Resource

Fonts can be embedded into a report as resources so it renders identically everywhere. This example adds a TrueType font to the report dictionary.

Assigning a Report to the Viewer

The Reports.JS viewer displays a report entirely in the browser. This example creates a viewer, loads a report, and shows it.

Changing the Designer Theme

Embed the report designer in JavaScript, load a template, and connect its editing and save actions.

Changing the Viewer Theme

Set up the report viewer in JavaScript, load a template, and connect the component to the application.

Customizing the Designer

The designer interface can be trimmed down to just the features you want to expose. This example hides several toolbar items and component types.

Customizing the Viewer

The viewer exposes many options for appearance and toolbar contents. This example tunes the toolbar, colors, zoom and size.

Editing a Report Template in the Designer

Reports.JS includes a full report designer that runs in the browser. This example opens the designer with a template loaded for editing.

Exporting a Report to HTML

This example renders a report and exports it to HTML — either receiving the HTML string for display in the page, or saving it as a file.

Exporting a Report to PDF

Render the report in JavaScript and export it directly from code, without opening the viewer.

Loading Scripts in Part to Minify Project

Reports.JS is modular: instead of loading the whole library, you can include only the parts your page needs to keep the download small.

Loading the Report

The foundation of Reports.JS is the StiReport object: you create it, load a template, and render it in the browser.

Localization the Designer

The designer interface can be shown in different languages by adding localization files. This example adds several and selects one culture.

Merging Several Reports into One

Several rendered reports can be combined into a single document. This example renders two reports and appends their pages into one merged report.

Printing the Report

A report can be sent to the printer directly from code, without the viewer. This example renders a report and prints it as soon as it is ready.

Printing the Table from Code

A report can be built completely from code, including its data structure and layout, and then printed or shown.

Register JSON Data File and Synchronize Dictionary

A report with an empty data dictionary can be filled from a JSON file, building the data structure automatically.

Register JSON String and Synchronize Dictionary

Data can also be registered from a JSON string you have already fetched, for example from a REST API.

Registering a Fonts Folder

Register the required resource in JavaScript so the report renders consistently in every environment.

Registering a JSON Data for the Report Template

Prepare the data in JavaScript, register it in the report dictionary, and render the template with those records.

Registering an XML Data for the Report Template

Prepare the data in JavaScript, register it in the report dictionary, and render the template with those records.

Saving the Rendered Report to a File

A rendered report can be saved as a document file (.mdc) so it can be reloaded later without re-rendering.

Setting the Variable Value from Code

Report variables can be assigned from code before rendering — for values that come from the application rather than the data.

Showing a Report as PDF

Instead of downloading, an exported PDF can be shown inline in the browser. This example renders a report and produces a PDF blob for display.

Showing the Designer Immediately after Running an App

Embed the report designer in JavaScript, load a template, and connect its editing and save actions.

Showing the Designer in a Required Position

The designer can be placed into any element on your page rather than filling the window, so it fits into an existing layout.

Showing the Designer in iframe

Embed the report designer in JavaScript, load a template, and connect its editing and save actions.

Showing the Report Viewer in a Required Position

The viewer can be rendered into any element on the page so it fits your layout. This example draws it into a specific container.

Showing the Viewer Immediately after Running an App

Set up the report viewer in JavaScript, load a template, and connect the component to the application.

Showing the Viewer in iframe

The viewer can be hosted inside an iframe to keep its scripts and styles separate from the host page. This example loads a viewer page into an iframe.

Supply Custom Headers for Json Database

When a report loads data from a protected JSON endpoint, you may need to send authentication headers.

Using a Custom Data Adapter

For a data source Reports.JS does not support natively, you can register a custom database that answers the engine's data commands yourself.

Using CDNs for Script Loading

The Reports.JS scripts can be loaded from a CDN instead of being hosted with your application, which speeds up delivery and simplifies updates.

Using Designer Events

The designer raises events for the actions users perform — creating, previewing, saving and exiting a report.

Using the Full-Screen Mode in the Designer

Full-screen mode makes the designer occupy the whole browser window, which is the natural layout for a dedicated report-editing application.

Using the Full-Screen Mode in the Viewer

Set up the report viewer in JavaScript, load a template, and connect the component to the application.

Using the Same Label for Multiple Fonts

Register the required resource in JavaScript so the report renders consistently in every environment.

Using Viewer Events

The viewer raises events for data loading, printing, exporting and switching to the designer.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.