v1.0.5
This commit is contained in:
parent
ee77e920b3
commit
9b8b7f79d9
|
|
@ -125,7 +125,7 @@ Begin
|
||||||
row++;
|
row++;
|
||||||
|
|
||||||
hyperlink := TOfficeObj('THyperLink');
|
hyperlink := TOfficeObj('THyperLink');
|
||||||
hyperlink.LinkType := "Location";
|
hyperlink.LinkType := "location";
|
||||||
hyperlink.LinkUrl := "Functions!" $ c1;
|
hyperlink.LinkUrl := "Functions!" $ c1;
|
||||||
|
|
||||||
file.SetCellHyperLink("ExcelFile", cell1, hyperlink);
|
file.SetCellHyperLink("ExcelFile", cell1, hyperlink);
|
||||||
|
|
@ -693,10 +693,9 @@ style.Protection.Lock := 1;
|
||||||
('ObjName': 'THyperLink',
|
('ObjName': 'THyperLink',
|
||||||
'Desc': ('THyperLink有以下属性: '),
|
'Desc': ('THyperLink有以下属性: '),
|
||||||
'AttrInfo': (
|
'AttrInfo': (
|
||||||
('attrName': 'LinkType', 'type': 'string', 'desc': '超链接类型', 'value': array('"External": 外部超链接', '"Location"': 内部超链接)),
|
('attrName': 'LinkType', 'type': 'string', 'desc': '超链接类型', 'value': array('"external": 外部超链接', '"location"': 内部超链接)),
|
||||||
('attrName': 'LinkUrl', 'type': 'string', 'desc': '超链接地址', 'value': array()),
|
('attrName': 'LinkUrl', 'type': 'string', 'desc': '超链接地址', 'value': array()),
|
||||||
('attrName': 'Tooltip', 'type': 'string', 'desc': '超链接悬浮提示内容', 'value': array()),
|
('attrName': 'Tooltip', 'type': 'string', 'desc': '超链接悬浮提示内容', 'value': array()),
|
||||||
('attrName': 'Display', 'type': 'string', 'desc': '单元格显示的内容', 'value': array()),
|
|
||||||
),
|
),
|
||||||
'Demo': '',
|
'Demo': '',
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
///Version:V1.03
|
||||||
///Create by Tinysoft.
|
///Create by Tinysoft.
|
||||||
///自动生成 TSDocxFile 帮助文件
|
///自动生成 TSDocxFile 帮助文件
|
||||||
mtic;
|
mtic;
|
||||||
|
|
@ -68,7 +69,7 @@ v := docx.SaveAs('', UTF8ToAnsi('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);
|
||||||
//exportfile(ftstream(),'','f:\\temp\\ProfilerInfo.stm',info);
|
//exportfile(ftstream(),'','\\temp\\ProfilerInfo.stm',info);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
///子函数
|
///子函数
|
||||||
|
|
@ -956,8 +957,8 @@ Begin
|
||||||
r := select thisrowindex+1 as 'row' from data where [1] = key end;
|
r := select thisrowindex+1 as 'row' from data where [1] = key end;
|
||||||
begRow := r[0]['row'];
|
begRow := r[0]['row'];
|
||||||
endRow := r[length(r)-1]['row'];
|
endRow := r[length(r)-1]['row'];
|
||||||
[err, begCell] := xlsx_call("CoordinatesToCellName", 2, begRow);
|
[err, begCell] := CoordinatesToCellName(2, begRow);
|
||||||
[err, endCell] := xlsx_call("CoordinatesToCellName", 2, endRow);
|
[err, endCell] := CoordinatesToCellName(2, endRow);
|
||||||
tbl.Merge(begCell, endCell, true);
|
tbl.Merge(begCell, endCell, true);
|
||||||
|
|
||||||
//设置合并单元格据中对齐
|
//设置合并单元格据中对齐
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -10,14 +10,12 @@ TSOffice 项目:纯 TSL 代码实现 excel、word 文件读写
|
||||||
|
|
||||||
- `fmt_pubkrnl_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
- `fmt_pubkrnl_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
||||||
- `office_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
- `office_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
||||||
- `tsxlsx.dll` 放入 tsl 安装根目录
|
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
根据架构选择aarch64或x86版本将对应文件夹内容进行部署
|
根据架构选择aarch64或x86版本将对应文件夹内容进行部署
|
||||||
|
|
||||||
- `liboffice_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
- `liboffice_plugin` 放入 tsl 安装根目录下 Plugin 文件夹
|
||||||
- `libTsXlsx` 放入 tsl 安装根目录
|
|
||||||
|
|
||||||
## 帮助文档
|
## 帮助文档
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,4 +1,5 @@
|
||||||
// Version 1.0.4
|
// Version 1.0.5
|
||||||
|
|
||||||
Function TOfficeObj(n);
|
Function TOfficeObj(n);
|
||||||
Begin
|
Begin
|
||||||
case lowercase(n) of
|
case lowercase(n) of
|
||||||
|
|
@ -410,6 +411,20 @@ type TComment=class(NodeInfo)
|
||||||
//TODO...
|
//TODO...
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Property Text read readCommentText write writeCommentText;
|
||||||
|
Function readCommentText();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CommentText'));
|
||||||
|
else
|
||||||
|
return CommentText;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCommentText(str);
|
||||||
|
Begin
|
||||||
|
CommentText := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
Function GetAttrs(); override;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
|
|
@ -420,7 +435,7 @@ type TComment=class(NodeInfo)
|
||||||
Begin
|
Begin
|
||||||
HandleChildren();
|
HandleChildren();
|
||||||
return array(("field":"Font","name":Font.NodeName,"obj":Font,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TFont")
|
return array(("field":"Font","name":Font.NodeName,"obj":Font,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TFont")
|
||||||
,("field":"Text","name":"t","obj":Text,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"CommentText","name":"t","obj":CommentText,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"Space","name":"t","obj":Space,"attrEx":"xml:space","nodeType":"","attrName":"", "desc":"", "class":"")
|
,("field":"Space","name":"t","obj":Space,"attrEx":"xml:space","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||||
) union ExtNodes;
|
) union ExtNodes;
|
||||||
End;
|
End;
|
||||||
|
|
@ -429,7 +444,7 @@ type TComment=class(NodeInfo)
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
Font;
|
Font;
|
||||||
Text;
|
CommentText;
|
||||||
Space;
|
Space;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
@ -3665,10 +3680,38 @@ type THyperLink=class(NodeInfo)
|
||||||
//TODO...
|
//TODO...
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Property Display read readLinkDisplay write writeLinkDisplay;
|
||||||
|
Function readLinkDisplay();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('LinkDisplay'));
|
||||||
|
else
|
||||||
|
return LinkDisplay;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeLinkDisplay(str);
|
||||||
|
Begin
|
||||||
|
LinkDisplay := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Tooltip read readLinkTooltip write writeLinkTooltip;
|
||||||
|
Function readLinkTooltip();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('LinkTooltip'));
|
||||||
|
else
|
||||||
|
return LinkTooltip;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeLinkTooltip(str);
|
||||||
|
Begin
|
||||||
|
LinkTooltip := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
Function GetAttrs(); override;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
return array(("LinkType", "linkType", LinkType, ""),("Url", "linkUrl", Url, ""),("Axis", "ref", Axis, ""),("LinkDisplay", "display", LinkDisplay, ""),("LinkTooltip", "tooltip", LinkTooltip, "")) union ExtAttr;
|
return array(("LinkType", "linkType", LinkType, ""),("LinkUrl", "linkUrl", LinkUrl, ""),("Axis", "ref", Axis, ""),("LinkDisplay", "display", LinkDisplay, ""),("LinkTooltip", "tooltip", LinkTooltip, ""),("RId", "r:id", RId, ""),("Location", "location", Location, "")) union ExtAttr;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetChildren(); override;
|
Function GetChildren(); override;
|
||||||
|
|
@ -3677,30 +3720,14 @@ type THyperLink=class(NodeInfo)
|
||||||
return ExtNodes;
|
return ExtNodes;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Property LinkUrl read Url write writeUrl;
|
|
||||||
Function writeUrl(str);
|
|
||||||
Begin
|
|
||||||
Url := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Display read LinkDisplay write writeLinkDisplay;
|
|
||||||
Function writeLinkDisplay(str);
|
|
||||||
Begin
|
|
||||||
LinkDisplay := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Tooltip read LinkTooltip write writeLinkTooltip;
|
|
||||||
Function writeLinkTooltip(str);
|
|
||||||
Begin
|
|
||||||
LinkTooltip := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
LinkType;
|
LinkType;
|
||||||
Url;
|
LinkUrl;
|
||||||
Axis;
|
Axis;
|
||||||
LinkDisplay;
|
LinkDisplay;
|
||||||
LinkTooltip;
|
LinkTooltip;
|
||||||
|
RId;
|
||||||
|
Location;
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
End;
|
End;
|
||||||
|
|
@ -3815,6 +3842,146 @@ type TAppProperty=class(NodeInfo)
|
||||||
//TODO...
|
//TODO...
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Property Application read readAppApplication write writeAppApplication;
|
||||||
|
Function readAppApplication();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('AppApplication'));
|
||||||
|
else
|
||||||
|
return AppApplication;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppApplication(str);
|
||||||
|
Begin
|
||||||
|
AppApplication := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property DocSecurity read readAppDocSecurity write writeAppDocSecurity;
|
||||||
|
Function readAppDocSecurity();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return Value('AppDocSecurity');
|
||||||
|
else
|
||||||
|
return AppDocSecurity;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppDocSecurity(str);
|
||||||
|
Begin
|
||||||
|
AppDocSecurity := str;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property ScaleCrop read readAppScaleCrop write writeAppScaleCrop;
|
||||||
|
Function readAppScaleCrop();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return Value('AppScaleCrop');
|
||||||
|
else
|
||||||
|
return AppScaleCrop;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppScaleCrop(str);
|
||||||
|
Begin
|
||||||
|
AppScaleCrop := str;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Manager read readAppManager write writeAppManager;
|
||||||
|
Function readAppManager();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return Value('AppManager');
|
||||||
|
else
|
||||||
|
return AppManager;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppManager(str);
|
||||||
|
Begin
|
||||||
|
AppManager := str;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Company read readAppCompany write writeAppCompany;
|
||||||
|
Function readAppCompany();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return Value('AppCompany');
|
||||||
|
else
|
||||||
|
return AppCompany;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppCompany(str);
|
||||||
|
Begin
|
||||||
|
AppCompany := str;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property LinksUpToDate read readAppLinksUpToDate write writeAppLinksUpToDate;
|
||||||
|
Function readAppLinksUpToDate();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return Value('AppLinksUpToDate');
|
||||||
|
else
|
||||||
|
return AppLinksUpToDate;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppLinksUpToDate(str);
|
||||||
|
Begin
|
||||||
|
AppLinksUpToDate := str;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property SharedDoc read readAppSharedDoc write writeAppSharedDoc;
|
||||||
|
Function readAppSharedDoc();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return Value('AppSharedDoc');
|
||||||
|
else
|
||||||
|
return AppSharedDoc;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppSharedDoc(str);
|
||||||
|
Begin
|
||||||
|
AppSharedDoc := str;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property HyperlinkBase read readAppHyperlinkBase write writeAppHyperlinkBase;
|
||||||
|
Function readAppHyperlinkBase();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('AppHyperlinkBase'));
|
||||||
|
else
|
||||||
|
return AppHyperlinkBase;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppHyperlinkBase(str);
|
||||||
|
Begin
|
||||||
|
AppHyperlinkBase := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property HyperlinksChanged read readAppHyperlinksChanged write writeAppHyperlinksChanged;
|
||||||
|
Function readAppHyperlinksChanged();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return Value('AppHyperlinksChanged');
|
||||||
|
else
|
||||||
|
return AppHyperlinksChanged;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppHyperlinksChanged(str);
|
||||||
|
Begin
|
||||||
|
AppHyperlinksChanged := str;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Version read readAppVersion write writeAppVersion;
|
||||||
|
Function readAppVersion();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('AppVersion'));
|
||||||
|
else
|
||||||
|
return AppVersion;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeAppVersion(str);
|
||||||
|
Begin
|
||||||
|
AppVersion := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
Function GetAttrs(); override;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
|
|
@ -3825,54 +3992,30 @@ type TAppProperty=class(NodeInfo)
|
||||||
Begin
|
Begin
|
||||||
HandleChildren();
|
HandleChildren();
|
||||||
return array(("field":"AppApplication","name":"Application","obj":AppApplication,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
return array(("field":"AppApplication","name":"Application","obj":AppApplication,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"DocSecurity","name":"DocSecurity","obj":DocSecurity,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppDocSecurity","name":"DocSecurity","obj":AppDocSecurity,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"ScaleCrop","name":"ScaleCrop","obj":ScaleCrop,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppScaleCrop","name":"ScaleCrop","obj":AppScaleCrop,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"AppManager","name":"Manager","obj":AppManager,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppManager","name":"Manager","obj":AppManager,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"AppCompany","name":"Company","obj":AppCompany,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppCompany","name":"Company","obj":AppCompany,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"LinksUpToDate","name":"LinksUpToDate","obj":LinksUpToDate,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppLinksUpToDate","name":"LinksUpToDate","obj":AppLinksUpToDate,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"SharedDoc","name":"SharedDoc","obj":SharedDoc,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppSharedDoc","name":"SharedDoc","obj":AppSharedDoc,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"AppHyperlinkBase","name":"HyperlinkBase","obj":AppHyperlinkBase,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppHyperlinkBase","name":"HyperlinkBase","obj":AppHyperlinkBase,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"HyperlinksChanged","name":"HyperlinksChanged","obj":HyperlinksChanged,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppHyperlinksChanged","name":"HyperlinksChanged","obj":AppHyperlinksChanged,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
,("field":"AppVersion","name":"AppVersion","obj":AppVersion,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
,("field":"AppVersion","name":"AppVersion","obj":AppVersion,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||||
) union ExtNodes;
|
) union ExtNodes;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Property Application read AppApplication write writeAppApplication;
|
|
||||||
Function writeAppApplication(str);
|
|
||||||
Begin
|
|
||||||
AppApplication := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Manager read AppManager write writeAppManager;
|
|
||||||
Function writeAppManager(str);
|
|
||||||
Begin
|
|
||||||
AppManager := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Company read AppCompany write writeAppCompany;
|
|
||||||
Function writeAppCompany(str);
|
|
||||||
Begin
|
|
||||||
AppCompany := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property HyperlinkBase read AppHyperlinkBase write writeAppHyperlinkBase;
|
|
||||||
Function writeAppHyperlinkBase(str);
|
|
||||||
Begin
|
|
||||||
AppHyperlinkBase := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
AppApplication;
|
AppApplication;
|
||||||
DocSecurity;
|
AppDocSecurity;
|
||||||
ScaleCrop;
|
AppScaleCrop;
|
||||||
AppManager;
|
AppManager;
|
||||||
AppCompany;
|
AppCompany;
|
||||||
LinksUpToDate;
|
AppLinksUpToDate;
|
||||||
SharedDoc;
|
AppSharedDoc;
|
||||||
AppHyperlinkBase;
|
AppHyperlinkBase;
|
||||||
HyperlinksChanged;
|
AppHyperlinksChanged;
|
||||||
AppVersion;
|
AppVersion;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
@ -3896,6 +4039,132 @@ type TCoreProperty=class(NodeInfo)
|
||||||
//TODO...
|
//TODO...
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Property Title read readCoreTitle write writeCoreTitle;
|
||||||
|
Function readCoreTitle();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreTitle'));
|
||||||
|
else
|
||||||
|
return CoreTitle;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreTitle(str);
|
||||||
|
Begin
|
||||||
|
CoreTitle := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Subject read readCoreSubject write writeCoreSubject;
|
||||||
|
Function readCoreSubject();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreSubject'));
|
||||||
|
else
|
||||||
|
return CoreSubject;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreSubject(str);
|
||||||
|
Begin
|
||||||
|
CoreSubject := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Creator read readCoreCreator write writeCoreCreator;
|
||||||
|
Function readCoreCreator();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreCreator'));
|
||||||
|
else
|
||||||
|
return CoreCreator;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreCreator(str);
|
||||||
|
Begin
|
||||||
|
CoreCreator := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Keywords read readCoreKeywords write writeCoreKeywords;
|
||||||
|
Function readCoreKeywords();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreKeywords'));
|
||||||
|
else
|
||||||
|
return CoreKeywords;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreKeywords(str);
|
||||||
|
Begin
|
||||||
|
CoreKeywords := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Description read readCoreDescription write writeCoreDescription;
|
||||||
|
Function readCoreDescription();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreDescription'));
|
||||||
|
else
|
||||||
|
return CoreDescription;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreDescription(str);
|
||||||
|
Begin
|
||||||
|
CoreDescription := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property LastModifiedBy read readCoreLastModifiedBy write writeCoreLastModifiedBy;
|
||||||
|
Function readCoreLastModifiedBy();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreLastModifiedBy'));
|
||||||
|
else
|
||||||
|
return CoreLastModifiedBy;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreLastModifiedBy(str);
|
||||||
|
Begin
|
||||||
|
CoreLastModifiedBy := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property LastPrinted read readCoreLastPrinted write writeCoreLastPrinted;
|
||||||
|
Function readCoreLastPrinted();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreLastPrinted'));
|
||||||
|
else
|
||||||
|
return CoreLastPrinted;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreLastPrinted(str);
|
||||||
|
Begin
|
||||||
|
CoreLastPrinted := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property Category read readCoreCategory write writeCoreCategory;
|
||||||
|
Function readCoreCategory();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreCategory'));
|
||||||
|
else
|
||||||
|
return CoreCategory;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreCategory(str);
|
||||||
|
Begin
|
||||||
|
CoreCategory := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
|
Property ContentStatus read readCoreContentStatus write writeCoreContentStatus;
|
||||||
|
Function readCoreContentStatus();
|
||||||
|
Begin
|
||||||
|
if ifObj(Root()) then
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage(Value('CoreContentStatus'));
|
||||||
|
else
|
||||||
|
return CoreContentStatus;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function writeCoreContentStatus(str);
|
||||||
|
Begin
|
||||||
|
CoreContentStatus := class(xlsxXml).CurCodePageToUtf8(str);
|
||||||
|
End;
|
||||||
|
|
||||||
Function GetAttrs(); override;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
|
|
@ -3917,60 +4186,6 @@ type TCoreProperty=class(NodeInfo)
|
||||||
) union ExtNodes;
|
) union ExtNodes;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Property Title read CoreTitle write writeCoreTitle;
|
|
||||||
Function writeCoreTitle(str);
|
|
||||||
Begin
|
|
||||||
CoreTitle := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Subject read CoreSubject write writeCoreSubject;
|
|
||||||
Function writeCoreSubject(str);
|
|
||||||
Begin
|
|
||||||
CoreSubject := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Creator read CoreCreator write writeCoreCreator;
|
|
||||||
Function writeCoreCreator(str);
|
|
||||||
Begin
|
|
||||||
CoreCreator := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Keywords read CoreKeywords write writeCoreKeywords;
|
|
||||||
Function writeCoreKeywords(str);
|
|
||||||
Begin
|
|
||||||
CoreKeywords := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Description read CoreDescription write writeCoreDescription;
|
|
||||||
Function writeCoreDescription(str);
|
|
||||||
Begin
|
|
||||||
CoreDescription := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property LastModifiedBy read CoreLastModifiedBy write writeCoreLastModifiedBy;
|
|
||||||
Function writeCoreLastModifiedBy(str);
|
|
||||||
Begin
|
|
||||||
CoreLastModifiedBy := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property LastPrinted read CoreLastPrinted write writeCoreLastPrinted;
|
|
||||||
Function writeCoreLastPrinted(str);
|
|
||||||
Begin
|
|
||||||
CoreLastPrinted := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property Category read CoreCategory write writeCoreCategory;
|
|
||||||
Function writeCoreCategory(str);
|
|
||||||
Begin
|
|
||||||
CoreCategory := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property ContentStatus read CoreContentStatus write writeCoreContentStatus;
|
|
||||||
Function writeCoreContentStatus(str);
|
|
||||||
Begin
|
|
||||||
CoreContentStatus := class(xlsxXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
|
|
@ -4269,7 +4484,7 @@ type TwpPr=class(NodeInfo)
|
||||||
Begin
|
Begin
|
||||||
HandleChildren();
|
HandleChildren();
|
||||||
return array(("field":"StyleId","name":"w:pStyle","obj":StyleId,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"段落样式ID", "class":"")
|
return array(("field":"StyleId","name":"w:pStyle","obj":StyleId,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"段落样式ID", "class":"")
|
||||||
,("field":"NumPr","name":NumPr.NodeName,"obj":NumPr,"attrEx":"","nodeType":"","attrName":"", "desc":"disable", "class":"TNumPr")
|
,("field":"NumPr","name":NumPr.NodeName,"obj":NumPr,"attrEx":"","nodeType":"","attrName":"", "desc":"项目编号、数字编号", "class":"TNumPr")
|
||||||
,("field":"Alignment","name":"w:jc","obj":Alignment,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"左、右、居中和对齐", "class":"")
|
,("field":"Alignment","name":"w:jc","obj":Alignment,"attrEx":"w:val","nodeType":"","attrName":"", "desc":"左、右、居中和对齐", "class":"")
|
||||||
,("field":"FirstLineChars","name":"w:ind","obj":FirstLineChars,"attrEx":"w:firstLineChars","nodeType":"","attrName":"", "desc":"字符单位中的其他首行缩进", "class":"")
|
,("field":"FirstLineChars","name":"w:ind","obj":FirstLineChars,"attrEx":"w:firstLineChars","nodeType":"","attrName":"", "desc":"字符单位中的其他首行缩进", "class":"")
|
||||||
,("field":"FirstLineIndent","name":"w:ind","obj":FirstLineIndent,"attrEx":"w:firstLine","nodeType":"","attrName":"", "desc":"指定段落第一行缩进的相对差异的值", "class":"")
|
,("field":"FirstLineIndent","name":"w:ind","obj":FirstLineIndent,"attrEx":"w:firstLine","nodeType":"","attrName":"", "desc":"指定段落第一行缩进的相对差异的值", "class":"")
|
||||||
|
|
@ -6748,9 +6963,9 @@ type TTableImpl=class(NodeInfo)
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
/// TCoreProperties
|
/// TCorePropertiesImpl
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
type TCoreProperties=class(NodeInfo, CoreProperties)
|
type TCorePropertiesImpl=class(NodeInfo)
|
||||||
Function Create(); overload;
|
Function Create(); overload;
|
||||||
Begin
|
Begin
|
||||||
Create(nil, 'w:p');
|
Create(nil, 'w:p');
|
||||||
|
|
@ -8966,6 +9181,7 @@ Type TChart = Class(TChartImpl)
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///显示数据表
|
///显示数据表
|
||||||
|
///b:bool型,是否显示数据表
|
||||||
Function ShowDataTable(b);
|
Function ShowDataTable(b);
|
||||||
Begin
|
Begin
|
||||||
if not ifObj(ChartNode) then
|
if not ifObj(ChartNode) then
|
||||||
|
|
@ -9409,7 +9625,7 @@ private
|
||||||
Val.NumRef.F := data; //excel图表(Sheet1!$C$2:$C$6)
|
Val.NumRef.F := data; //excel图表(Sheet1!$C$2:$C$6)
|
||||||
else if istable(data) then Begin //word 图表
|
else if istable(data) then Begin //word 图表
|
||||||
cnt := length(data);
|
cnt := length(data);
|
||||||
[err, axis] := xlsx_call("ColumnNumberToName", 2 * ind + 2);
|
[err, axis] := ColumnNumberToName(2 * ind + 2);
|
||||||
Val.NumRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1);
|
Val.NumRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1);
|
||||||
Val.NumRef.NumCache.PtCount := cnt;
|
Val.NumRef.NumCache.PtCount := cnt;
|
||||||
Val.NumRef.NumCache.formatCode := 'General';
|
Val.NumRef.NumCache.formatCode := 'General';
|
||||||
|
|
@ -9435,7 +9651,7 @@ private
|
||||||
cat.StrRef.F := Categories; //excel图表(Sheet1!$B$2:$B$6)
|
cat.StrRef.F := Categories; //excel图表(Sheet1!$B$2:$B$6)
|
||||||
else if istable(Categories) then Begin //word 图表
|
else if istable(Categories) then Begin //word 图表
|
||||||
cnt := length(Categories);
|
cnt := length(Categories);
|
||||||
[err, axis] := xlsx_call("ColumnNumberToName", 2 * ind + 1);
|
[err, axis] := ColumnNumberToName(2 * ind + 1);
|
||||||
cat.StrRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1);
|
cat.StrRef.F := fmt('Sheet1!${}$2:${}${}',axis, axis, cnt+1);
|
||||||
cat.StrRef.StrCache.PtCount := cnt;
|
cat.StrRef.StrCache.PtCount := cnt;
|
||||||
for i:=0 to cnt-1 do Begin
|
for i:=0 to cnt-1 do Begin
|
||||||
|
|
@ -11245,8 +11461,8 @@ Type TTable = Class(DocObject, TTableImpl)
|
||||||
///del: bool,是否删除其它单元格内容(只保留左上单元格内容)
|
///del: bool,是否删除其它单元格内容(只保留左上单元格内容)
|
||||||
Function Merge(hCell, vCell, del);overload;
|
Function Merge(hCell, vCell, del);overload;
|
||||||
Begin
|
Begin
|
||||||
[err1, left, top] := xlsx_call("CellNameToCoordinates", hCell);
|
[err1, left, top] := CellNameToCoordinates(hCell);
|
||||||
[err2, right, bottom] := xlsx_call("CellNameToCoordinates", vCell);
|
[err2, right, bottom] := CellNameToCoordinates(vCell);
|
||||||
if err1 or err2 then
|
if err1 or err2 then
|
||||||
return 'Invalid input Coordinates.';
|
return 'Invalid input Coordinates.';
|
||||||
return Merge(top, left, bottom, right, del);
|
return Merge(top, left, bottom, right, del);
|
||||||
|
|
@ -11334,57 +11550,64 @@ Type TCoreProperties = Class(DocObject)
|
||||||
private
|
private
|
||||||
Function readAuthor();
|
Function readAuthor();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dc:creator'));
|
return propValue('dc:creator');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readCategory();
|
Function readCategory();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:category'));
|
return propValue('cp:category');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readDescription();
|
Function readDescription();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dc:description'));
|
return propValue('dc:description');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readSubject();
|
Function readSubject();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dc:subject'));
|
return propValue('dc:subject');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readTitle();
|
Function readTitle();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dc:title'));
|
return propValue('dc:title');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readVersion();
|
Function readVersion();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:version'));
|
return propValue('cp:version');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readRversion();
|
Function readRversion();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:rversion'));
|
return propValue('cp:rversion');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readKeyWords();
|
Function readKeyWords();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:keywords'));
|
return propValue('cp:keywords');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readLastModifiedBy();
|
Function readLastModifiedBy();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:lastModifiedBy'));
|
return propValue('cp:lastModifiedBy');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readCreated();
|
Function readCreated();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dcterms:created'));
|
return propValue('dcterms:created');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function readModified();
|
Function readModified();
|
||||||
Begin
|
Begin
|
||||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dcterms:modified'));
|
return propValue('dcterms:modified');
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function propValue(k);
|
||||||
|
Begin
|
||||||
|
node := class(xlsxXml).GetNode(node_, k);
|
||||||
|
if not ifObj(node) then return '';
|
||||||
|
return class(xlsxXml).Utf8ToCurCodePage( node.GetText() );
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function propNode(k);
|
Function propNode(k);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.0.4
|
// Version 1.0.5
|
||||||
|
|
||||||
Type TSDocxFile = Class
|
Type TSDocxFile = Class
|
||||||
///Version: V1.0 2022-09-20
|
///Version: V1.0 2022-09-20
|
||||||
|
|
@ -157,7 +157,6 @@ Type TSDocxFile = Class
|
||||||
return document_.Body().TextArray();
|
return document_.Body().TextArray();
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///返回:Boby对象
|
|
||||||
Function Body();
|
Function Body();
|
||||||
Begin
|
Begin
|
||||||
return document_.Body();
|
return document_.Body();
|
||||||
|
|
@ -317,38 +316,23 @@ Type TSDocxFile = Class
|
||||||
|
|
||||||
///格式刷:复制段落格式(包括字体格式)
|
///格式刷:复制段落格式(包括字体格式)
|
||||||
///fromParagraph:源段落
|
///fromParagraph:源段落
|
||||||
Function CopyFormat(fromParagraph);
|
|
||||||
Begin
|
|
||||||
selectPrargraph_ := fromParagraph;
|
|
||||||
End;
|
|
||||||
|
|
||||||
///格式刷:将源段落格式(包括字体格式),刷到目标格式
|
|
||||||
///toParagraph:目标段落
|
///toParagraph:目标段落
|
||||||
Function PasteFormat(toParagraph);
|
Function CopyFormat(fromParagraph, toParagraph);
|
||||||
Begin
|
Begin
|
||||||
pPr := ifObj(selectPrargraph_) ? selectPrargraph_.node_.FirstChildElement('w:pPr') : nil;
|
toParagraph.ClearFormat();//清除目标段落格式、字体格式
|
||||||
if not ifObj(pPr) then Begin //格式为空,清除目标段落所有格式
|
pPr := ifObj(fromParagraph) ? fromParagraph.node_.FirstChildElement('w:pPr') : nil;
|
||||||
toParagraph.ClearFormat();//清除段落格式、字体格式
|
if ifObj(pPr) then Begin //复制段落格式
|
||||||
return;
|
|
||||||
End;
|
|
||||||
rPr := pPr.node_.FirstChildElement('w:rPr');
|
|
||||||
|
|
||||||
//复制段落格式
|
|
||||||
pPr2 := toParagraph.node_.FirstChildElement('w:pPr');
|
|
||||||
if ifObj(pPr2) then
|
|
||||||
pPr2.DeleteChildren();
|
|
||||||
else
|
|
||||||
pPr2 := toParagraph.node_.InsertFirstChild('element', 'w:pPr');
|
pPr2 := toParagraph.node_.InsertFirstChild('element', 'w:pPr');
|
||||||
arr := pPr.Marshal();
|
arr := pPr.Marshal();
|
||||||
class(xlsxXml).UpdateNode(pPr2, arr[0]['attributes'], arr[0]['children']);
|
class(xlsxXml).UpdateNode(pPr2, arr[0]['attributes'], arr[0]['children']);
|
||||||
|
End;
|
||||||
//复制字体格式
|
//复制字体格式
|
||||||
if ifObj(rPr) then
|
rPr := ifObj(fromParagraph) ? class(xlsxXml).GetNode(fromParagraph.node_, 'w:r/w:rPr') : nil;
|
||||||
toParagraph.SetFormat(rPr, true);
|
if ifObj(rPr) then Begin
|
||||||
else Begin //清除字体格式
|
r := rPr.Marshal();
|
||||||
runs := toParagraph.GetRuns();
|
runs := toParagraph.GetRuns();
|
||||||
for i:=0 to length(runs)-1 do
|
for i:=0 to length(runs)-1 do
|
||||||
runs[i].ClearFormat();
|
toParagraph._copyFormat(runs[i].node_, r, false);
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
@ -380,7 +364,7 @@ Type TSDocxFile = Class
|
||||||
///返回:array((("Level":level,"Paragraph":"object","Text":title));
|
///返回:array((("Level":level,"Paragraph":"object","Text":title));
|
||||||
Function GetHeadingList(UpperHeadingLevel, LowerHeadingLevel);
|
Function GetHeadingList(UpperHeadingLevel, LowerHeadingLevel);
|
||||||
Begin
|
Begin
|
||||||
return document_.Body().GetHeadingListImpl(self, UpperHeadingLevel, LowerHeadingLevel, nil, true);
|
return document_.Body().GetHeadingListImpl(self, nil, UpperHeadingLevel, LowerHeadingLevel, nil, true);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///返回Document对象
|
///返回Document对象
|
||||||
|
|
@ -420,5 +404,4 @@ private
|
||||||
xml_; //xlsxXml对象
|
xml_; //xlsxXml对象
|
||||||
styleObj_;
|
styleObj_;
|
||||||
numberingObj_;
|
numberingObj_;
|
||||||
selectPrargraph_;//被选中的段落
|
|
||||||
End;
|
End;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.0.4
|
// Version 1.0.5
|
||||||
|
|
||||||
Type TSExcelFile = Class
|
Type TSExcelFile = Class
|
||||||
///Version: V1.0 2022-08-08
|
///Version: V1.0 2022-08-08
|
||||||
|
|
@ -38,6 +38,7 @@ Type TSExcelFile = Class
|
||||||
///返回: [err, errmsg]
|
///返回: [err, errmsg]
|
||||||
Function OpenFile(alias, fname);
|
Function OpenFile(alias, fname);
|
||||||
Begin
|
Begin
|
||||||
|
init();
|
||||||
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
|
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
|
||||||
[err, errmsg] := zipfile_.Open(alias, fname);
|
[err, errmsg] := zipfile_.Open(alias, fname);
|
||||||
if err=0 then Begin
|
if err=0 then Begin
|
||||||
|
|
@ -426,16 +427,7 @@ Type TSExcelFile = Class
|
||||||
///返回: [err, col:string, row:int],"AK47" -> return array(0, "AK", 47);
|
///返回: [err, col:string, row:int],"AK47" -> return array(0, "AK", 47);
|
||||||
Function SplitCellName(cell);
|
Function SplitCellName(cell);
|
||||||
Begin
|
Begin
|
||||||
return xlsx_call("SplitCellName", cell);
|
return SplitCellName(cell);
|
||||||
End;
|
|
||||||
|
|
||||||
///单元格坐标组合
|
|
||||||
///col: string
|
|
||||||
///row: int
|
|
||||||
///返回 [err, cell:string],参见SplitCellName
|
|
||||||
Function JoinCellName(col, row);
|
|
||||||
Begin
|
|
||||||
return xlsx_call("JoinCellName", col, row);
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///列名转索引
|
///列名转索引
|
||||||
|
|
@ -443,7 +435,7 @@ Type TSExcelFile = Class
|
||||||
///返回 [err, index:int],"AK" -> return array(0, 37);
|
///返回 [err, index:int],"AK" -> return array(0, 37);
|
||||||
Function ColumnNameToNumber(name);
|
Function ColumnNameToNumber(name);
|
||||||
Begin
|
Begin
|
||||||
return xlsx_call("ColumnNameToNumber", name);
|
return ColumnNameToNumber(name);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///索引转列名
|
///索引转列名
|
||||||
|
|
@ -451,7 +443,7 @@ Type TSExcelFile = Class
|
||||||
///返回 [err, name:string],37 -> return array(0, "AK");
|
///返回 [err, name:string],37 -> return array(0, "AK");
|
||||||
Function ColumnNumberToName(index);
|
Function ColumnNumberToName(index);
|
||||||
Begin
|
Begin
|
||||||
return xlsx_call("ColumnNumberToName", index);
|
return ColumnNumberToName(index);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///单元格坐标转索引
|
///单元格坐标转索引
|
||||||
|
|
@ -459,7 +451,7 @@ Type TSExcelFile = Class
|
||||||
///返回 [err, col:int, row: int] "A2" -> [1,2]
|
///返回 [err, col:int, row: int] "A2" -> [1,2]
|
||||||
Function CellNameToCoordinates(cell);
|
Function CellNameToCoordinates(cell);
|
||||||
Begin
|
Begin
|
||||||
return xlsx_call("CellNameToCoordinates", cell);
|
return CellNameToCoordinates(cell);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///索引转单元格坐标
|
///索引转单元格坐标
|
||||||
|
|
@ -469,27 +461,27 @@ Type TSExcelFile = Class
|
||||||
///返回 [err, cell:string] [1,2,true] -> "$A$2"
|
///返回 [err, cell:string] [1,2,true] -> "$A$2"
|
||||||
Function CoordinatesToCellName(col, row, abs);
|
Function CoordinatesToCellName(col, row, abs);
|
||||||
Begin
|
Begin
|
||||||
return xlsx_call("CoordinatesToCellName", col, row, abs);
|
return CoordinatesToCellName(col, row, abs);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///RGB与HSL色彩空间色值转换
|
///RGB与HSL色彩空间色值转换
|
||||||
///r: int
|
///r: int
|
||||||
///g: int
|
///g: int
|
||||||
///b: int
|
///b: int
|
||||||
///返回: [err, h:double, s:double, l:double]
|
///返回: [h:double, s:double, l:double]
|
||||||
Function RGBToHSL(r, g, b);
|
Function RGBToHSL(r, g, b);
|
||||||
Begin
|
Begin
|
||||||
return xlsx_call("RGBToHSL", r, g, b);
|
return RGBToHSL(r, g, b);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///HSL与RGB色彩空间色值转换
|
///HSL与RGB色彩空间色值转换
|
||||||
///h: double
|
///h: double
|
||||||
///s: double
|
///s: double
|
||||||
///l: double
|
///l: double
|
||||||
///返回: [err, r:int, g:int, b:int]
|
///返回: [r:int, g:int, b:int]
|
||||||
Function HSLToRGB(sheet, h, s, l);
|
Function HSLToRGB(h, s, l);
|
||||||
Begin
|
Begin
|
||||||
return xlsx_call("HSLToRGB", h, s, l);
|
return HSLToRGB(h, s, l);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///新建样式对象
|
///新建样式对象
|
||||||
|
|
|
||||||
|
|
@ -247,8 +247,8 @@ Type xlsxXml = Class
|
||||||
|
|
||||||
class Function GetWorkSheetPrevNode(workNode, nodeName);
|
class Function GetWorkSheetPrevNode(workNode, nodeName);
|
||||||
Begin
|
Begin
|
||||||
order_arr := array('dimension', 'sheetViews', 'sheetFormatPr', 'cols', 'sheetData', 'phoneticPr',
|
order_arr := array('dimension', 'sheetViews', 'sheetFormatPr', 'cols', 'sheetData', 'mergeCells', 'phoneticPr',
|
||||||
'pageMargins', 'headerFooter', 'pageSetup', 'rowBreaks', 'colBreaks', 'drawing', 'legacyDrawing', 'picture');
|
'hyperlinks', 'pageMargins', 'headerFooter', 'pageSetup', 'rowBreaks', 'colBreaks', 'drawing', 'legacyDrawing', 'picture');
|
||||||
for i:=0 to length(order_arr)-1 do
|
for i:=0 to length(order_arr)-1 do
|
||||||
begin
|
begin
|
||||||
if order_arr[i] = nodeName then return prev;
|
if order_arr[i] = nodeName then return prev;
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ Type TNumbering = Class
|
||||||
Function _setNsId(o);
|
Function _setNsId(o);
|
||||||
Begin
|
Begin
|
||||||
v := RandomRange(1000000000,2000000000);
|
v := RandomRange(1000000000,2000000000);
|
||||||
id := xlsx_call('tohex',v);
|
id := tohex(v);
|
||||||
if hash_[id] then
|
if hash_[id] then
|
||||||
return _setNsId(o);
|
return _setNsId(o);
|
||||||
hash_[id] := 1;
|
hash_[id] := 1;
|
||||||
|
|
|
||||||
|
|
@ -17,16 +17,8 @@ Type xlsxHyperLink = Class
|
||||||
work_node := xmlFile_.FirstChildElement('worksheet');
|
work_node := xmlFile_.FirstChildElement('worksheet');
|
||||||
hyperlinks := work_node.FirstChildElement('hyperlinks');
|
hyperlinks := work_node.FirstChildElement('hyperlinks');
|
||||||
if not ifObj(hyperlinks) then begin
|
if not ifObj(hyperlinks) then begin
|
||||||
arr := array('phoneticPr', 'mergeCells', 'sheetData');
|
insert_node := class(xlsxXml).GetWorkSheetPrevNode(work_node, 'hyperlinks');
|
||||||
for i:=0 to length(arr)-1 do
|
|
||||||
begin
|
|
||||||
insert_node := work_node.FirstChildElement(arr[i]);
|
|
||||||
if ifObj(insert_node) then
|
|
||||||
begin
|
|
||||||
hyperlinks := work_node.InsertAfterChild(insert_node, 'element', 'hyperlinks');
|
hyperlinks := work_node.InsertAfterChild(insert_node, 'element', 'hyperlinks');
|
||||||
break;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end;
|
end;
|
||||||
node := hyperlinks.FirstChildElement('hyperlink');
|
node := hyperlinks.FirstChildElement('hyperlink');
|
||||||
while ifObj(node) do begin
|
while ifObj(node) do begin
|
||||||
|
|
@ -38,11 +30,14 @@ Type xlsxHyperLink = Class
|
||||||
node := node.NextElement();
|
node := node.NextElement();
|
||||||
end;
|
end;
|
||||||
hyperlink.Axis := axis;
|
hyperlink.Axis := axis;
|
||||||
marshal := hyperlink.Marshal();
|
if hyperlink.LinkType = "location" then
|
||||||
attrs := marshal['attributes'];
|
begin
|
||||||
if attrs['linkType'] = "Location" then reindex(attrs, array('linkType': nil, 'linkUrl': 'location'));
|
hyperlink.LinkType := nil;
|
||||||
else if attrs['linkType'] = "External" then
|
hyperlink.Location := hyperlink.LinkUrl;
|
||||||
Begin
|
hyperlink.LinkUrl := nil;
|
||||||
|
end
|
||||||
|
else if hyperlink.LinkType = 'external' then
|
||||||
|
begin
|
||||||
[rid, commentFileName, sheetFileName, relsfile] := file_.WorkBook().GetRelationshipRid(sheetName_, hyperlink.LinkUrl);
|
[rid, commentFileName, sheetFileName, relsfile] := file_.WorkBook().GetRelationshipRid(sheetName_, hyperlink.LinkUrl);
|
||||||
if commentFileName = "" then
|
if commentFileName = "" then
|
||||||
Begin
|
Begin
|
||||||
|
|
@ -51,11 +46,9 @@ Type xlsxHyperLink = Class
|
||||||
xmlfile := file_.WorkBook().GetXmlFileObj(relsfile);
|
xmlfile := file_.WorkBook().GetXmlFileObj(relsfile);
|
||||||
class(xlsxXml).AddRelationshipRid(xmlfile, hyperlink.LinkUrl, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", ridstr, "External");
|
class(xlsxXml).AddRelationshipRid(xmlfile, hyperlink.LinkUrl, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", ridstr, "External");
|
||||||
End
|
End
|
||||||
reindex(attrs, array('linkType': nil, 'linkUrl': nil));
|
hyperlink.RId := 'rId' + inttostr(rid);
|
||||||
attrs['r:id'] := 'rId' + inttostr(rid);
|
end
|
||||||
End
|
hyperlinks.InsertEndChild(hyperlink.marshal());
|
||||||
marshal['attributes'] := attrs;
|
|
||||||
hyperlinks.InsertEndChild(marshal);
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetCellHyperLink(axis);
|
Function GetCellHyperLink(axis);
|
||||||
|
|
@ -68,7 +61,20 @@ Type xlsxHyperLink = Class
|
||||||
ref := node.GetAttribute('ref');
|
ref := node.GetAttribute('ref');
|
||||||
if ref = axis then
|
if ref = axis then
|
||||||
begin
|
begin
|
||||||
link.RootObj := node;
|
location := node.GetAttribute('location');
|
||||||
|
if location then
|
||||||
|
begin
|
||||||
|
link.LinkUrl := location;
|
||||||
|
link.LinkType := 'location';
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
link.LinkType := 'external';
|
||||||
|
rid := node.GetAttribute('r:id');
|
||||||
|
rels_file := file_.WorkBook().GetSheetRelsFile(sheetName_);
|
||||||
|
target_node := class(xlsxXml).FindRelationship(rels_file, rid);
|
||||||
|
if ifObj(target_node) then link.LinkUrl := target_node.GetAttribute('Target');
|
||||||
|
end
|
||||||
|
link.Tooltip := node.GetAttribute('tooltip');
|
||||||
break;
|
break;
|
||||||
end
|
end
|
||||||
node := node.NextElement();
|
node := node.NextElement();
|
||||||
|
|
|
||||||
|
|
@ -190,9 +190,6 @@ Type xlsxWorkBook = Class
|
||||||
SetDefaultSheet(sheet);
|
SetDefaultSheet(sheet);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
///删除sheet
|
|
||||||
///sheet: string,工作表名称
|
|
||||||
///返回: [err, info]
|
|
||||||
Function DeleteSheet(sheet);
|
Function DeleteSheet(sheet);
|
||||||
Begin
|
Begin
|
||||||
if sheetsCount_ <= 1 then return 'Cant not delete the last sheet.';
|
if sheetsCount_ <= 1 then return 'Cant not delete the last sheet.';
|
||||||
|
|
@ -477,7 +474,7 @@ Type xlsxWorkBook = Class
|
||||||
is_exists := sheet_obj.RowIsExists(row);
|
is_exists := sheet_obj.RowIsExists(row);
|
||||||
if not is_exists then
|
if not is_exists then
|
||||||
begin
|
begin
|
||||||
[err, cell] := xlsx_call("CoordinatesToCellName", 1, row);
|
[err, cell] := CoordinatesToCellName(1, row);
|
||||||
sheet_obj.SetCellValue(cell, '');
|
sheet_obj.SetCellValue(cell, '');
|
||||||
end
|
end
|
||||||
sheet_obj.SetAttribute(row, array("hidden": hidden));
|
sheet_obj.SetAttribute(row, array("hidden": hidden));
|
||||||
|
|
@ -564,7 +561,7 @@ Type xlsxWorkBook = Class
|
||||||
Function SetRowHeight(sheet, row, height);
|
Function SetRowHeight(sheet, row, height);
|
||||||
Begin
|
Begin
|
||||||
obj := GetSheetObj(sheet);
|
obj := GetSheetObj(sheet);
|
||||||
axis := xlsx_call("CoordinatesToCellName", 1, row, False)[1];
|
axis := CoordinatesToCellName(1, row, False)[1];
|
||||||
if not obj.CellIsExists(axis) then
|
if not obj.CellIsExists(axis) then
|
||||||
begin
|
begin
|
||||||
obj.SetCellValue(axis, '', array('t': 's'));
|
obj.SetCellValue(axis, '', array('t': 's'));
|
||||||
|
|
@ -585,8 +582,8 @@ Type xlsxWorkBook = Class
|
||||||
|
|
||||||
Function SetColWidth(sheet, startCol, endCol, width);
|
Function SetColWidth(sheet, startCol, endCol, width);
|
||||||
Begin
|
Begin
|
||||||
startCol := xlsx_call('ColumnNameToNumber', startCol)[1];
|
startCol := ColumnNameToNumber(startCol)[1];
|
||||||
endCol := xlsx_call('ColumnNameToNumber', endCol)[1];
|
endCol := ColumnNameToNumber(endCol)[1];
|
||||||
if startCol > endCol then return;
|
if startCol > endCol then return;
|
||||||
sheet_xml_file := GetSheetXmlFile(sheet);
|
sheet_xml_file := GetSheetXmlFile(sheet);
|
||||||
work_node := sheet_xml_file.FirstChildElement('worksheet');
|
work_node := sheet_xml_file.FirstChildElement('worksheet');
|
||||||
|
|
@ -633,7 +630,7 @@ Type xlsxWorkBook = Class
|
||||||
default_width := trystrtofloat(default_width, r) ? r: -1;
|
default_width := trystrtofloat(default_width, r) ? r: -1;
|
||||||
if not ifObj(col_node) then return array(0, default_width);
|
if not ifObj(col_node) then return array(0, default_width);
|
||||||
|
|
||||||
col := xlsx_call('ColumnNameToNumber', col)[1];
|
col := ColumnNameToNumber(col)[1];
|
||||||
node := col_node.FirstChildElement('col');
|
node := col_node.FirstChildElement('col');
|
||||||
while ifObj(node) do
|
while ifObj(node) do
|
||||||
Begin
|
Begin
|
||||||
|
|
@ -684,18 +681,18 @@ Type xlsxWorkBook = Class
|
||||||
count := trystrtoint(merge_node.GetAttribute('count'), r) ? r : 0;
|
count := trystrtoint(merge_node.GetAttribute('count'), r) ? r : 0;
|
||||||
end
|
end
|
||||||
node := merge_node.FirstChildElement('mergeCell');
|
node := merge_node.FirstChildElement('mergeCell');
|
||||||
hcell_ := xlsx_call('SplitCellName', hcell);
|
hcell_ := SplitCellName(hcell);
|
||||||
vcell_ := xlsx_call('SplitCellName', vcell);
|
vcell_ := SplitCellName(vcell);
|
||||||
hcell_int := xlsx_call('ColumnNameToNumber', hcell_[1])[1];
|
hcell_int := ColumnNameToNumber(hcell_[1])[1];
|
||||||
vcell_int := xlsx_call('ColumnNameToNumber', vcell_[1])[1];
|
vcell_int := ColumnNameToNumber(vcell_[1])[1];
|
||||||
while ifObj(node) do
|
while ifObj(node) do
|
||||||
Begin
|
Begin
|
||||||
ref := node.GetAttribute('ref');
|
ref := node.GetAttribute('ref');
|
||||||
position := pos(':', ref);
|
position := pos(':', ref);
|
||||||
cell1 := xlsx_call('SplitCellName', ref[1:position-1]);
|
cell1 := SplitCellName(ref[1:position-1]);
|
||||||
cell2 := xlsx_call('SplitCellName', ref[position+1:]);
|
cell2 := SplitCellName(ref[position+1:]);
|
||||||
cell1_int := xlsx_call('ColumnNameToNumber', cell1[1])[1];
|
cell1_int := ColumnNameToNumber(cell1[1])[1];
|
||||||
cell2_int := xlsx_call('ColumnNameToNumber', cell2[1])[1];
|
cell2_int := ColumnNameToNumber(cell2[1])[1];
|
||||||
if (hcell_[2] >= cell1[2] and hcell_[2] <= cell2[2] and hcell_int >= cell1_int and hcell_int <= cell2_int)
|
if (hcell_[2] >= cell1[2] and hcell_[2] <= cell2[2] and hcell_int >= cell1_int and hcell_int <= cell2_int)
|
||||||
or (vcell_[2] >= cell1[2] and vcell_[2] <= cell2[2] and vcell_int >= cell1_int and vcell_int <= cell2_int)
|
or (vcell_[2] >= cell1[2] and vcell_[2] <= cell2[2] and vcell_int >= cell1_int and vcell_int <= cell2_int)
|
||||||
then Begin
|
then Begin
|
||||||
|
|
@ -725,14 +722,14 @@ Type xlsxWorkBook = Class
|
||||||
node := merge_node.FirstChildElement('mergeCell');
|
node := merge_node.FirstChildElement('mergeCell');
|
||||||
if not ifObj(node) then return '';
|
if not ifObj(node) then return '';
|
||||||
count := trystrtoint(merge_node.GetAttribute('count'), r) ? r : 0;
|
count := trystrtoint(merge_node.GetAttribute('count'), r) ? r : 0;
|
||||||
hcell_ := xlsx_call('SplitCellName', hcell);
|
hcell_ := SplitCellName(hcell);
|
||||||
vcell_ := xlsx_call('SplitCellName', vcell);
|
vcell_ := SplitCellName(vcell);
|
||||||
while ifObj(node) do
|
while ifObj(node) do
|
||||||
Begin
|
Begin
|
||||||
ref := node.GetAttribute('ref');
|
ref := node.GetAttribute('ref');
|
||||||
position := pos(':', ref);
|
position := pos(':', ref);
|
||||||
cell1 := xlsx_call('SplitCellName', ref[1:position-1]);
|
cell1 := SplitCellName(ref[1:position-1]);
|
||||||
cell2 := xlsx_call('SplitCellName', ref[position+1:]);
|
cell2 := SplitCellName(ref[position+1:]);
|
||||||
if ref[1:position-1] = hcell and ref[position+1:] = vcell
|
if ref[1:position-1] = hcell and ref[position+1:] = vcell
|
||||||
then Begin
|
then Begin
|
||||||
merge_node.DeleteChild(node);
|
merge_node.DeleteChild(node);
|
||||||
|
|
@ -986,7 +983,7 @@ private
|
||||||
sr := inttostr(r);
|
sr := inttostr(r);
|
||||||
for i:=c1 to c2 do
|
for i:=c1 to c2 do
|
||||||
Begin
|
Begin
|
||||||
name := xlsx_call('ColumnNumberToName', i);
|
name := ColumnNumberToName(i);
|
||||||
if not name[0] then name := name[1];
|
if not name[0] then name := name[1];
|
||||||
name += sr;
|
name += sr;
|
||||||
arr union= array(('type': 'element', 'name': 'r', 'attributes': ('r': name, 's': '1')));
|
arr union= array(('type': 'element', 'name': 'r', 'attributes': ('r': name, 's': '1')));
|
||||||
|
|
|
||||||
29
更新日志.md
29
更新日志.md
|
|
@ -1,12 +1,33 @@
|
||||||
# 2022-12-30
|
# 更新日志
|
||||||
|
|
||||||
## V1.0.4
|
## 2023-1-5
|
||||||
|
|
||||||
### word
|
### V1.0.5
|
||||||
|
|
||||||
|
❗ 部署方式发生变化,简化了环境部署,详见项目[README](./README.md)
|
||||||
|
|
||||||
|
#### word
|
||||||
|
|
||||||
|
1. 修复 Properties执行报错
|
||||||
|
2. 修复格式刷
|
||||||
|
|
||||||
|
#### excel
|
||||||
|
|
||||||
|
1. 移除API `JoinCellName`
|
||||||
|
2. 修改`RGBToHSL`与`HSLToRGB`返回值
|
||||||
|
3. 修复获取超链接`GetCellHyperLink`失败问题
|
||||||
|
4. 修复一个对象新建文件,打开文件之后引发的xlsx文件错误问题
|
||||||
|
5. 修复`GetCoreProps`,`GetAppProps`失败问题
|
||||||
|
|
||||||
|
## 2022-12-30
|
||||||
|
|
||||||
|
### V1.0.4
|
||||||
|
|
||||||
|
#### word
|
||||||
|
|
||||||
1. 初步支持中文
|
1. 初步支持中文
|
||||||
|
|
||||||
### excel
|
#### excel
|
||||||
|
|
||||||
1. 初步支持中文
|
1. 初步支持中文
|
||||||
2. `SetSheetName`,`NewSheet` 返回值不再是`[err, errinfo]`
|
2. `SetSheetName`,`NewSheet` 返回值不再是`[err, errinfo]`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue