This commit is contained in:
csh
2024-07-18 17:26:41 +08:00
parent 5469ca318d
commit 037cb41560
6 changed files with 61 additions and 30 deletions
+33 -7
View File
@@ -1,4 +1,4 @@
// Version 1.6.9
// Version 1.7.0
Function TOfficeObj(n);
Begin
case lowercase(n) of
@@ -554,6 +554,7 @@ type TComment=class(NodeInfo)
Function Init();
Begin
Visible := new BOOL(self, 'Visible');
Font := new TFont(self, 'rPr');
//TODO...
End;
@@ -561,6 +562,7 @@ type TComment=class(NodeInfo)
Function InitRootNode(node);
Begin
RootObj := node;
Visible.InitRootNode(node);
Font.InitRootNode(node);
End;
@@ -584,7 +586,8 @@ type TComment=class(NodeInfo)
Function GetChildren(); override;
Begin
return array(('field':'Font','name':Font.NodeName,'obj':Font,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TFont')
return array(('field':'Visible','name':Visible.NodeName,'obj':Visible,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'BOOL')
,('field':'Font','name':Font.NodeName,'obj':Font,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TFont')
,('field':'Text','name':'t','obj':XMLText,'attrEx':'','nodeType':'pcdata','attrName':'', 'desc':'', 'class':'')
,('field':'Space','name':'t','obj':Space,'attrEx':'xml:space','nodeType':'','attrName':'', 'desc':'', 'class':'')
) union ExtNodes;
@@ -593,6 +596,7 @@ type TComment=class(NodeInfo)
//Attributes
//Nodes
Visible;
Font;
XMLText;
Space;
@@ -3611,7 +3615,14 @@ type TBorders=class(NodeInfo)
Function GetChildren(); override;
Begin
return array(('field':'Left','name':Left.NodeName,'obj':Left,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
return array(('field':'Color','name':'Color','obj':Color,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'ColorIndex','name':'ColorIndex','obj':ColorIndex,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'LineStyle','name':'LineStyle','obj':LineStyle,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'Value','name':'Value','obj':Value,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'Weight','name':'Weight','obj':Weight,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'ThemeColor','name':'ThemeColor','obj':ThemeColor,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'TintAndShade','name':'TintAndShade','obj':TintAndShade,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'')
,('field':'Left','name':Left.NodeName,'obj':Left,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
,('field':'Right','name':Right.NodeName,'obj':Right,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
,('field':'Top','name':Top.NodeName,'obj':Top,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
,('field':'Bottom','name':Bottom.NodeName,'obj':Bottom,'attrEx':'','nodeType':'','attrName':'', 'desc':'', 'class':'TBorder')
@@ -3624,6 +3635,13 @@ type TBorders=class(NodeInfo)
XMLDiagonalUp;
//Nodes
Color;
ColorIndex;
LineStyle;
Value;
Weight;
ThemeColor;
TintAndShade;
Left;
Right;
Top;
@@ -13223,10 +13241,18 @@ Type TDocumentBody = Class(DocObject)
end
if multiLine then Begin
defaultParagraph.node_ := nil;
defaultParagraph.Run.ClearText();
defaultParagraph.Run.SetText(tbl.Data_[i, j]);
tcNode.InsertEndChild(defaultParagraph.Marshal());
para := new TParagraph();
if istable(customCell) and ifObj(customCell[i, j, 1]) then
para.PPr := customCell[i, j, 1];
else
para.PPr := defaultParagraph.pPr;
if istable(customCell) and ifObj(customCell[i, j, 2]) then
para.PPr.RPr := customCell[i, j, 2];
else
para.PPr.RPr := defaultParagraph.pPr.rpr;
para.Run.SetText(tbl.Data_[i, j]);
para.Run.RPr := para.PPr.RPr;
tcNode.InsertEndChild(para.Marshal());
End
else Begin
pNode := tcNode.InsertEndChild('element', 'w:p');
+1 -1
View File
@@ -1,4 +1,4 @@
// Version 1.6.9
// Version 1.7.0
Type TSDocxFile = Class
///Version: V1.0 2022-09-20
///适用于 Microsoft Word docx格式文件
+6 -7
View File
@@ -3,9 +3,9 @@ Type NodeInfo = class
public
Function Create(parentObj, name);
Begin
if ifObj(parentObj) then
if ifObj(parentObj) then
NodeUri := parentObj.NodeUri = '' ? name : (parentObj.NodeUri + '/' + name);
else
else
NodeUri := '';
NodeName := name;
ExtAttr := array();
@@ -52,7 +52,7 @@ public
attrs := GetAttrsEx();
lName := lowerCase(name);
r := sselect * from attrs where lName = lowerCase([0]) end;
if istable(r) then
if istable(r) then
begin
node.DeleteAttribute(r[1]);
return true;
@@ -72,7 +72,6 @@ public
return false;
End;
Function GetAttrs(); virtual;
Begin
return ExtAttr;
@@ -190,7 +189,7 @@ public
attrs := GetAttrsEx();
lName := lowerCase(name);
r := sselect * from attrs where lName = lowerCase([0]) end;
if istable(r) then
if istable(r) then
begin
value := node.GetAttribute(r[1]);
return nottransferable ? value : trystrtofloat(value, r) ? r : value;
@@ -201,7 +200,7 @@ public
if istable(r) then Begin
r := r[0];
node := node.FirstChildElement(r['name']);
if not ifObj(node) and r['nodeType'] = 'empty' then return false;
if not ifObj(node) and r['nodeType'] = 'empty' and not nottransferable then return false;
if not ifObj(node) then return nil;
if r['nodeType'] = 'pcdata' then //返回文本串
return node.GetText();
@@ -278,7 +277,7 @@ private
NodeName := ReplaceStr(NodeName, k, v);
end
End
Function ReplaceName(name);
Begin
for k,v in ReplaceArr do Begin
+2 -2
View File
@@ -1,4 +1,4 @@
// Version 1.6.9
// Version 1.7.0
Type TSXlsxFile = Class
///Version: V1.0 2022-08-08
///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。
@@ -223,7 +223,7 @@ Type TSXlsxFile = Class
// 处理cell设定的样式
if not ifarray(opt) then opt := array();
workbook_.SetCellStyleOpt(sheet_name, axis, opt);
SetCellType(sheet, axis, value, opt);
SetCellType(sheet_name, axis, value, opt);
return workbook_.SetCellValue(sheet_name, axis, value, opt);
End;
+1 -1
View File
@@ -619,7 +619,7 @@ Type xlsxWorkBook = Class
//app.xml
app := GetXmlFileObj(class(TSXml).GetFileName('docProps_app'));
vector := app.FirstChildElement('Properties').FirstChildElement('TitlesOfParts').FirstChildElement('vt:vector');
vector.SetAttribute('size', sheetId);
vector.SetAttribute('size', sheetsCount_+1);
vector.InsertEndChild('element', 'vt:lpstr', destSheet);
//[Content_Types].xml