Usage
npm i @icreate/ics-chromely-plugin-report-js-sdk
Features
0.0.8-beta.1 增加导出pdf流示例
0.0.8 增加导出pdf流支持
0.0.7 修复打印和准备打印方法调用不传打印机名称时使用默认打印机
0.0.6 修改print和printPrepared的printerName允许为空
0.0.5 增加打印准备报表printPrepared
0.0.4 增加预览准备报表showPrepared
0.0.3 将注册数据源数据转为为json字符串
Importing library
You can import the generated bundle to use the whole library generated by this starter:
import ReportHelper from '@icreate/ics-chromely-plugin-report-js-sdk'
ReportHelper
load(fileName: string): Promise<any>
loadFromId(reportId: string): Promise<any>
clearData(): Promise<any>
registerData(name: string, data: Array<any>): Promise<any>
doublePass(value: Boolean): Promise<any>
prepare(append: Boolean): Promise<any>
addParameter(name: string, value: string): Promise<any>
design(): Promise<any>
show(): Promise<any>
showPrepared(): Promise<any>
print(printerName?: string): Promise<any>
printPrepared(printerName?: string): Promise<any>
ExportToPdf(fileName: string): Promise<any>
exportToHtml(fileName: string): Promise<any>
dispose(): Promise<any>
一般设计打印示例
const reportHelper = new ReportHelper()
await reportHelper.clearData()
await reportHelper.load('xxxx.frx')
await reportHelper.registerData('患者基本信息',[{ id:"1",name:"张三"}])
await reportHelper.design()
await reportHelper.show()
await reportHelper.print()
合并打印示例
const reportHelper = new ReportHelper()
await reportHelper.clearData()
await reportHelper.load('xxxx.frx')
await reportHelper.registerData('患者基本信息',[{ id:"1",name:"张三"}])
await reportHelper.prepare(false)
await reportHelper.clearData()
await reportHelper.load('xxxx.frx')
await reportHelper.registerData('患者基本信息',[{ id:"1",name:"李四"}])
await reportHelper.prepare(true)
await reportHelper.showPrepared()
await reportHelper.printPrepared()
导出pdf流示例
const reportHelper = new ReportHelper()
await reportHelper.clearData()
await reportHelper.load('xxxx.frx')
await reportHelper.registerData('患者基本信息', [
{ id: '1', name: '张三' }
])
await reportHelper.prepare(true)
const blob = await reportHelper.ExportToPdf()
const source = await blob.arrayBuffer()
console.log(source, 'arrayBuffer')
const source = URL.createObjectURL(blob)
console.log(source, 'url')