v1.4.7
This commit is contained in:
parent
5f1064794d
commit
d72d88d68a
|
|
@ -1,4 +1,4 @@
|
|||
// Version 1.4.6
|
||||
// Version 1.4.7
|
||||
|
||||
Function TOfficeObj(n);
|
||||
Begin
|
||||
|
|
@ -13922,25 +13922,21 @@ Type TDocumentBody = Class(DocObject)
|
|||
p := new TParagraph(pNode);
|
||||
//统计数字项目编号
|
||||
numArr := array();
|
||||
ilvl := -1;
|
||||
numId := '';
|
||||
numId := getNumPr('numId', docx, p);
|
||||
ilvl := getNumPr('Level', docx, p);
|
||||
if not ilvl then ilvl := 0;
|
||||
if ifarray(numIds) then Begin
|
||||
sectPr.Append(p);
|
||||
numId := p.Format.NumPr.Value('numId');
|
||||
lvlStr := p.Format.NumPr.Value('Level');
|
||||
if not ifnil(numId) and not ifnil(lvlStr) then Begin
|
||||
ilvl := Class(TSXml).SafeStrToIntDef(lvlStr, -1);
|
||||
if ilvl >= 0 and ilvl < 10 then Begin
|
||||
if not istable(numIds[numId]) then
|
||||
numIds[numId] := array(0,0,0,0,0,0,0,0,0,0);
|
||||
prev := numIds[numId, ilvl];
|
||||
if prev then Begin
|
||||
for i:=ilvl+1 to 9 do
|
||||
numIds[numId, i] := 0;
|
||||
End;
|
||||
numIds[numId, ilvl]++;
|
||||
numArr := numIds[numId];
|
||||
if ilvl >= 0 and ilvl < 10 then Begin
|
||||
if not istable(numIds[numId]) then
|
||||
numIds[numId] := array(0,0,0,0,0,0,0,0,0,0);
|
||||
prev := numIds[numId, ilvl];
|
||||
if prev then Begin
|
||||
for i:=ilvl+1 to 9 do
|
||||
numIds[numId, i] := 0;
|
||||
End;
|
||||
numIds[numId, ilvl]++;
|
||||
numArr := numIds[numId];
|
||||
End;
|
||||
End;
|
||||
if bHeadList then Begin //统计大纲显示(目录)
|
||||
|
|
@ -13948,7 +13944,7 @@ Type TDocumentBody = Class(DocObject)
|
|||
if styleId <> '' then Begin
|
||||
obj := docx.StyleObject().GetStyleById(styleId);
|
||||
if ifObj(obj) then Begin
|
||||
level := obj.HeadingLevel();
|
||||
level := getHeadingLevel(docx, obj);
|
||||
iLevel := Class(TSXml).SafeStrToIntDef(level, -1);
|
||||
if p.Text() <> "" and iLevel+1 >= UpperHeadingLevel and iLevel+1 <= LowerHeadingLevel then Begin
|
||||
r[ind]['Level'] := strtoint(level);
|
||||
|
|
@ -13988,6 +13984,40 @@ Type TDocumentBody = Class(DocObject)
|
|||
End;
|
||||
return r;
|
||||
End;
|
||||
|
||||
Function getNumPr(field, docx, p);
|
||||
Begin
|
||||
value := p.Format.NumPr.Value(field);
|
||||
if value then return value;
|
||||
styleId := p.Format.Value('StyleId', 1);
|
||||
return getFieldByStyle(field, docx, docx.StyleObject().GetStyleById(styleid));
|
||||
End;
|
||||
|
||||
Function getFieldByStyle(field, docx, obj);
|
||||
Begin
|
||||
if not ifObj(obj) then return '';
|
||||
numId := obj.pPr.numPr.Value(field);
|
||||
if numId = '' then
|
||||
begin
|
||||
id := o.Value('BasedOn');
|
||||
return getNumIdByStyle(docx, docx.StyleObject().GetStyleById(id));
|
||||
end
|
||||
return numId;
|
||||
End;
|
||||
|
||||
Function getHeadingLevel(docx, obj);
|
||||
Begin
|
||||
if not ifObj(obj) then return '';
|
||||
o := obj;
|
||||
level := obj.HeadingLevel();
|
||||
if level = '' then
|
||||
begin
|
||||
id := o.Value('BasedOn');
|
||||
return getHeadingLevel(docx, docx.StyleObject().GetStyleById(id));
|
||||
end
|
||||
return level;
|
||||
End;
|
||||
|
||||
|
||||
Function getPictureMaxId();
|
||||
Begin
|
||||
|
|
@ -14661,7 +14691,7 @@ Type TTable = Class(DocObject, TTableImpl)
|
|||
cellObj.mergeSpan_ := c[1];
|
||||
return cellObj;
|
||||
End;
|
||||
|
||||
|
||||
///设置列宽
|
||||
Function ColumnWidth(n, wth);
|
||||
Begin
|
||||
|
|
@ -15314,4 +15344,3 @@ Begin
|
|||
return true;
|
||||
return false;
|
||||
End;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Version 1.4.6
|
||||
// Version 1.4.7
|
||||
|
||||
Type TSDocxFile = Class
|
||||
///Version: V1.0 2022-09-20
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Version 1.4.6
|
||||
// Version 1.4.7
|
||||
|
||||
Type TSExcelFile = Class
|
||||
///Version: V1.0 2022-08-08
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Type TTableContent = class
|
|||
Begin
|
||||
Create(docx, nil);
|
||||
End;
|
||||
|
||||
|
||||
Function Create(docx, node);overload;
|
||||
Begin
|
||||
node_ := node;
|
||||
|
|
@ -15,7 +15,7 @@ Type TTableContent = class
|
|||
//contentType := docx.Zip().Get('[Content_Types].xml');
|
||||
//class(TSXml).AddOverrideContentType(contentType, 'wmf', 'image/x-wmf');
|
||||
End;
|
||||
|
||||
|
||||
Function SetDefaultFormat();
|
||||
Begin
|
||||
defultFont := impl_.sdtPr.rPr;
|
||||
|
|
@ -39,7 +39,7 @@ Type TTableContent = class
|
|||
//impl_.sdtEndPr.rPr.SzCs := 22;
|
||||
impl_.sdtEndPr.rPr.Bold := true;
|
||||
End;
|
||||
|
||||
|
||||
///应用目录样式
|
||||
Function Apply(); override;
|
||||
Begin
|
||||
|
|
@ -50,7 +50,7 @@ Type TTableContent = class
|
|||
arr := tmp_impl.Marshal();
|
||||
class(TSXml).UpdateNode(node_, arr['attributes'], arr['children']);
|
||||
End;
|
||||
|
||||
|
||||
///添加目录条目
|
||||
///UpperHeadingLevel:标题最高级别
|
||||
///LowerHeadingLevel:标题最低级别
|
||||
|
|
@ -79,26 +79,26 @@ Type TTableContent = class
|
|||
//mParagraph.Run.rPr.Size := 21/2;
|
||||
//mParagraph.Run.rPr.Bold := true;
|
||||
_AddStdContent(mParagraph);
|
||||
|
||||
|
||||
goback := TOfficeObj('TParagraph');
|
||||
id := docx_.Document().GetBookMarkID();
|
||||
goback.MarkStart.Name := '_GoBack';
|
||||
goback.MarkStart.ID := id;
|
||||
goback.MarkEnd.ID := id;
|
||||
//_AddStdContent(goback);
|
||||
|
||||
|
||||
//缺省目录,需要word或wps打开后,更新目录
|
||||
//_AddDefaultTableContent(UpperHeadingLevel, LowerHeadingLevel);
|
||||
|
||||
|
||||
//自定义页码计算与word、wps有差异,不推荐使用
|
||||
_AddTableContent(posOpt, UpperHeadingLevel, LowerHeadingLevel);
|
||||
End;
|
||||
|
||||
|
||||
Function _AddDefaultTableContent(UpperHeadingLevel, LowerHeadingLevel);
|
||||
Begin
|
||||
p := _AddItem(UpperHeadingLevel, LowerHeadingLevel, UpperHeadingLevel - 1, true);
|
||||
_AddStdContent(p);
|
||||
|
||||
|
||||
p2 := TOfficeObj('TParagraph');
|
||||
//p2.Format.SpaceAfter := 0;
|
||||
run := p2.AddRun();
|
||||
|
|
@ -107,7 +107,7 @@ Type TTableContent = class
|
|||
run.fldCharType := 'end';
|
||||
_AddStdContent(p2);
|
||||
End;
|
||||
|
||||
|
||||
Function _AddItem(UpperHeadingLevel, LowerHeadingLevel, level, first);
|
||||
Begin
|
||||
p := TOfficeObj('TParagraph');
|
||||
|
|
@ -160,9 +160,9 @@ Type TTableContent = class
|
|||
if ifObj(style) then
|
||||
numStr := style.GetText(r[i]['ilvl'], r[i]['numArr']);
|
||||
End
|
||||
if numStr <> '' then run_t := numStr + ' ' + r[i]['Text'];
|
||||
else run_t := r[i]['Text'];
|
||||
r1.SetText(run_t);
|
||||
run_t := class(TSXml).CurCodePageToUtf8(r[i]['Text']);
|
||||
if numStr <> '' then run_t := numStr + ' ' + run_t;
|
||||
r1.SetText(run_t, 1);
|
||||
|
||||
r2 := h.AddRun();
|
||||
r2.rPr.noProof := true;
|
||||
|
|
@ -203,7 +203,6 @@ Type TTableContent = class
|
|||
r8.fldCharType := 'end';
|
||||
|
||||
_AddStdContent(p);
|
||||
|
||||
End;
|
||||
|
||||
p2 := TOfficeObj('TParagraph');
|
||||
|
|
@ -215,7 +214,7 @@ Type TTableContent = class
|
|||
_AddStdContent(p2);
|
||||
|
||||
End;
|
||||
|
||||
|
||||
///更新目录
|
||||
Function UpdatePageNumbers();
|
||||
Begin
|
||||
|
|
@ -240,24 +239,24 @@ Type TTableContent = class
|
|||
end
|
||||
return r;
|
||||
End;
|
||||
|
||||
|
||||
Function Marshal();
|
||||
Begin
|
||||
return impl_.Marshal();
|
||||
End;
|
||||
|
||||
|
||||
Property Format read readFormat;
|
||||
Function readFormat();
|
||||
Begin
|
||||
return impl_.sdtPr;
|
||||
End;
|
||||
|
||||
|
||||
Property EndFormat read readEndFormat;
|
||||
Function readEndFormat();
|
||||
Begin
|
||||
return impl_.sdtEndPr;
|
||||
End;
|
||||
|
||||
|
||||
Property Font read readFont;
|
||||
Function readFont();
|
||||
Begin
|
||||
|
|
@ -268,7 +267,7 @@ Type TTableContent = class
|
|||
Begin
|
||||
impl_.SdtContent.NewChildNode( array("field":"", "name":"w:p", "obj":o, "attrEx":"", "nodeType":"") );
|
||||
End;
|
||||
|
||||
|
||||
Function _GetStyle(level);
|
||||
Begin
|
||||
styleName := ifstring(level) ? level : 'TOC' $ (level + 1);
|
||||
|
|
@ -278,30 +277,30 @@ Type TTableContent = class
|
|||
End;
|
||||
return style.StyleId;
|
||||
End;
|
||||
|
||||
|
||||
Function _GetBookMarkId(p);
|
||||
Begin
|
||||
node := p.node_.FirstChildElement('w:bookmarkStart');
|
||||
if ifObj(node) then
|
||||
if ifObj(node) then
|
||||
return node.GetAttribute('w:name');
|
||||
bookMarkID := docx_.Document().GetBookMarkID();
|
||||
return p.AddBookMark();
|
||||
End;
|
||||
|
||||
|
||||
Function _CheckNodes(name);
|
||||
Begin
|
||||
z := docx_.Zip();
|
||||
xml := z.Get('word/' + name);
|
||||
if not ifObj(xml) then Begin
|
||||
xmlData := TOfficeTemplate(name);
|
||||
if not ifString(xmlData) then
|
||||
if not ifString(xmlData) then
|
||||
return ;
|
||||
z.Add('word/' + name, xmlData);
|
||||
rels := 'word/_rels/document.xml.rels';
|
||||
relsObj := z.Get(rels);
|
||||
[rId, target] := class(TSXml).FindRelationshipRid(relsObj, '');
|
||||
rId ++;
|
||||
|
||||
|
||||
if name = 'endnotes.xml' then Begin
|
||||
class(TSXml).AddRelationshipRid(relsObj, name, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes', 'rId' $ rId);
|
||||
contentType := z.Get('[Content_Types].xml');
|
||||
|
|
@ -314,7 +313,7 @@ Type TTableContent = class
|
|||
End;
|
||||
End;
|
||||
End;
|
||||
|
||||
|
||||
docx_;
|
||||
node_;
|
||||
impl_;
|
||||
|
|
|
|||
60
更新日志.md
60
更新日志.md
|
|
@ -1,5 +1,13 @@
|
|||
# 更新日志
|
||||
|
||||
## 2023-9-22
|
||||
|
||||
### V1.4.7
|
||||
|
||||
#### word
|
||||
|
||||
1. 修复项目符号属于样式时,生成目录无法识别出项目符号问题
|
||||
|
||||
## 2023-9-19
|
||||
|
||||
### V1.4.6
|
||||
|
|
@ -7,8 +15,8 @@
|
|||
#### word
|
||||
|
||||
1. 修复表格存在合并单元格,生成目录报错问题
|
||||
2. 修复单元格添加run对象,设置样式不生效问题
|
||||
3. 修复插入word后,中文样式重复问题
|
||||
2. 修复单元格添加 run 对象,设置样式不生效问题
|
||||
3. 修复插入 word 后,中文样式重复问题
|
||||
|
||||
### excel
|
||||
|
||||
|
|
@ -18,7 +26,7 @@
|
|||
|
||||
#### excel
|
||||
|
||||
1. 修复`NewSheet`excel打开遇到提示错误问题
|
||||
1. 修复`NewSheet`excel 打开遇到提示错误问题
|
||||
|
||||
## 2023-8-30
|
||||
|
||||
|
|
@ -30,7 +38,7 @@
|
|||
|
||||
#### excel
|
||||
|
||||
1. 修复`NewSheet`excel打开遇到提示错误问题
|
||||
1. 修复`NewSheet`excel 打开遇到提示错误问题
|
||||
|
||||
## 2023-8-28
|
||||
|
||||
|
|
@ -40,7 +48,7 @@
|
|||
|
||||
1. 修复`insertFile`样式错误问题
|
||||
2. 修复`insertFile`后删除段落再新增段落位置错误问题
|
||||
3. 修复生成目录中文编码未转换导致word打开失败问题
|
||||
3. 修复生成目录中文编码未转换导致 word 打开失败问题
|
||||
|
||||
## 2023-8-22
|
||||
|
||||
|
|
@ -56,7 +64,7 @@
|
|||
|
||||
#### word
|
||||
|
||||
支持插入另一个word内容`InsertFile(alias, fileName, posOpt)`
|
||||
支持插入另一个 word 内容`InsertFile(alias, fileName, posOpt)`
|
||||
|
||||
## 2023-8-11
|
||||
|
||||
|
|
@ -64,7 +72,7 @@
|
|||
|
||||
#### word
|
||||
|
||||
修复插入表格后,设置样式ID无法全部生效问题
|
||||
修复插入表格后,设置样式 ID 无法全部生效问题
|
||||
|
||||
## 2023-8-10
|
||||
|
||||
|
|
@ -72,7 +80,7 @@
|
|||
|
||||
#### word
|
||||
|
||||
支持三级以内目录设置字体,一级目录样式ID为`TOC1`,二级目录样式ID为`TOC2`,三级为`TOC3`,通过样式设置相关属性即可修改目录字体
|
||||
支持三级以内目录设置字体,一级目录样式 ID 为`TOC1`,二级目录样式 ID 为`TOC2`,三级为`TOC3`,通过样式设置相关属性即可修改目录字体
|
||||
|
||||
## 2023-8-7
|
||||
|
||||
|
|
@ -80,7 +88,7 @@
|
|||
|
||||
#### word
|
||||
|
||||
支持`AddHeading`时传入样式Id
|
||||
支持`AddHeading`时传入样式 Id
|
||||
|
||||
## 2023-8-2
|
||||
|
||||
|
|
@ -112,13 +120,13 @@
|
|||
|
||||
#### word
|
||||
|
||||
段落字体大小设置调整,对齐VBA设置
|
||||
段落字体大小设置调整,对齐 VBA 设置
|
||||
|
||||
## 2023-7-11
|
||||
|
||||
### V1.3.4
|
||||
|
||||
修复加密Bug
|
||||
修复加密 Bug
|
||||
|
||||
## 2023-7-4
|
||||
|
||||
|
|
@ -130,11 +138,11 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
|
||||
### V1.3.2
|
||||
|
||||
修复.net使用rdo2执行失败问题,使用rdo2时候,需调用`TOfficeInit()`初始化
|
||||
修复.net 使用 rdo2 执行失败问题,使用 rdo2 时候,需调用`TOfficeInit()`初始化
|
||||
|
||||
#### word
|
||||
|
||||
1. 修复word模板`template.docx`执行失败问题
|
||||
1. 修复 word 模板`template.docx`执行失败问题
|
||||
|
||||
## 2023-6-20
|
||||
|
||||
|
|
@ -154,7 +162,7 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
|
||||
#### excel
|
||||
|
||||
1. 支持excel程序设置字体样式粗体,斜体等此类问题的返回类型,如`style.Font.Bold`返回`true 或 false`
|
||||
1. 支持 excel 程序设置字体样式粗体,斜体等此类问题的返回类型,如`style.Font.Bold`返回`true 或 false`
|
||||
|
||||
## 2023-4-4
|
||||
|
||||
|
|
@ -170,7 +178,7 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
|
||||
#### excel
|
||||
|
||||
1. 修复由.net客户端导出的excel兼容性问题,`SetColWidth`、`Set/GetDefaultSheet`、`SetSheetHeaderFooter`
|
||||
1. 修复由.net 客户端导出的 excel 兼容性问题,`SetColWidth`、`Set/GetDefaultSheet`、`SetSheetHeaderFooter`
|
||||
|
||||
## 2023-3-23
|
||||
|
||||
|
|
@ -239,7 +247,7 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
|
||||
#### excel
|
||||
|
||||
1. Get相关方法重新Set后不再覆盖原有设置,影响方法如下`Set(Get)PageMargins`,`Set(Get)CellHyperLink`,`Set(Get)PageLayout`,`Set(Get)CalcOptions`,`Set(Get)DefaultFont`,`Set(Get)SheetViewOptions`
|
||||
1. Get 相关方法重新 Set 后不再覆盖原有设置,影响方法如下`Set(Get)PageMargins`,`Set(Get)CellHyperLink`,`Set(Get)PageLayout`,`Set(Get)CalcOptions`,`Set(Get)DefaultFont`,`Set(Get)SheetViewOptions`
|
||||
|
||||
## 2023-2-23
|
||||
|
||||
|
|
@ -276,7 +284,7 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
1. 新增`LoadFromMem`, `SavaToMem`
|
||||
2. 新增重载方法`NewSheet`
|
||||
3. 新增`SetCalcOptions`
|
||||
4. 修复删除sheet报错问题
|
||||
4. 修复删除 sheet 报错问题
|
||||
|
||||
## 2023-2-13
|
||||
|
||||
|
|
@ -312,7 +320,7 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
|
||||
#### word
|
||||
|
||||
1. 修复获取段落样式ID失败问题
|
||||
1. 修复获取段落样式 ID 失败问题
|
||||
2. 修复文本框添加图片失败问题
|
||||
|
||||
#### excel
|
||||
|
|
@ -369,8 +377,8 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
|
||||
#### word
|
||||
|
||||
1. 新增ExecInnerTSl
|
||||
2. 新增修改chart图(数据)
|
||||
1. 新增 ExecInnerTSl
|
||||
2. 新增修改 chart 图(数据)
|
||||
3. 修复`TNumbering::AddStyleByInnerXml`错误
|
||||
4. 完善帮助文档
|
||||
|
||||
|
|
@ -388,11 +396,11 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
|
||||
#### word
|
||||
|
||||
1. 修复chart图兼容性问题
|
||||
1. 修复 chart 图兼容性问题
|
||||
|
||||
### V1.0.6
|
||||
|
||||
中文自动转换API由`class(xlsxXml).CodePage('中文');`调整为`TOfficeApi().CodePage('中文');`
|
||||
中文自动转换 API 由`class(xlsxXml).CodePage('中文');`调整为`TOfficeApi().CodePage('中文');`
|
||||
|
||||
## 2023-1-5
|
||||
|
||||
|
|
@ -402,15 +410,15 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
|
||||
#### word
|
||||
|
||||
1. 修复 Properties执行报错
|
||||
1. 修复 Properties 执行报错
|
||||
2. 修复格式刷
|
||||
|
||||
#### excel
|
||||
|
||||
1. 移除API `JoinCellName`
|
||||
1. 移除 API `JoinCellName`
|
||||
2. 修改`RGBToHSL`与`HSLToRGB`返回值
|
||||
3. 修复获取超链接`GetCellHyperLink`失败问题
|
||||
4. 修复一个对象新建文件,打开文件之后引发的xlsx文件错误问题
|
||||
4. 修复一个对象新建文件,打开文件之后引发的 xlsx 文件错误问题
|
||||
5. 修复`GetCoreProps`,`GetAppProps`失败问题
|
||||
|
||||
## 2022-12-30
|
||||
|
|
@ -430,4 +438,4 @@ word/excel 新增加密方法`SetPassword`,升级`OpenFile(alias, fileName, Pa
|
|||
5. 修复`SetRowVisible`,`GetRowVisible`,`SetSheetVisible`问题
|
||||
|
||||
如何设置字符集(中文支持)?
|
||||
★用户的脚本可能是UFT8格式,或可能是GBK码格式,系统提供API自动设置当前字符集环境:`class(xlsxXml).CodePage('中文');` 在文件头设置该代码后,系统会自动检测当前的环境字符集
|
||||
★ 用户的脚本可能是 UFT8 格式,或可能是 GBK 码格式,系统提供 API 自动设置当前字符集环境:`class(xlsxXml).CodePage('中文');` 在文件头设置该代码后,系统会自动检测当前的环境字符集
|
||||
|
|
|
|||
Loading…
Reference in New Issue