Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@icreate/ics-chromely-plugin-report-js-sdk

Package Overview
Dependencies
Maintainers
8
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@icreate/ics-chromely-plugin-report-js-sdk

提供报表设计、清空、预览、打印、注册数据源等功能

  • 0.0.9
  • npm
  • Socket score

Version published
Maintainers
8
Created
Source

Usage

npm i @icreate/ics-chromely-plugin-report-js-sdk

Features

0.0.9 优化和完善导出pdf流
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字符串
  • ReportHelper:报表

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> 
  // 根据Id加载报表
   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>
  //  导出pdf:文件名称,如果不传则返回流
   ExportToPdf(fileName: string): Promise<any> 
  //  导出html
   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()
  //加载报表1
  await reportHelper.clearData()
  await reportHelper.load('xxxx.frx')
  await reportHelper.registerData('患者基本信息',[{ id:"1",name:"张三"}])
  await reportHelper.prepare(false)
  //加载报表2
  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() // 设计报表
  //直接使用blob展示[vue-pdf-embed](https://github.com/hrynko/vue-pdf-embed)  
  const source = await blob.arrayBuffer()
  console.log(source, 'arrayBuffer')
  //生成pdf内存url
  const source = URL.createObjectURL(blob)
  console.log(source, 'url')

FAQs

Package last updated on 13 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc