升级单元格样式,新增对象说明(TOfficeObj.tsf)文档

This commit is contained in:
csh 2022-11-01 15:09:01 +08:00
parent acea813ed1
commit 83b8ff6d09
6 changed files with 2322 additions and 1855 deletions

View File

@ -12,4 +12,6 @@ TSOffice 项目:纯 TSL 代码实现 excel、word 文件读写
## 帮助文档 ## 帮助文档
- [Excel 帮助文档](./ExcelFile%E4%BD%BF%E7%94%A8%E5%B8%AE%E5%8A%A9.xlsx) - [Excel 帮助文档](./ExcelFile%E4%BD%BF%E7%94%A8%E5%B8%AE%E5%8A%A9.xlsx) 涵盖了对Excel文件的操作API
- [TOfficeObj 帮助文档](./TOfficeObj.md) 使用的对象的文档说明比如说“样式”TStyle对象

144
TOfficeObj.md Normal file
View File

@ -0,0 +1,144 @@
# TOfficeObj 说明文档
## TStyle
- **NumberFormat** : `class` : [**TNumFmts**](#tnumfmts) 数字样式
- **Alignment** : `class` : [**TAligment**](#taligment) 对齐样式
- **Font** : `class` : [**TFont**](#tfont) 字体样式
- **Border** : `class` : [**TBorder**](#tborders) 边框样式
- **Fill** : `class` : [**TFills**](#tfills) 填充样式
- **Protection** : `class` : [**TProtection**](#tprotection) 保护样式
## TNumFmts
- **FormatCode** : `string`
## TAligment
- **Horizontal** : `string` 水平对齐
- nil默认靠右
- "center" : 居中
- "left" : 靠左
- "fill" : 填充
- "justify" : 两端对齐
- "distributed" : 分散对齐
- "centerContinuous" : 跨列居中
- **Vertical** : `string` 垂直对齐
- nil默认靠下
- "center" : 居中
- "top" : 靠上
- "justify" : 两端对齐
- "distributed" : 分散对齐
- **WrapText** : `boolean` 是否自动换行,默认不换行
- **ReadingOrder** : `string` 文字方向
- nil默认根据内容
- "1" : 总是从左到右
- "2" : 总是从右到左
## TFont
- **Name** : `string`,字体名称
- **Size** : `float` 字体大小
- **Bold** : `boolean` 是否加粗,默认不加粗
- **Italic** : `boolean` 是否倾斜,默认不倾斜
- **Charset** : `string` 字符集,可不设置
- **Strikethrough** : `boolean` 是否启用删除线,默认不启用
- **Script** : `string` 上下标
- "subscript" : 下标
- "superscript" : 上标
- _颜色只能设置以下一种属性_
- **Color** : `string` RGB 颜色,如"FFA020F0"
- **ThemeColor** : `int` 主题颜色
- **Underline** : `string` 下划线,默认无
- "double" : 双下划线
- "singleAccounting" : 会计单下划线
- "doubleAccounting" : 会计双下划线
```md
未使用
- **FontStyle** : `string`
- **OutlineFont** : `string`
- **shadow** : `string`
- **Background** : `string`
- **TintAndShade** :
- **rFont** :
- **ThemeFont** :
- **ColorIndex** : `string`
```
## TBorders
- **Left** : `class` : [**TBorder**](#tborder) 左边框
- **Right** : `class` : [**TBorder**](#tborder) 右边框
- **Top** : `class` : [**TBorder**](#tborder) 上边框
- **Bottom** : `class` : [**TBorder**](#tborder) 下边框
- **DiagonalUp** : `boolean` 斜上对角线
- **DiagonalDown** : `boolean` 斜下对角线
- **Diagonal** : `class` : [**TBorder**](#tborder) 对角线,设置 **DiagonalUp****DiagonalDown** 时有效
## TBorder
- **LineStyle** : `string` 线型
- "hair"
- "dotted"
- "dashDotDot"
- "dashDot"
- "dashed"
- "thin"
- "slantDashDot"
- "mediumDashDodDot"
- "mediumDashDot"
- "mediumDashed"
- "medium"
- "thick"
- "double"
- _颜色只能设置以下一种属性_
- **Color** : `string` RGB 颜色,如"FFA020F0"
- **ThemeColor** : `int` 主题颜色
## TFills
只能设置一种填充方式
- **Pattern** : `class` : [**TPattern**](#tpattern) 图案填充
- **Gradient** : `class` : [**TGradient**](#tgradient) 颜色渐变填充
## TPattern
- **PatternType** : `string` 图案样式
- _颜色前景色只能设置以下一种属性_
- **ForegroundColor** : `string` RGB 颜色
- **ForegroundThemeColor** : `int` 主题颜色
- _颜色背景色只能设置以下一种属性_
- **BackgroundColor** : `string` RGB 颜色
- **BackgroundThemeColor** : `int` 主题颜色
## TGradient
- _颜色 1渐变的颜色 1但每个颜色只能设置以下一种属性_
- **Color1** : `string` RGB 颜色
- **ThemeColor1** : `int` 主题颜色
- _颜色 2渐变的颜色 2但每个颜色只能设置以下一种属性_
- **Color2** : `string` RGB 颜色
- **ThemeColor2** : `int` 主题颜色
- **Shading** : `int` 底纹样式
| <div style="width: 20pt">取值</div> | 样式 | 取值 | 样式 |
| ----------------------------------- | -------------------------------------------------------------------------------- | ---- | ------------------------------------------------- |
| 0 | 水平渐变,颜色 1 从上到下渐变到颜色 2 | 1 | 水平渐变,颜色 2 从上到下渐变到颜色 1 |
| 2 | 水平渐变,三层颜色,颜色 1 从上渐变到中间颜色 2再从颜色 2 渐变到底部颜色 1 |
| 3 | 垂直渐变,颜色 1 从左到右渐变到颜色 2 | 4 | 垂直渐变,颜色 2 从右到左渐变到颜色 1 |
| 5 | 垂直渐变,三层颜色,颜色 1 从左渐变到中间颜色 2再从颜色 2 渐变到右边颜色 1 |
| 6 | 斜上渐变,颜色 1 左上渐变到右下颜色 2 | 7 | 斜上渐变,颜色 2 左上渐变到右下颜色 1 |
| 8 | 斜上渐变,三层颜色,颜色 1 从左上渐变到对角线颜色 2再从颜色 2 渐变到右下颜色 1 |
| 9 | 斜下渐变,颜色 1 右上渐变到左下颜色 2 | 10 | 斜下渐变,颜色 2 左上渐变到右下颜色 1 |
| 11 | 斜下渐变,三层颜色,颜色 1 从左上渐变到对角线颜色 2再从颜色 2 渐变到右下颜色 1 |
| 12 | 角部辐射渐变,颜色 1 左上角辐射渐变到右下角 | 13 | 角部辐射渐变,颜色 1 右上角辐射渐变到左下角颜色 2 |
| 14 | 角部辐射渐变,颜色 1 左下角辐射渐变到右上角 | 15 | 角部辐射渐变,颜色 1 右下角辐射渐变到左上角颜色 2 |
| 16 | 中心辐射渐变,颜色 1 从中心向四周辐射到颜色 2 |
## TProtection
- **Lock** : `boolean` 是否锁定
- **Hide** : `boolean` 是否隐藏

File diff suppressed because it is too large Load Diff

View File

@ -346,7 +346,7 @@ Type TSExcelFile = Class
return workbook_.InsertCol(sheet, col); return workbook_.InsertCol(sheet, col);
End; End;
///插入行,在指定前插入空白行 ///插入行,在指定前插入空白行
///sheet: string工作表名称 ///sheet: string工作表名称
///row: int ///row: int
///返回: [err, info] ///返回: [err, info]

View File

@ -8,6 +8,14 @@ public
ExtNodes := array(); ExtNodes := array();
End End
Function HandleAttrs(); virtual;
Begin
End
Function HandleChildren(); virtual;
Begin
End
Function GetAttrs(); virtual; Function GetAttrs(); virtual;
Begin Begin
return ExtAttr; return ExtAttr;
@ -60,9 +68,10 @@ public
arr := array('type': 'element', 'name': children[i]['name'], 'attributes': array()); arr := array('type': 'element', 'name': children[i]['name'], 'attributes': array());
if node_type = 'empty' then // <b/> if node_type = 'empty' then // <b/>
begin begin
// child_arr[len] := arr; end
// ++len; else if node_type = 'empty_string' then
// continue; begin
if ifstring(obj) then arr['attributes'] := array(key : obj);
end end
else if node_type = 'pcdata' then else if node_type = 'pcdata' then
begin begin

View File

@ -264,7 +264,7 @@ Type xlsxWorkBook = Class
while ifObj(node) do while ifObj(node) do
Begin Begin
name := node.GetAttribute('name'); name := node.GetAttribute('name');
if name = sourceName then if name = LowerCase(sourceName) then
Begin Begin
node.SetAttribute('name', destName); node.SetAttribute('name', destName);
break; break;