This commit is contained in:
csh 2024-07-18 17:26:41 +08:00
parent 5469ca318d
commit 037cb41560
6 changed files with 61 additions and 30 deletions

View File

@ -1,4 +1,4 @@
// Version 1.6.9
// Version 1.7.0
Function TOfficeObj(n);
Begin
case lowercase(n) of
@ -554,6 +554,7 @@ type TComment=class(NodeInfo)
Function Init();
Begin
Visible := new BOOL(self, 'Visible');
Font := new TFont(self, 'rPr');
//TODO...
End;
@ -561,6 +562,7 @@ type TComment=class(NodeInfo)
Function InitRootNode(node);
Begin
RootObj := node;
Visible.InitRootNode(node);
Font.InitRootNode(node);
End;
@ -584,7 +586,8 @@ type TComment=class(NodeInfo)
Function GetChildren(); override;
Begin
return array(('field':'Font','name':Font.NodeName,'obj':Font,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TFont')
return array(('field':'Visible','name':Visible.NodeName,'obj':Visible,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'BOOL')
,('field':'Font','name':Font.NodeName,'obj':Font,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TFont')
,('field':'Text','name':'t','obj':XMLText,'attrEx':'','nodeType':'pcdata','attrName':'', 'desc':'', 'class':'')
,('field':'Space','name':'t','obj':Space,'attrEx':'xml:space','nodeType':'','attrName':'', 'desc':'', 'class':'')
) union ExtNodes;
@ -593,6 +596,7 @@ type TComment=class(NodeInfo)
//Attributes
//Nodes
Visible;
Font;
XMLText;
Space;
@ -3611,7 +3615,14 @@ type TBorders=class(NodeInfo)
Function GetChildren(); override;
Begin
return array(('field':'Left','name':Left.NodeName,'obj':Left,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
return array(('field':'Color','name':'Color','obj':Color,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'ColorIndex','name':'ColorIndex','obj':ColorIndex,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'LineStyle','name':'LineStyle','obj':LineStyle,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'Value','name':'Value','obj':Value,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'Weight','name':'Weight','obj':Weight,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'ThemeColor','name':'ThemeColor','obj':ThemeColor,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'TintAndShade','name':'TintAndShade','obj':TintAndShade,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'Left','name':Left.NodeName,'obj':Left,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
,('field':'Right','name':Right.NodeName,'obj':Right,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
,('field':'Top','name':Top.NodeName,'obj':Top,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
,('field':'Bottom','name':Bottom.NodeName,'obj':Bottom,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
@ -3624,6 +3635,13 @@ type TBorders=class(NodeInfo)
XMLDiagonalUp;
//Nodes
Color;
ColorIndex;
LineStyle;
Value;
Weight;
ThemeColor;
TintAndShade;
Left;
Right;
Top;
@ -13223,10 +13241,18 @@ Type TDocumentBody = Class(DocObject)
end
if multiLine then Begin
defaultParagraph.node_ := nil;
defaultParagraph.Run.ClearText();
defaultParagraph.Run.SetText(tbl.Data_[i, j]);
tcNode.InsertEndChild(defaultParagraph.Marshal());
para := new TParagraph();
if istable(customCell) and ifObj(customCell[i, j, 1]) then
para.PPr := customCell[i, j, 1];
else
para.PPr := defaultParagraph.pPr;
if istable(customCell) and ifObj(customCell[i, j, 2]) then
para.PPr.RPr := customCell[i, j, 2];
else
para.PPr.RPr := defaultParagraph.pPr.rpr;
para.Run.SetText(tbl.Data_[i, j]);
para.Run.RPr := para.PPr.RPr;
tcNode.InsertEndChild(para.Marshal());
End
else Begin
pNode := tcNode.InsertEndChild('element', 'w:p');

View File

@ -1,4 +1,4 @@
// Version 1.6.9
// Version 1.7.0
Type TSDocxFile = Class
///Version: V1.0 2022-09-20
///适用于 Microsoft Word docx格式文件

View File

@ -72,7 +72,6 @@ public
return false;
End;
Function GetAttrs(); virtual;
Begin
return ExtAttr;
@ -201,7 +200,7 @@ public
if istable(r) then Begin
r := r[0];
node := node.FirstChildElement(r['name']);
if not ifObj(node) and r['nodeType'] = 'empty' then return false;
if not ifObj(node) and r['nodeType'] = 'empty' and not nottransferable then return false;
if not ifObj(node) then return nil;
if r['nodeType'] = 'pcdata' then //返回文本串
return node.GetText();

View File

@ -1,4 +1,4 @@
// Version 1.6.9
// Version 1.7.0
Type TSXlsxFile = Class
///Version: V1.0 2022-08-08
///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。
@ -223,7 +223,7 @@ Type TSXlsxFile = Class
// 处理cell设定的样式
if not ifarray(opt) then opt := array();
workbook_.SetCellStyleOpt(sheet_name, axis, opt);
SetCellType(sheet, axis, value, opt);
SetCellType(sheet_name, axis, value, opt);
return workbook_.SetCellValue(sheet_name, axis, value, opt);
End;

View File

@ -619,7 +619,7 @@ Type xlsxWorkBook = Class
//app.xml
app := GetXmlFileObj(class(TSXml).GetFileName('docProps_app'));
vector := app.FirstChildElement('Properties').FirstChildElement('TitlesOfParts').FirstChildElement('vt:vector');
vector.SetAttribute('size', sheetId);
vector.SetAttribute('size', sheetsCount_+1);
vector.InsertEndChild('element', 'vt:lpstr', destSheet);
//[Content_Types].xml

View File

@ -1,12 +1,18 @@
# 更新日志
## 2023-5-6
## 2024-7-8
### excel
1. 修复`CopySheet`操作后,文件报错问题
## 2024-5-6
### excel
1. 修复单元格继承列样式失败问题
## 2023-4-12
## 2024-4-12
### V1.6.8
@ -14,7 +20,7 @@
1. 修复`SetCellValue`单元格对列样式的识别,不需要手动用格式刷对所有单元格刷新样式
## 2023-3-21
## 2024-3-21
### V1.6.7
@ -24,7 +30,7 @@
2. 新增`TPageNumType`对象
3. 扩展`TDocSection`方法,`AppendReference`和`AddReference`,前者是对已有的`Section`对象添加`TReference`对象,而后者是对新的`Section`对象添加
## 2023-3-14
## 2024-3-14
### V1.6.6
@ -33,7 +39,7 @@
1. 修复`TDocSection`节点获取错误
2. 支持分栏自定义宽度
## 2023-3-4
## 2024-3-4
### V1.6.5
@ -54,7 +60,7 @@
1. 修复目录生成陷入死循环问题
## 2023-2-23
## 2024-2-23
### V1.6.3
@ -62,7 +68,7 @@
1. 修复目录生成陷入死循环问题
## 2023-2-7
## 2024-2-7
### V1.6.2
@ -70,7 +76,7 @@
1. 修复设置段落属性`TextAlignment`失败问题
## 2023-2-5
## 2024-2-5
### V1.6.1
@ -78,7 +84,7 @@
1. 修复 excel 文件单元格原有类型与 tsl 类型转换报错问题(trystrtofloat)
## 2023-2-5
## 2024-2-5
### V1.6.0
@ -87,7 +93,7 @@
1. 兼容 Excel2016通过`NewSheet/InsertSheet`创建工作表不再提示修复错误
2. 修复带有表头的二维数组通过`InsertTable`写入数据只写入表头未写入数据问题
## 2023-1-31
## 2024-1-31
### V1.5.9
@ -99,7 +105,7 @@
1. 支持写入单元格内容时判断当前单元格的数据类型,并以单元格数据类型为准
## 2023-1-17
## 2024-1-17
### V1.5.7
@ -107,7 +113,7 @@
1. 修复单元格写入浮点数数据 bug如写入 0.0excel 某些版本打开会显示 0.00000000000000000
## 2023-1-11
## 2024-1-11
### V1.5.6