Follow

Showing your data on HTML page

Yes, you can show your data on the page with next code:

JavaScript
// Create a new report instance
var report = new Stimulsoft.Report.StiReport();
// Load report from url
report.load(reportString);
// Create new DataSet object
var dataSet = new Stimulsoft.System.Data.DataSet("Demo");
// Load JSON data to the DataSet object
dataSet.readJson(jsonString);
//or you could read data from XML with next method
dataSet.readXml(jsonString);
// Register DataSet object
report.regData("Demo", "Demo", dataSet);
// Render report with registered data
report.render();
// Create an HTML settings instance. You can change export settings.
var settings = new Stimulsoft.Report.Export.StiHtmlExportSettings();
// Create an HTML service instance.
var service = new Stimulsoft.Report.Export.StiHtmlExportService();
// Create a text writer objects.
var textWriter = new System.IO.TextWriter();
var htmlTextWriter = new Stimulsoft.Report.Export.StiHtmlTextWriter(textWriter);
// Export HTML using text writer.
service.exportTo(report, htmlTextWriter, settings);
// Write HTML to DIV element.
var container = document.getElementById("htmlContainer");
container.innerHTML = textWriter.getStringBuilder().toString();

Also you could assign report to viewer or export to any available format.

0 Comments

Please sign in to leave a comment.