Loading a Report and Rendering it with a JSON Data
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.On Node.js the Stimulsoft engine runs server-side through the stimulsoft-reports-js package.
Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
var Stimulsoft = require('stimulsoft-reports-js');
var report = new Stimulsoft.Report.StiReport();
report.loadFile("SimpleList.mrt");
var dataSet = new Stimulsoft.System.Data.DataSet("Demo");
dataSet.readJsonFile("Demo.json");
report.dictionary.databases.clear();
report.regData("Demo", "Demo", dataSet);
report.renderAsync(function () {
console.log("Pages count: ", report.renderedPages.count);
report.saveDocumentFile("SimpleList.mdc");
});The same StiReport API used in the browser works under Node.js after require('stimulsoft-reports-js'). A DataSet reads the JSON, regData registers it, and the rendered document is saved to an .mdc file.