-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathSetting the Variable Value from Code.html
41 lines (34 loc) · 1.25 KB
/
Setting the Variable Value from Code.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="shortcut icon" href="../favicon.ico" />
<title>Setting the Variable Value from Code</title>
<!-- Stimulsoft Reports.JS -->
<script src="../scripts/stimulsoft.reports.js" type="text/javascript"></script>
</head>
<body>
Setting the Variable Value from Code
<br><br><br>
<div id="reportContainer">Rendering...</div>
<script type="text/javascript">
// Create a new report instance
var report = new Stimulsoft.Report.StiReport();
// Load report
report.loadFile("../reports/ReportWithVariable.mrt");
// Get variable by name
var variable = report.dictionary.variables.getByName("Variable1");
// Set variable value
variable.value = "test";
// Render report
report.renderAsync(function () {
// Export report to HTML string
report.exportDocumentAsync(function (htmlString) {
// Show the report
var container = document.getElementById("reportContainer");
container.innerHTML = htmlString;
}, Stimulsoft.Report.StiExportFormat.Html);
});
</script>
</body>
</html>