diff --git a/Demo/DocxHelp.tsl b/Demo/DocxHelp.tsl index 12d1579..93ba620 100644 --- a/Demo/DocxHelp.tsl +++ b/Demo/DocxHelp.tsl @@ -73,7 +73,7 @@ content := docx.AddTableContent(paragraphTitle, 1, 3); docx.AddPageBreak(content.node_); -v := docx.SaveAs('', TOfficeApi().CurCodePageToGBK('DocxFile使用帮助.docx')); +v := docx.SaveAs('', 'DocxFile使用帮助.docx'); println('Test Over!\n Save {}: {},time={}秒', file, v, mtoc); //info := GetProfilerInfo(true); diff --git a/Demo/XlsxHelp.tsl b/Demo/XlsxHelp.tsl index 234b1ac..2e3d6e5 100644 --- a/Demo/XlsxHelp.tsl +++ b/Demo/XlsxHelp.tsl @@ -1,8 +1,8 @@ path := ExtractFileDir(ExtractFileDir(PluginPath())); {$IFNDEF Win32} - path := path + '\\funcext\\TSOffice\\TSXlsxFile.tsf'; -{$ELSE} path := path + '/funcext/TSOffice/TSXlsxFile.tsf'; +{$ELSE} + path := path + '\\funcext\\TSOffice\\TSXlsxFile.tsf'; {$ENDIF} funcs := LoadClassInfo(path); @@ -43,6 +43,7 @@ PrintSuccess("GetCellRichText", testing++); file.MergeCell('XlsxFile', 'A1', 'C1'); PrintSuccess("MergeCell", testing++); +file.SetRowHeight('XlsxFile', 1, 60); style := TOfficeObj('TStyle'); @@ -138,7 +139,7 @@ End file.SetColWidth('Functions', 'A', 'A', 120); PrintSuccess('SetColWidth', testing++); -saveName := utf8toansi("XlsxFile使用帮助.xlsx"); +saveName := "XlsxFile使用帮助.xlsx"; [err, errinfo] := file.SaveAs('', saveName); if err then return PrintError("SaveAs", err, errinfo); @@ -320,6 +321,7 @@ Begin excel.SetCellValue(sheet_name, cell_1, name); excel.MergeCell(sheet_name, cell_1, cell_2); excel.SetCellStyle(sheet_name, cell_1, cell_2, styleid1); + excel.SetRowHeight(sheet_name, row, 25); row++; desc_arr := obj_info[i]['Desc']; diff --git a/DocxFile使用帮助.docx b/DocxFile使用帮助.docx index b5f8fbb..7a29bb9 100644 Binary files a/DocxFile使用帮助.docx and b/DocxFile使用帮助.docx differ diff --git a/XlsxFile使用帮助.xlsx b/XlsxFile使用帮助.xlsx index f2b6b56..e5de951 100644 Binary files a/XlsxFile使用帮助.xlsx and b/XlsxFile使用帮助.xlsx differ diff --git a/funcext/TSOffice/Extensions/OfficeVba b/funcext/TSOffice/Extensions/OfficeVba index a68cfb0..0aa9639 160000 --- a/funcext/TSOffice/Extensions/OfficeVba +++ b/funcext/TSOffice/Extensions/OfficeVba @@ -1 +1 @@ -Subproject commit a68cfb01d7f8f722987e7c74a78edc7371c810e5 +Subproject commit 0aa9639ae0ebb09286bcf6525bafb51e2a0239e9 diff --git a/funcext/TSOffice/TOfficeObj.tsf b/funcext/TSOffice/TOfficeObj.tsf index 4f44c1f..e798710 100644 --- a/funcext/TSOffice/TOfficeObj.tsf +++ b/funcext/TSOffice/TOfficeObj.tsf @@ -1,4 +1,4 @@ -// Version 1.6.5 +// Version 1.6.6 Function TOfficeObj(n); Begin case lowercase(n) of @@ -5996,6 +5996,7 @@ type TwpPr=class(NodeInfo) cnfStyle := new TwCnfStyle(self, 'w:cnfStyle'); Bdr := new TpBdr(self, 'w:pBdr'); Shading := new TwShading(self, 'w:shd'); + SectPr := new TDocSectionImpl(self, 'w:sectPr'); //TODO... End; @@ -6008,6 +6009,7 @@ type TwpPr=class(NodeInfo) cnfStyle.InitRootNode(node); Bdr.InitRootNode(node); Shading.InitRootNode(node); + SectPr.InitRootNode(node); End; Function GetAttrs(); override; @@ -6064,6 +6066,7 @@ type TwpPr=class(NodeInfo) ,('field':'Shading','name':Shading.NodeName,'obj':Shading,'attrEx':'','nodeType':'','attrName':'', 'desc':'表头底纹', 'class':'TwShading') ,('field':'TextboxTightWrap','name':'w:textboxTightWrap','obj':TextboxTightWrap,'attrEx':'w:val','nodeType':'','attrName':'', 'desc':'文本环绕形状或文本框的紧密程度', 'class':'') ,('field':'WordWrap','name':'w:wordWrap','obj':WordWrap,'attrEx':'w:val','nodeType':'','attrName':'', 'desc':'是否在指定段落或文本框架的西文单词中间断字换行', 'class':'') + ,('field':'SectPr','name':SectPr.NodeName,'obj':SectPr,'attrEx':'','nodeType':'','attrName':'', 'desc':'文字边框', 'class':'TDocSectionImpl') ) union ExtNodes; End; @@ -6117,6 +6120,7 @@ type TwpPr=class(NodeInfo) Shading; TextboxTightWrap; WordWrap; + SectPr; End; /////////////////////////////////////////////////////////////// @@ -7638,9 +7642,9 @@ type TCol=class(NodeInfo) End; /////////////////////////////////////////////////////////////// -/// TCols +/// TColsImpl /////////////////////////////////////////////////////////////// -type TCols=class(NodeInfo) +type TColsImpl=class(NodeInfo) Function Create(); overload; Begin Create(nil, 'w:cols'); @@ -13359,7 +13363,7 @@ Type TDocumentBody = Class(DocObject) p := new TParagraph(); p.pPr.NewChildNode( array("field":"", "name":"w:sectPr", "obj":section, "attrEx":"", "nodeType":"") ); p := AddParagraph(p, posOpt, '');//段落对象 - return new TDocSection(p.node_.FirstChildElement('w:sectPr'), -2, zipfile_); + return new TDocSection(p.node_.FirstChildElement('w:pPr').FirstChildElement('w:sectPr'), -2, zipfile_); End; Function ExecInnerTSL(docx); @@ -14173,6 +14177,16 @@ Type TDocHeaderFooter = Class(TDocumentBody) xmlObj_; End; +Type TCols = Class(TColsImpl) + Function AddCol(); + Begin + o := new TCol(); + NewChildNode( array("field":"", "name":"w:col", "obj":o, "attrEx":"", "nodeType":"") ); + return o; + End; + +End; + Type TDocSection = Class(DocObject, TDocSectionImpl) Function Create();overload; Begin diff --git a/funcext/TSOffice/TSDocxFile.tsf b/funcext/TSOffice/TSDocxFile.tsf index 1e339ed..6d716a2 100644 --- a/funcext/TSOffice/TSDocxFile.tsf +++ b/funcext/TSOffice/TSDocxFile.tsf @@ -1,4 +1,4 @@ -// Version 1.6.5 +// Version 1.6.6 Type TSDocxFile = Class ///Version: V1.0 2022-09-20 ///适用于 Microsoft Word docx格式文件 diff --git a/funcext/TSOffice/TSXlsxFile.tsf b/funcext/TSOffice/TSXlsxFile.tsf index 50dbf99..2620ed1 100644 --- a/funcext/TSOffice/TSXlsxFile.tsf +++ b/funcext/TSOffice/TSXlsxFile.tsf @@ -1,4 +1,4 @@ -// Version 1.6.5 +// Version 1.6.6 Type TSXlsxFile = Class ///Version: V1.0 2022-08-08 ///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。 diff --git a/更新日志.md b/更新日志.md index 52cfb41..2d45a46 100644 --- a/更新日志.md +++ b/更新日志.md @@ -1,5 +1,14 @@ # 更新日志 +## 2023-3-14 + +### V1.6.6 + +#### word + +1. 修复TDocSection节点获取错误 +2. 支持分栏自定义宽度 + ## 2023-3-4 ### V1.6.5