| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- export const fileTypes = {
- "image/gif": "image",
- "image/jpeg": "image",
- "image/jpg": "image",
- "image/png": "image",
- "video/mp4": "video",
- "video/avi": "video",
- "application/vnd.ms-excel": "excel.xls",
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "excel.xlsx",
- "application/pdf": "pdf",
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
- "text/plain": "txt"
- }
- export const officeOptions = {
- excel: {
- xls: false, // 预览xlsx文件设为false;预览xls文件设为true
- minColLength: 0, // excel最少渲染多少列,如果想实现xlsx文件内容有几列,就渲染几列,可以将此值设置为0.
- minRowLength: 0, // excel最少渲染多少行,如果想实现根据xlsx实际函数渲染,可以将此值设置为0.
- widthOffset: 10, // 如果渲染出来的结果感觉单元格宽度不够,可以在默认渲染的列表宽度上再加 Npx宽
- heightOffset: 10, // 在默认渲染的列表高度上再加 Npx高
- beforeTransformData: workbookData => workbookData, // 底层通过exceljs获取excel文件内容,通过该钩子函数,可以对获取的excel文件内容进行修改,比如某个单元格的数据显示不正确,可以在此自行修改每个单元格的value值。
- transformData: workbookData => workbookData // 将获取到的excel数据进行处理之后且渲染到页面之前,可通过transformData对即将渲染的数据及样式进行修改,此时每个单元格的text值就是即将渲染到页面上的内容
- },
- pdf: {
- // width: 500, //number,可不传,用来控制pdf预览的宽度,默认根据文档实际宽度计算
- httpHeaders: {}, //object, Basic authentication headers
- password: "" //string, 加密pdf的密码
- },
- docx: {
- className: "docx", //class name/prefix for default and document style classes
- inWrapper: true, //enables rendering of wrapper around document content
- ignoreWidth: false, //disables rendering width of page
- ignoreHeight: false, //disables rendering height of page
- ignoreFonts: false, //disables fonts rendering
- breakPages: true, //enables page breaking on page breaks
- ignoreLastRenderedPageBreak: false, //disables page breaking on lastRenderedPageBreak elements
- experimental: false, //enables experimental features (tab stops calculation)
- trimXmlDeclaration: true, //if true, xml declaration will be removed from xml documents before parsing
- useBase64URL: false, //if true, images, fonts, etc. will be converted to base 64 URL, otherwise URL.createObjectURL is used
- useMathMLPolyfill: false, //includes MathML polyfills for chrome, edge, etc.
- showChanges: false, //enables experimental rendering of document changes (inserions/deletions)
- debug: false //enables additional logging
- }
- }
|