Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(internationalization): internationalization,formula
Browse files Browse the repository at this point in the history
internationalization,formula
  • Loading branch information
Dushusir committed Jul 28, 2020
1 parent abbf592 commit c6901fc
Show file tree
Hide file tree
Showing 13 changed files with 9,213 additions and 296 deletions.
2 changes: 1 addition & 1 deletion docs/guide/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
## celldata
- Type:Array
- Default:[]
- Usage: The original cell data set is a set containing `{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}} }`The one-dimensional array of format cell information is only used during initialization. After the table is initialized with celldata, the data is converted to the same level field data in the luckysheetfile, such as `luckysheetfile[0].data`, the subsequent operation of the table Data update will be updated to this data field, and celldata is no longer used. If you need to take out data as initial data, you need to execute `luckysheet.getGridData(data)` to convert it to celldata data. One-dimensional array of `rcv` is converted to two-dimensional array using `luckysheet.buildGridData(luckysheetfile)`, and the input parameter is the table data object `luckysheetfile`, example:
- Usage: The original cell data set is a set containing `{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}} }`The one-dimensional array of format cell information is only used during initialization. After the table is initialized with celldata, the data is converted to the same level field data in the luckysheetfile, such as `luckysheetfile[0].data`, the subsequent operation of the table Data update will be updated to this data field, and celldata is no longer used. Example:
```js
[{
"r": 0,
Expand Down
64 changes: 37 additions & 27 deletions docs/guide/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@
<td>cancelline</td>
<td>Cancelline</td>
<td>0 Regular, 1 Cancelline</td>
<td rowspan="2">Style.Font object's Underline property</td>
</tr>
<tr>
<td>ul</td>
<td>underline</td>
<td>Underline</td>
<td>0 Regular, 1 Underline</td>
<td>Style.Font object's Underline property</td>
</tr>
<tr>
<td>vt</td>
Expand Down Expand Up @@ -100,13 +94,6 @@
<td>0: 0、1: 45 、2: -45、3 Vertical text、4: 90 、5: -90</td>
<td>setRotationAngle</td>
</tr>
<tr>
<td>fl</td>
<td>floatlenght</td>
<td>Decimal places</td>
<td>3</td>
<td></td>
</tr>
<tr>
<td>tb</td>
<td>textbeak</td>
Expand All @@ -115,15 +102,15 @@
<td>2: setTextWrapped <br> 0和1: IsTextWrapped =&nbsp;true</td>
</tr>
<tr>
<td>ov</td>
<td>originvalue</td>
<td>v</td>
<td>value</td>
<td>Original value</td>
<td></td>
<td></td>
</tr>
<tr>
<td>v</td>
<td>value</td>
<td>m</td>
<td>monitor</td>
<td>Display value</td>
<td></td>
<td></td>
Expand All @@ -141,9 +128,33 @@
The following is the storage of 3 cells:
```json
[
{r:0, c:1, v: { v:"display", f:"=SUM(A2)", bg:"#fff000", bs:"1",bc:"#000"}},
{r:10, c:11, v:"value2"},
{r:10, c:11, v:{f:"=sum", v:"100"}}
{
"r": 10,
"c": 11,
"v": {
"f": "=MAX(A7:A9)",
"ct": {
"fa": "General",
"t": "n"
},
"v": 100,
"m": "100"
}
},
{
"r": 0,
"c": 1,
"v": {
"v": 12,
"f": "=SUM(A2)",
"bg": "#fff000"
}
},
{
"r": 10,
"c": 11,
"v": "值2"
}
]
```

Expand All @@ -155,13 +166,12 @@ The format is set to:

```json
{
"v": "",
"f": "",
"ct": {
"v": 1,
"f": "#,##0.00",
"t": " Decimal"
}
"fa": "General",
"t": "g"
},
"m": "2424",
"v": 2424
}
```

Expand Down
39 changes: 39 additions & 0 deletions docs/zh/guide/FAQ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# FAQ

## luckysheetfile中的data和celldata有什么区别?

**<span style="font-size:20px;">A</span>** : 表格初始化时使用一维数组格式的 [celldata](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/data.html#celldata),初始化完成后转化为二维数组格式的data作为存储更新使用,celldata不再使用。

如果需要将data拿出来作为初始化数据,则需要执行 `luckysheet.getGridData(data)`转换为celldata数据。
其中`{ r, c, v }`格式的celldata转换为二维数组使用的是`luckysheet.buildGridData(luckysheetfile)`,传入参数为表格数据对象`luckysheetfile`

总结如下:
```js
// data => celldata 二维数组数据 转化成 {r, c, v}格式 一维数组,传入参数为二维数据data
luckysheet.getGridData(data)

