This commit is contained in:
csh 2024-03-14 10:18:16 +08:00
parent a3df0d5df9
commit fb22cf9b0a
9 changed files with 36 additions and 11 deletions

View File

@ -73,7 +73,7 @@ content := docx.AddTableContent(paragraphTitle, 1, 3);
docx.AddPageBreak(content.node_); 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); println('Test Over!\n Save {}: {},time={}秒', file, v, mtoc);
//info := GetProfilerInfo(true); //info := GetProfilerInfo(true);

View File

@ -1,8 +1,8 @@
path := ExtractFileDir(ExtractFileDir(PluginPath())); path := ExtractFileDir(ExtractFileDir(PluginPath()));
{$IFNDEF Win32} {$IFNDEF Win32}
path := path + '\\funcext\\TSOffice\\TSXlsxFile.tsf';
{$ELSE}
path := path + '/funcext/TSOffice/TSXlsxFile.tsf'; path := path + '/funcext/TSOffice/TSXlsxFile.tsf';
{$ELSE}
path := path + '\\funcext\\TSOffice\\TSXlsxFile.tsf';
{$ENDIF} {$ENDIF}
funcs := LoadClassInfo(path); funcs := LoadClassInfo(path);
@ -43,6 +43,7 @@ PrintSuccess("GetCellRichText", testing++);
file.MergeCell('XlsxFile', 'A1', 'C1'); file.MergeCell('XlsxFile', 'A1', 'C1');
PrintSuccess("MergeCell", testing++); PrintSuccess("MergeCell", testing++);
file.SetRowHeight('XlsxFile', 1, 60);
style := TOfficeObj('TStyle'); style := TOfficeObj('TStyle');
@ -138,7 +139,7 @@ End
file.SetColWidth('Functions', 'A', 'A', 120); file.SetColWidth('Functions', 'A', 'A', 120);
PrintSuccess('SetColWidth', testing++); PrintSuccess('SetColWidth', testing++);
saveName := utf8toansi("XlsxFile使用帮助.xlsx"); saveName := "XlsxFile使用帮助.xlsx";
[err, errinfo] := file.SaveAs('', saveName); [err, errinfo] := file.SaveAs('', saveName);
if err then if err then
return PrintError("SaveAs", err, errinfo); return PrintError("SaveAs", err, errinfo);
@ -320,6 +321,7 @@ Begin
excel.SetCellValue(sheet_name, cell_1, name); excel.SetCellValue(sheet_name, cell_1, name);
excel.MergeCell(sheet_name, cell_1, cell_2); excel.MergeCell(sheet_name, cell_1, cell_2);
excel.SetCellStyle(sheet_name, cell_1, cell_2, styleid1); excel.SetCellStyle(sheet_name, cell_1, cell_2, styleid1);
excel.SetRowHeight(sheet_name, row, 25);
row++; row++;
desc_arr := obj_info[i]['Desc']; desc_arr := obj_info[i]['Desc'];

Binary file not shown.

Binary file not shown.

@ -1 +1 @@
Subproject commit a68cfb01d7f8f722987e7c74a78edc7371c810e5 Subproject commit 0aa9639ae0ebb09286bcf6525bafb51e2a0239e9

View File

@ -1,4 +1,4 @@
// Version 1.6.5 // Version 1.6.6
Function TOfficeObj(n); Function TOfficeObj(n);
Begin Begin
case lowercase(n) of case lowercase(n) of
@ -5996,6 +5996,7 @@ type TwpPr=class(NodeInfo)
cnfStyle := new TwCnfStyle(self, 'w:cnfStyle'); cnfStyle := new TwCnfStyle(self, 'w:cnfStyle');
Bdr := new TpBdr(self, 'w:pBdr'); Bdr := new TpBdr(self, 'w:pBdr');
Shading := new TwShading(self, 'w:shd'); Shading := new TwShading(self, 'w:shd');
SectPr := new TDocSectionImpl(self, 'w:sectPr');
//TODO... //TODO...
End; End;
@ -6008,6 +6009,7 @@ type TwpPr=class(NodeInfo)
cnfStyle.InitRootNode(node); cnfStyle.InitRootNode(node);
Bdr.InitRootNode(node); Bdr.InitRootNode(node);
Shading.InitRootNode(node); Shading.InitRootNode(node);
SectPr.InitRootNode(node);
End; End;
Function GetAttrs(); override; 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':'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':'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':'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; ) union ExtNodes;
End; End;
@ -6117,6 +6120,7 @@ type TwpPr=class(NodeInfo)
Shading; Shading;
TextboxTightWrap; TextboxTightWrap;
WordWrap; WordWrap;
SectPr;
End; End;
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
@ -7638,9 +7642,9 @@ type TCol=class(NodeInfo)
End; End;
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
/// TCols /// TColsImpl
/////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////
type TCols=class(NodeInfo) type TColsImpl=class(NodeInfo)
Function Create(); overload; Function Create(); overload;
Begin Begin
Create(nil, 'w:cols'); Create(nil, 'w:cols');
@ -13359,7 +13363,7 @@ Type TDocumentBody = Class(DocObject)
p := new TParagraph(); p := new TParagraph();
p.pPr.NewChildNode( array("field":"", "name":"w:sectPr", "obj":section, "attrEx":"", "nodeType":"") ); p.pPr.NewChildNode( array("field":"", "name":"w:sectPr", "obj":section, "attrEx":"", "nodeType":"") );
p := AddParagraph(p, posOpt, '');//段落对象 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; End;
Function ExecInnerTSL(docx); Function ExecInnerTSL(docx);
@ -14173,6 +14177,16 @@ Type TDocHeaderFooter = Class(TDocumentBody)
xmlObj_; xmlObj_;
End; 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) Type TDocSection = Class(DocObject, TDocSectionImpl)
Function Create();overload; Function Create();overload;
Begin Begin

View File

@ -1,4 +1,4 @@
// Version 1.6.5 // Version 1.6.6
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.6.5 // Version 1.6.6
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 等多种文档格式。

View File

@ -1,5 +1,14 @@
# 更新日志 # 更新日志
## 2023-3-14
### V1.6.6
#### word
1. 修复TDocSection节点获取错误
2. 支持分栏自定义宽度
## 2023-3-4 ## 2023-3-4
### V1.6.5 ### V1.6.5