This example shows how to save the rendered report document in the JSON file. First, you need to create the report object of the StiReport type, then load the report template file by calling the loadFile() method. After this you should render the report by calling the renderAsync() method of the report object:
// Create a new report instance
var report = new Stimulsoft.Report.StiReport();
// Load report from url
report.loadFile("../reports/SimpleList.mrt");
// Render report
report.renderAsync(function () {
	document.getElementById("saveDocument").disabled = false;
});

For saving the rendered report in the JSON format to the file you need to use the saveDocumentToJsonString() method of the report object. This method returns JSON string result which you can save to the file using the StiObject.saveAs() method. This method was added in the Stimulsoft library, you can use it:
<button id="saveDocument" onclick="saveReportDocument()" disabled>Save rendered report</button>
function saveReportDocument() {
	// Save rendered report to JSON string
	var json = report.saveDocumentToJsonString();
	// Get report file name
	var fileName = report.reportAlias;
	// Save data to file
	Stimulsoft.System.StiObject.saveAs(json, fileName + ".mdc", "application/json;charset=utf-8");
}

In the screenshot below you can see the result of the sample code:

Saving the Rendered Report to a File

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.