Rendering a Report from Code
Our sample projects and report templates can help you learn the basics of working with our products.A report can be rendered without a viewer, for example to process the result server-side. This example renders the report and inspects the output.
Code overview. Initialize the required report objects, render a report from code, and handle the resulting state or output.
Code overview. Initialize the required report objects, render a report from code, and handle the resulting state or output.
<script setup lang="ts">
import { Stimulsoft } from 'stimulsoft-reports-js-vuejs'
var report = new Stimulsoft.Report.StiReport();
report.loadFile("Reports/SimpleList.mrt");
async function renderReport() {
await report.renderAsync2();
document.getElementById("message").innerText = "The report rendering is completed. Pages: " + report.renderedPages.count;
document.getElementById("reportJson").innerText = report.saveDocumentToJsonString();
}
</script>
<template>
<div>
<button @click=renderReport>Render the Report</button>
<br /><br />
<div id="message"></div>
<pre id="reportJson"></pre>
</div>
</template>renderAsync2() builds the document pages; afterwards renderedPages.count and saveDocumentToJsonString() give access to the rendered result for saving or further processing.