styled-exceljs 0.21.0 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +19 -2
- package/bower.json +1 -1
- package/dist/xlsx.core.min.js +18 -18
- package/dist/xlsx.core.min.map +1 -1
- package/dist/xlsx.extendscript.js +249 -23
- package/dist/xlsx.full.min.js +17 -17
- package/dist/xlsx.full.min.map +1 -1
- package/dist/xlsx.mini.min.js +10 -10
- package/dist/xlsx.mini.min.map +1 -1
- package/docs/visual-fidelity.md +42 -2
- package/docs/visual-fidelity.zh-CN.md +38 -1
- package/package.json +2 -2
- package/types/index.d.ts +53 -0
- package/xlsx.js +249 -23
- package/xlsx.mjs +249 -23
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,35 @@ changes may not be included if they are not expected to break existing code.
|
|
|
9
9
|
* Proper handling of XLSX encoded entities (h/t @inreoh)
|
|
10
10
|
* Proper handling of invalid DIF sheets that match heuristics (h/t @lowkeyfish)
|
|
11
11
|
|
|
12
|
+
## v0.21.2
|
|
13
|
+
|
|
14
|
+
* Preserve TIFF drawing MIME metadata for XLSX images so browser renderers can
|
|
15
|
+
select an explicit decoder instead of receiving `application/octet-stream`
|
|
16
|
+
* Keep workbook column-width measurement stable across sheets and tolerate
|
|
17
|
+
missing Numbers format tables
|
|
18
|
+
|
|
19
|
+
中文摘要:
|
|
20
|
+
|
|
21
|
+
* XLSX 中的 TIFF 图片现在会保留 `image/tiff` 类型,便于浏览器渲染器按需解码
|
|
22
|
+
* 稳定多工作表列宽测量,并容错缺失的 Numbers 格式表
|
|
23
|
+
|
|
24
|
+
## v0.21.1
|
|
25
|
+
|
|
26
|
+
* Added browser-aware text measurement and `XLSX.utils.auto_fit_columns` for
|
|
27
|
+
best-fit column widths with wrap, overflow, shrink-to-fit, and merge support
|
|
28
|
+
* `sheet_to_html` visual mode now supports `autoFit`, `overflow`, fixed-layout
|
|
29
|
+
`<colgroup>` output, and Canvas-backed shrink-to-fit sizing
|
|
30
|
+
* Updated TypeScript definitions, English documentation, Chinese documentation,
|
|
31
|
+
and unit tests for the auto-fit rendering path
|
|
32
|
+
|
|
33
|
+
中文摘要:
|
|
34
|
+
|
|
35
|
+
* 新增浏览器文字测量和 `XLSX.utils.auto_fit_columns`,可结合换行、溢出、
|
|
36
|
+
收缩适应和合并跨度计算最优列宽
|
|
37
|
+
* `sheet_to_html` 视觉模式支持 `autoFit`、`overflow`、固定布局 `<colgroup>`
|
|
38
|
+
和基于 Canvas 测量的收缩适应字号
|
|
39
|
+
* 更新 TypeScript 类型、英文文档、中文文档和自动列宽单元测试
|
|
40
|
+
|
|
12
41
|
## v0.21.0
|
|
13
42
|
|
|
14
43
|
* XLSX style parsing resolves fonts, fills, borders, alignment, protection,
|
package/README.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# [SheetJS](https://sheetjs.com)
|
|
2
2
|
|
|
3
|
+
## Fork Notice
|
|
4
|
+
|
|
5
|
+
`styled-exceljs` is a fork of the original SheetJS Community Edition source
|
|
6
|
+
code. This fork keeps the SheetJS-compatible workbook and worksheet model, then
|
|
7
|
+
adds browser-oriented visual fidelity extensions for styles, dimensions,
|
|
8
|
+
drawings, charts, merge validation, and HTML rendering.
|
|
9
|
+
|
|
10
|
+
中文说明:`styled-exceljs` 基于 SheetJS Community Edition 原始代码 fork
|
|
11
|
+
并继续增强,保持 SheetJS 兼容的数据模型,同时扩展样式、行列尺寸、图片绘图、
|
|
12
|
+
图表、合并校验和浏览器 HTML 渲染能力。
|
|
13
|
+
|
|
3
14
|
The SheetJS Community Edition offers battle-tested open-source solutions for
|
|
4
15
|
extracting useful data from almost any complex spreadsheet and generating new
|
|
5
16
|
spreadsheets that will work with legacy and modern software alike.
|
|
@@ -45,6 +56,7 @@ const ws = wb.Sheets[wb.SheetNames[0]];
|
|
|
45
56
|
const html = XLSX.utils.sheet_to_html(ws, {
|
|
46
57
|
cellStyles: true,
|
|
47
58
|
browserPixels: true,
|
|
59
|
+
autoFit: true,
|
|
48
60
|
charts: true,
|
|
49
61
|
drawings: true
|
|
50
62
|
});
|
|
@@ -60,6 +72,8 @@ The following public worksheet fields are populated when requested:
|
|
|
60
72
|
- `ws["!drawings"]`: parsed images, shapes, anchors, raw fallback records.
|
|
61
73
|
- `ws["!charts"]` and chartsheet `ws["!chart"]`: normalized chart models used
|
|
62
74
|
by HTML SVG rendering.
|
|
75
|
+
- `XLSX.utils.auto_fit_columns(ws, opts)`: browser-measured best-fit column
|
|
76
|
+
widths with wrap, overflow, shrink-to-fit, and merge-span handling.
|
|
63
77
|
|
|
64
78
|
`XLSX.utils.validate_merges(ws, opts)` validates merge ranges and reports
|
|
65
79
|
duplicate, overlapping, invalid, or out-of-bounds ranges. Passing
|
|
@@ -78,8 +92,9 @@ npm install styled-exceljs
|
|
|
78
92
|
|
|
79
93
|
这个版本面向浏览器预览和报表渲染扩展了 XLSX / XLS 的视觉读取能力。
|
|
80
94
|
默认读取路径仍然保持轻量和兼容;只有显式开启 `cellStyles`、
|
|
81
|
-
`browserPixels`、`charts`、`drawings` 和 `validateMerges`
|
|
82
|
-
|
|
95
|
+
`browserPixels`、`autoFit`、`charts`、`drawings` 和 `validateMerges` 等选项时,
|
|
96
|
+
才会解析完整样式、浏览器像素尺寸、自动列宽、图片、绘图、图表和合并单元格
|
|
97
|
+
校验结果。
|
|
83
98
|
|
|
84
99
|
常用入口如下:
|
|
85
100
|
|
|
@@ -88,6 +103,8 @@ npm install styled-exceljs
|
|
|
88
103
|
- `ws["!drawings"]`:图片、形状、锚点和复杂绘图的 raw fallback。
|
|
89
104
|
- `ws["!charts"]` / `ws["!chart"]`:工作表嵌入图表和图表工作表模型,可用于 SVG 渲染。
|
|
90
105
|
- `XLSX.utils.validate_merges(ws, opts)`:检查非法、重复、重叠和越界的合并单元格。
|
|
106
|
+
- `XLSX.utils.auto_fit_columns(ws, opts)`:结合浏览器文字测量、换行、溢出、
|
|
107
|
+
收缩适应和合并跨度计算最优列宽。
|
|
91
108
|
|
|
92
109
|
完整中文数据结构、选项说明和渲染行为请参考
|
|
93
110
|
[docs/visual-fidelity.zh-CN.md](docs/visual-fidelity.zh-CN.md)。
|