// celldata => data 生成表格所需二维数组,传入参数为表格数据对象file
luckysheet.buildGridData(luckysheetfile)
```

------------
## 单元格的类型有哪些?

**<span style="font-size:20px;">A</span>** : 参考[单元格格式列表](https://mengshukeji.github.io/LuckysheetDocs/zh/guide/format.html#%E5%8D%95%E5%85%83%E6%A0%BC%E6%A0%BC%E5%BC%8F),例举了可用的单元格格式

------------
## luckysheetfile中的data和celldata有什么区别?

**<span style="font-size:20px;">A</span>** :

------------
## luckysheetfile中的data和celldata有什么区别?

**<span style="font-size:20px;">A</span>** :

------------
## luckysheetfile中的data和celldata有什么区别?

**<span style="font-size:20px;">A</span>** :

------------
2 changes: 1 addition & 1 deletion docs/zh/guide/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
## celldata
- 类型:Array
- 默认值:[]
- 作用: 原始单元格数据集,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用,使用celldata初始化完表格后,数据转换为luckysheetfile中的同级字段data,如`luckysheetfile[0].data`,后续操作表格的数据更新,会更新到这个data字段中,celldata不再使用。如果需要将data拿出来作为初始化数据,则需要执行 `luckysheet.getGridData(data)`转换为celldata数据。其中`rcv`一维数组转换为二维数组使用的是`luckysheet.buildGridData(luckysheetfile)`,传入参数为表格数据对象`luckysheetfile`,示例:
- 作用: 原始单元格数据集,是一个包含`{r:0,c:0,v:{m:"value",v:"value",ct: {fa: "General", t: "g"}}}`格式单元格信息的一维数组,只在初始化的时候使用,使用celldata初始化完表格后,数据转换为luckysheetfile中的同级字段data,如`luckysheetfile[0].data`,后续操作表格的数据更新,会更新到这个data字段中,celldata不再使用。示例:
```js
[{
"r": 0,
Expand Down
152 changes: 81 additions & 71 deletions docs/zh/guide/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@
<td>cancelline</td>
<td>删除线</td>
<td>0 常规 、 1 删除线</td>
<td rowspan="2">Style.Font object's Underline property</td>
</tr>
<tr>
<td>ul</td>
<td>underline</td>
<td>下划线</td>
<td>0 常规 、 1 下划线</td>
<td>Style.Font object's Underline property</td>
</tr>
<tr>
<td>vt</td>
Expand Down Expand Up @@ -100,13 +94,6 @@
<td>0: 0、1: 45 、2:-45、3 竖排文字、4: 90 、5:-90</td>
<td>setRotationAngle</td>
</tr>
<tr>
<td>fl</td>
<td>floatlenght</td>
<td>小数位数</td>
<td>3</td>
<td></td>
</tr>
<tr>
<td>tb</td>
<td>textbeak</td>
Expand All @@ -115,15 +102,15 @@
<td>2:setTextWrapped <br> 0和1:IsTextWrapped =&nbsp;true</td>
</tr>
<tr>
<td>ov</td>
<td>originvalue</td>
<td>v</td>
<td>value</td>
<td>原始值</td>
<td></td>
<td></td>
</tr>
<tr>
<td>v</td>
<td>value</td>
<td>m</td>
<td>monitor</td>
<td>显示值</td>
<td></td>
<td></td>
Expand All @@ -141,9 +128,33 @@
以下为3个单元格存储:
```json
[
{r:0, c:1, v: { v:"显示", f:"=SUM(A2)", bg:"#fff000", bs:"1",bc:"#000"}},
{r:10, c:11, v:"值2"},
{r:10, c:11, v:{f:"=sum", v:"100"}}
{
"r": 10,
"c": 11,
"v": {
"f": "=MAX(A7:A9)",
"ct": {
"fa": "General",
"t": "n"
},
"v": 100,
"m": "100"
}
},
{
"r": 0,
"c": 1,
"v": {
"v": 12,
"f": "=SUM(A2)",
"bg": "#fff000"
}
},
{
"r": 10,
"c": 11,
"v": "值2"
}
]
```

Expand All @@ -155,60 +166,59 @@

```json
{
"v": "",
"f": "",
"ct": {
"v": 1,
"f": "#,##0.00",
"t": " Decimal"
}
"fa": "General",
"t": "g"
},
"m": "2424",
"v": 2424
}
```

|参数|说明|使用|
|参数|说明||
| ------------ | ------------ | ------------ |
|v|value,Aspose中的快捷设置值|`var currencyStyle = book.CreateStyle();`<br>`currencyStyle.Number = 8;`|
|f|Format:格式的定义串 `$#,##0;$-#,##0`|`var currencyStyle = book.CreateStyle();`<br>`currencyStyle.Custom  = "#,##0 SEK";`|
|t|Type类型:<br>0:General<br>1:Decimal<br>2:Currency<br>3:Percentage<br>4:Scientific<br>5:Fraction<br>6:Date<br>7:Time<br>8:Accounting<br>9:Text<br>10:DateTime|类型是前端区分的格式,excel导入时根据导入format字符的关键字来区分是哪种类型:<br>1.含YYYY、MM、DD的是6|
|fa|Format格式的定义串| 如"General"|
|t|Type类型|如"g"|

可选择的设置如下:
| 格式 | ct.fa值 | ct.t值 | m值示例 |备注 |
|----------|----------|-------------------------|------------------------- |------------------------- |
| 自动 | General | g | Luckysheet ||
| 纯文本 | @ | s | Luckysheet ||
| <br><br><br>**数字格式** | | | | |
| 整数 | 0 | n | 1235 | 0位小数 ||
| 数字一位小数 | 0.0 | n | 1234.6 | 0.0中,点后面0的个数就代表小数位数,原始数字位数大,设置位数小时会做四舍五入 |
| 数字两位小数 | 0.00 | n | 1234.56 ||
| 更多数字格式 | #,##0 | n | 1,235 ||
| 更多数字格式 | #,##0.00 | n | 1,234.56 ||
| 更多数字格式 | #,##0_);(#,##0) | n | 1,235 ||
| 更多数字格式 | #,##0_);[Red](#,##0) | n | 1,235 ||
| 更多数字格式 | #,##0.00_);(#,##0.00) | n | 1,234.56 ||
| 更多数字格式 | #,##0.00_);[Red](#,##0.00) | n | 1,234.56 ||
| 更多数字格式 | $#,##0_);($#,##0) | n | $1,235 ||
| 更多数字格式 | $#,##0_);[Red]($#,##0) | n | $1,235 ||
| 更多数字格式 | $#,##0.00_);($#,##0.00) | n | $1,234.56 ||
| 更多数字格式 | $#,##0.00_);[Red]($#,##0.00) | n | $1,234.56 ||
| 更多数字格式 | _($* #,##0_);_(...($* "-"_);_(@_) | n | $ 1,235 ||
| 更多数字格式 | _(* #,##0_);_(*..._(* "-"_);_(@_) | n | 1,235 ||
| 更多数字格式 | _($* #,##0.00_);_(...($* "-"_);_(@_) | n | $ 1,234.56 ||
| 更多数字格式 | _(* #,##0.00_);...* "-"??_);_(@_) | n | 1,234.56 ||
| 百分比整数 | 0% | n | 123456% |也支持 #0% 的用法|
| 百分比 | 0.00% | n | 123456.00% |也支持 #0.00% 的用法,点后面0的个数就代表小数位数|
| 科学计数 | 0.00E+00 | n | 1.23E+03 ||
| 科学计数 | ##0.0E+0 | n | 1.2E+3 ||
| 分数 | # ?/? | n | 1234 5/9 ||
| 分数 | # ??/?? | n | 1234 14/25 ||
| 万元 | w | n |12万3456||
| 万元2位小数 | w0.00 | n |12万3456.00||
| 会计 | ¥(0.00) | n ||

Aspose设置如下:
| Value | Type | Format String |
|-------|------------|---------------------------------------------|
| 0 | General | General |
| 1 | Decimal | 0 |
| 2 | Decimal | 0\.00 |
| 3 | Decimal | \#,\#\#0 |
| 4 | Decimal | \#,\#\#0\.00 |
| 5 | Currency | $\#,\#\#0;$\-\#,\#\#0 |
| 6 | Currency | $\#,\#\#0;$\-\#,\#\#0 |
| 7 | Currency | $\#,\#\#0\.00;$\-\#,\#\#0\.00 |
| 8 | Currency | $\#,\#\#0\.00;$\-\#,\#\#0\.00 |
| 9 | Percentage | 0% |
| 10 | Percentage | 0\.00% |
| 11 | Scientific | 0\.00E\+00 |
| 12 | Fraction | \# ?/? |
| 13 | Fraction | \# / |
| 14 | Date | m/d/yy |
| 15 | Date | d\-mmm\-yy |
| 16 | Date | d\-mmm |
| 17 | Date | mmm\-yy |
| 18 | Time | h:mm AM/PM |
| 19 | Time | h:mm:ss AM/PM |
| 20 | Time | h:mm |
| 21 | Time | h:mm:ss |
| 22 | Time | m/d/yy h:mm |
| 37 | Currency | \#,\#\#0;\-\#,\#\#0 |
| 38 | Currency | \#,\#\#0;\-\#,\#\#0 |
| 39 | Currency | \#,\#\#0\.00;\-\#,\#\#0\.00 |
| 40 | Currency | \#,\#\#0\.00;\-\#,\#\#0\.00 |
| 41 | Accounting | \_ \* \#,\#\#0\_ ;\_ \* "\_ ;\_ @\_ |
| 42 | Accounting | \_ $\* \#,\#\#0\_ ;\_ $\* "\_ ;\_ @\_ |
| 43 | Accounting | \_ \* \#,\#\#0\.00\_ ;\_ \* "??\_ ;\_ @\_ |
| 44 | Accounting | \_ $\* \#,\#\#0\.00\_ ;\_ $\* "??\_ ;\_ @\_ |
| 45 | Time | mm:ss |
| 46 | Time | h :mm:ss |
| 47 | Time | mm:ss\.0 |
| 48 | Scientific | \#\#0\.0E\+00 |
| 49 | Text | @ |
| 货币 | ¥0.00 或者 ¥ #.00 | n ||
| 日期 | yyyy-MM-dd | d ||
| 时间 | hh:mm AM/PM | d ||
| 时间24H | hh:mm | d ||
| 日期时间 | yyyy-MM-dd hh:mm AM/PM | d ||
| 日期时间24H | yyyy-MM-dd hh:mm | d ||
| 日期时间24H | yyyy-MM-dd hh:mm | d ||

导入/导出只用考虑用户看到的数据样式,例如excel中处理日期格式的方式为把日期统一转换为数字:42736 代表 2017-1-1
导入/导出只用考虑用户看到的数据样式,例如excel中处理日期格式的方式为把日期统一转换为数字:42736 代表 2017-1-1
Loading

0 comments on commit c6901fc

Please sign in to comment.