javascript - 崩溃的 Stimulsoft 报告查看器
问题描述
我在 Angular 5 项目中使用 Stimulsoft,首先我创建了一个按钮(在 bootstrap tabs 内),然后单击它会触发一个生成报告的函数
和按钮html代码:
<ngb-tab>
<ng-template ngbTabTitle ><b>Report</b></ng-template>
<ng-template ngbTabContent>
<button (click)="generateReport()" class="btn m-btn btn-danger"
id="generateReport">
<span>
<i class="la la-eye"></i>
<span> Generate Report</span>
</span>
</button>
<div id="Report"></div>
</ng-template>
</ngb-tab>
以及点击(生成报告)触发的功能:
generateReport() {
this.ExportImageForReport();
let sol = this.solution;
setTimeout(() => {
let HS = this.body.hotStreams.map(a => { let obj = { Name: a.name,
Supply: a.Supply, Target: a.Target, Duty: Math.round((a.Duty
/ 1000000) * 10) / 10 }; return obj });
let CS = this.body.coldStreams.map(a => { let obj = { Name: a.name,
Supply: a.Supply, Target: a.Target, Duty: Math.round((a.Duty
/ 1000000) * 10) / 10 }; return obj });
let Solution = {
Results: {
IntervalTemp: sol.IntervalTemp,
HotInterval: sol.HotIntervalTemp,
ColdInterval: sol.ColdIntervalTemp,
HotDuty: Math.round((sol.Qhot / 1000000) * 10) / 10,
ColdDuty: Math.round((sol.Qcold / 1000000) * 10) / 10,
},
Units: {
temperature: this.Units.temperature,
duty: this.Units.duty
},
HotStreams: HS,
ColdStreams: CS,
Diagrams: {
HT_Diagram: this.HT_img,
GCC_Diagram: this.GCC_img,
Grid_Diagram: this.Grid_img,
},
UserData: {
username:this.username,
email:this.email
}
}
fileName = "ByStreamReport"
let report = new Stimulsoft.Report.StiReport();
report.loadFile("./assets/stimulsoft/name.mrt");
let dataSet = new Stimulsoft.System.Data.DataSet("Solution");
dataSet.readJson(Solution);
report.regData("Solution", "Solution", dataSet);
let options = new Stimulsoft.Viewer.StiViewerOptions;
let viewer = new Stimulsoft.Viewer.StiViewer(options);
viewer.report = report;
viewer.renderHtml("Report");
},6000)
}
之后,报表查看器在一个新的浏览器选项卡中打开,而不是像它应该的那样在引导选项卡内,并且浏览器崩溃,如下图所示,两个菜单出现在顶部和按钮上,当我将报告导出为 pdf,一切都很好,所有数据都在原位,
我想要的是在(生成报告)下方加载报告查看器,就像它在 html 代码中的位置一样。
如果您看到我的帖子缺少信息,请告诉我,我会立即对其进行编辑。
解决方案
推荐阅读
- cors - 在 Google Forms 文档上配置/修改 CORS
- javascript - textarea.selectionEnd 总是等于 textarea.value 中的最后一个字符
- c# - 尽管我在 android 上使用“HasKey”和 Save(),为什么 PlayerPrefs 不起作用?
- marklogic - ML 是否应该能够访问映射到驱动器号的 Windows 共享驱动器上的文件?
- amazon-web-services - 部署到 AWS S3 与 github 同步
- jquery - 安装 angular-slickgrid 后“JQuery 未定义”抛出错误
- kubernetes - Kubernetes 部署:错误:未能创建部署:
- keras - 如何在 Keras 中为图层设置二进制权重值 (0,1) 或 (-1,1)?
- javascript - 如何为用户构建高兼容性的 Typescript 库?
- delphi - 使用主题设置更改 DBGrid 中列标题的颜色