This commit is contained in:
csh 2023-12-29 10:11:50 +08:00
parent fcb2a8e7b3
commit dc7d48c318
6 changed files with 58 additions and 38 deletions

View File

@ -1,4 +1,4 @@
// Version 1.5.4 // Version 1.5.5
Function TOfficeObj(n); Function TOfficeObj(n);
Begin Begin
case lowercase(n) of case lowercase(n) of
@ -13890,12 +13890,21 @@ Type TDocumentBody = Class(DocObject)
if name = 'w:p' and not ifObj(pNode.FirstChildElement('w:sectPr')) then if name = 'w:p' and not ifObj(pNode.FirstChildElement('w:sectPr')) then
begin begin
pStyle := class(TSXml).GetNode(pNode, "w:pPr/w:pStyle"); pStyle := class(TSXml).GetNode(pNode, "w:pPr/w:pStyle");
level := nil;
if pStyle then if pStyle then
begin begin
styleId := pStyle.GetAttribute('w:val'); styleId := pStyle.GetAttribute('w:val');
if styleId <> '' and (obj := docx.StyleObject().GetStyleById(styleId)) and ifObj(obj) then if styleId <> '' and (obj := docx.StyleObject().GetStyleById(styleId)) and ifObj(obj) then
begin begin
level := getHeadingLevel(docx, obj); level := getHeadingLevel(docx, obj);
end
end
else begin
level := class(TSXml).GetNode(pNode, "w:pPr/w:outlineLvl");
if ifObj(level) then level := level.GetAttribute("w:val");
end
if not ifnil(level) then
begin
iLevel := Class(TSXml).SafeStrToIntDef(level, -1); iLevel := Class(TSXml).SafeStrToIntDef(level, -1);
if iLevel+1 >= UpperHeadingLevel and iLevel+1 <= LowerHeadingLevel then Begin if iLevel+1 >= UpperHeadingLevel and iLevel+1 <= LowerHeadingLevel then Begin
//统计数字项目编号 //统计数字项目编号
@ -13928,7 +13937,6 @@ Type TDocumentBody = Class(DocObject)
ind++; ind++;
End; End;
end end
end
End End
else if false and ifarray(numIds) and name = 'w:tbl' then Begin else if false and ifarray(numIds) and name = 'w:tbl' then Begin
tbl := TOfficeObj('TTable'); tbl := TOfficeObj('TTable');

View File

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

View File

@ -1,4 +1,4 @@
// Version 1.5.4 // Version 1.5.5
Type TSXlsxFile = Class Type TSXlsxFile = Class
///Version: V1.0 2022-08-08 ///Version: V1.0 2022-08-08
///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。 ///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。
@ -352,10 +352,9 @@ Type TSXlsxFile = Class
for i:=0 to length(data)-1 do Begin for i:=0 to length(data)-1 do Begin
for j:=0 to length(data[i])-1 do Begin for j:=0 to length(data[i])-1 do Begin
[err, cell] := CoordinatesToCellName(colNum + j, rowNum + i); [err, cell] := CoordinatesToCellName(colNum + j, rowNum + i);
SetCellValue(sheet, cell, data[i][j]); ret := SetCellValue(sheet, cell, data[i][j]);
if not ret then return array(1, "error")
End; End;
if err then
return array(err, info);
End; End;
return array(0, "OK"); return array(0, "OK");
End; End;

View File

@ -284,7 +284,7 @@ Type TTableContent = class
if ifObj(node) then if ifObj(node) then
return node.GetAttribute('w:name'); return node.GetAttribute('w:name');
bookMarkID := docx_.Document().GetBookMarkID(); bookMarkID := docx_.Document().GetBookMarkID();
return p.AddBookMark(); return p.AddBookMark(bookMarkID);
End; End;
Function _CheckNodes(name); Function _CheckNodes(name);

View File

@ -135,6 +135,7 @@ Type xlsxWorkBook = Class
end end
ret := o.SetCellValue(axis, val, opt); ret := o.SetCellValue(axis, val, opt);
end end
return ret;
End; End;
Function GetCellRichText(sheet, axis); Function GetCellRichText(sheet, axis);

View File

@ -1,5 +1,17 @@
# 更新日志 # 更新日志
## 2023-12-29
### V1.5.5
#### word
1. 修复生成的目录打开后重新生成页码可能产生页码失败问题
#### excel
1. 修复`InsertTable`与``SetCellValue`返回值问题
## 2023-12-18 ## 2023-12-18
### V1.5.4 ### V1.5.4