Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rapid-spreadjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
1、组件介绍
该组件是基于葡萄城的 SpreadJS封装的公用处理函数组件。
该组件主要包含了对设计器的操作、工作簿的操作以及工作表的操作等。
SpreadJS 官网地址:https://www.grapecity.com.cn/developer/spreadjs
SpreadJS 帮助中心:https://www.grapecity.com.cn/developer/spreadjs/help
SpreadJS 文档地址:https://demo.grapecity.com.cn/spreadjs/help/docs/overview
SpreadJS 演示地址:https://demo.grapecity.com.cn/spreadjs/SpreadJSTutorial/#/samples
SpreadJS 论坛地址:https://gcdn.grapecity.com.cn/
SpreadJS 在线地址:https://demo.grapecity.com.cn/SpreadJS/WebDesigner/index.html
SpreadJS API 地址:https://demo.grapecity.com.cn/spreadjs/help/docs/API_documentation
2、依赖组件
具体依赖组件如下所示:
- file-saver:导出 Excel 文件所需的组件;
- @types/file-saver:导出 Excel 文件所需的类型组件;
3、拉取组件
可使用如下命令拉取组件:
- pnpm install rapid-spreadjs
- npm i rapid-spreadjs
- yarn add rapid-spreadjs
4、使用说明
在组件拉取下来后,我们便可使用该组件中的属性以及函数方法了。
该组件包含的类型如下:
- CellModel:单元格实体;
- ……
该组件包含的属性如下:
- CommonUtils:公用工具函数属性;
- SheetUtils:SpreadJS 工作表工具函数属性;
- WorkbookUtils:SpreadJS 工作簿工具函数属性;
- ……
该组件包含的函数如下:
- ……
4.1、类型说明
4.1.1、CellModel
CellModel 为单元格实体类型,如用于定义某个单元格的行、列、行数量和列数量等相关属性。
具体属性如下所示:
/**
* 单元格实体
*/
export type CellModel = {
/** 行索引 */
row?: number;
/** 列索引 */
col?: number;
/** 行数量 */
rowCount?: number;
/** 列数量 */
colCount?: number;
};
4.2、属性说明
4.2.1、CommonUtils
CommonUtils 为公用工具函数属性,该属性下包含以下函数:
- getColLetterName:获取列的英文字母;
4.2.2、SheetUtils
SheetUtils 为 SpreadJS 工作表工具函数属性,该属性下包含以下函数:
- getActiveSheetSelectCells:获取当前活动工作表选中的单元格集合;
- setActiveSheetSelectCells:设置当前活动工作表某个单元格范围为选中状态;
- getAllCellObjsByRanges:获取某工作表中某范围集合中所有的单元格坐标对象集合;
- getSheetAllCellObjs:获取某工作表中所有的单元格坐标对象集合;
- getActiveSheetSelectCellObjs:获取某工作表中选中的所有单元格坐标对象集合;
- getCellType:获取单元格类型名称;
- setSheetZoom:设置工作簿中所有工作表的缩放比例;
- setActiveSheetBgColor:设置当前激活的工作表中选中的单元格背景颜色;
- setSheetShowPrintPageLine:设置工作簿中所有工作表是否显示分页线;
- ignoreSheetShowStrs:忽略工作工作表元格中指定字符串不显示,如:#DIV/0!、#VALUE!等;
- setSheetAuxiliaryLine:设置工作表显示辅助线(底部和右侧的辅助线);
- ……
4.2.3、WorkbookUtils
WorkbookUtils 为 SpreadJS 工作簿工具函数属性,该属性下包含以下函数:
- print:打印所有工作表;
- exportToExcel:导出为 Excel 文件;
- ……