v1.2.5
This commit is contained in:
parent
fbec04c5e7
commit
84673ea219
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.2.4
|
// Version 1.2.5
|
||||||
|
|
||||||
Function TOfficeObj(n);
|
Function TOfficeObj(n);
|
||||||
Begin
|
Begin
|
||||||
|
|
@ -3755,19 +3755,6 @@ type TNumFmts=class(NodeInfo)
|
||||||
RootObj := node;
|
RootObj := node;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Property NumFmtId read readXMLNumFmtId write writeXMLNumFmtId;
|
|
||||||
Function readXMLNumFmtId();
|
|
||||||
Begin
|
|
||||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('NumFmtId'));
|
|
||||||
if not ifNil(tmpVal) then return tmpVal;
|
|
||||||
return class(TSXml).Utf8ToCurCodePage(XMLNumFmtId);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Function writeXMLNumFmtId(str);
|
|
||||||
Begin
|
|
||||||
XMLNumFmtId := class(TSXml).CurCodePageToUtf8(str);
|
|
||||||
End;
|
|
||||||
|
|
||||||
Property FormatCode read readXMLFormatCode write writeXMLFormatCode;
|
Property FormatCode read readXMLFormatCode write writeXMLFormatCode;
|
||||||
Function readXMLFormatCode();
|
Function readXMLFormatCode();
|
||||||
Begin
|
Begin
|
||||||
|
|
@ -3784,7 +3771,7 @@ type TNumFmts=class(NodeInfo)
|
||||||
Function GetAttrs(); override;
|
Function GetAttrs(); override;
|
||||||
Begin
|
Begin
|
||||||
HandleAttrs();
|
HandleAttrs();
|
||||||
return array(("NumFmtId", "numFmtId", XMLNumFmtId, ""),("FormatCode", "formatCode", XMLFormatCode, "")) union ExtAttr;
|
return array(("NumFmtId", "numFmtId", NumFmtId, ""),("FormatCode", "formatCode", XMLFormatCode, "")) union ExtAttr;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetChildren(); override;
|
Function GetChildren(); override;
|
||||||
|
|
@ -3794,7 +3781,7 @@ type TNumFmts=class(NodeInfo)
|
||||||
End;
|
End;
|
||||||
|
|
||||||
//Attributes
|
//Attributes
|
||||||
XMLNumFmtId;
|
NumFmtId;
|
||||||
XMLFormatCode;
|
XMLFormatCode;
|
||||||
|
|
||||||
//Nodes
|
//Nodes
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.2.4
|
// Version 1.2.5
|
||||||
|
|
||||||
Type TSDocxFile = Class
|
Type TSDocxFile = Class
|
||||||
///Version: V1.0 2022-09-20
|
///Version: V1.0 2022-09-20
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Version 1.2.4
|
// Version 1.2.5
|
||||||
|
|
||||||
Type TSExcelFile = Class
|
Type TSExcelFile = Class
|
||||||
///Version: V1.0 2022-08-08
|
///Version: V1.0 2022-08-08
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||||
Function GetComment(cell);
|
Function GetComment(cell);
|
||||||
Begin
|
Begin
|
||||||
o := commentObjs_[cell];
|
o := commentObjs_[cell];
|
||||||
if not ifObj(o) then return array('', '');
|
if not ifObj(o) then return array(nil, nil);
|
||||||
r_node := o.FirstChildElement('text').FirstChildElement('r');
|
r_node := o.FirstChildElement('text').FirstChildElement('r');
|
||||||
author := r_node.FirstChildElement('t').GetText();
|
author := r_node.FirstChildElement('t').GetText();
|
||||||
if length(author) > 1 then author := author[:length(author)-1];
|
if length(author) > 1 then author := author[:length(author)-1];
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ Type xlsxStyles = Class
|
||||||
return count;
|
return count;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function GetStyleId(style, oldStyleId);overload;
|
Function GetStyleId(newStyle, oldStyleId);overload;
|
||||||
Begin
|
Begin
|
||||||
if oldStyleId = '' then return nil;
|
if oldStyleId = '' then return nil;
|
||||||
style_node := styleXmlFile_.FirstChildElement('styleSheet');
|
style_node := styleXmlFile_.FirstChildElement('styleSheet');
|
||||||
|
|
@ -60,6 +60,8 @@ Type xlsxStyles = Class
|
||||||
cellXfs_node.SetAttribute('count', count + 1);
|
cellXfs_node.SetAttribute('count', count + 1);
|
||||||
attrs := marshal['attributes'];
|
attrs := marshal['attributes'];
|
||||||
|
|
||||||
|
style := newStyle;
|
||||||
|
|
||||||
numfmt_id := trystrtoint(attrs['numFmtId'], r) ? r : 0;
|
numfmt_id := trystrtoint(attrs['numFmtId'], r) ? r : 0;
|
||||||
copyNode(style_node, xf_node, 'numFmts', 'numFmt', 'numFmtId', numfmt_id, style.NumberFormat);
|
copyNode(style_node, xf_node, 'numFmts', 'numFmt', 'numFmtId', numfmt_id, style.NumberFormat);
|
||||||
|
|
||||||
|
|
@ -214,13 +216,27 @@ private
|
||||||
|
|
||||||
Function copyNodeNumFmts(root, xf_node, id, obj);
|
Function copyNodeNumFmts(root, xf_node, id, obj);
|
||||||
Begin
|
Begin
|
||||||
nodeName_node := root.FirstChildElement('numFmts');
|
if id = 0 then
|
||||||
if not ifObj(nodeName_node) then return;
|
begin
|
||||||
processNumFmtId(root, 'numFmts', obj.NumberFormat);
|
if ifnil(obj.FormatCode) then xf_node.SetAttribute('numFmtId', 0);
|
||||||
new_node := nodeName_node.InsertEndChild(obj.Marshal());
|
else begin
|
||||||
xf_node.SetAttribute('numFmtId', ifnil(obj.NumFmtId) ? 0 : obj.NumFmtId);
|
obj.NumFmtId := 176;
|
||||||
count := nodeName_node.GetAttribute('count');
|
insertNode(root, 'numFmts', obj);
|
||||||
nodeName_node.SetAttribute('count', strtoint(count) + 1);
|
xf_node.SetAttribute('numFmtId', 176);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
nodeName_node := root.FirstChildElement('numFmts');
|
||||||
|
println("id = {}", id);
|
||||||
|
num_node := getNodeNumFmts(nodeName_node, id);
|
||||||
|
processNumFmtId(root, 'numFmts', obj);
|
||||||
|
new_node := nodeName_node.InsertEndChild(num_node.Marshal()[0]);
|
||||||
|
count := strtoint(nodeName_node.GetAttribute('count'));
|
||||||
|
nodeName_node.SetAttribute('count', count + 1);
|
||||||
|
xf_node.SetAttribute('numFmtId', obj.NumFmtId);
|
||||||
|
marshal := obj.Marshal();
|
||||||
|
class(TSXml).UpdateNode(new_node, marshal['attributes'], marshal['children']);
|
||||||
|
end
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function copyNode(root, xf_node, nodeName, name, idName, id, obj);
|
Function copyNode(root, xf_node, nodeName, name, idName, id, obj);
|
||||||
|
|
@ -255,20 +271,19 @@ private
|
||||||
count := node.GetAttribute('count');
|
count := node.GetAttribute('count');
|
||||||
node.InsertEndChild(marshal);
|
node.InsertEndChild(marshal);
|
||||||
node.SetAttribute('count', strtoint(count) + 1);
|
node.SetAttribute('count', strtoint(count) + 1);
|
||||||
//node.Print;
|
|
||||||
return count;
|
return count;
|
||||||
End
|
End
|
||||||
|
|
||||||
Function processNumFmtId(rootNode, childName, obj);
|
Function processNumFmtId(rootNode, childName, obj);
|
||||||
Begin
|
Begin
|
||||||
if ifnil(obj.FormatCode) or not ifnil(obj.numFmtId) then return;
|
if ifnil(obj.FormatCode) then return;
|
||||||
node := rootNode.FirstChildElement(childName);
|
node := rootNode.FirstChildElement(childName);
|
||||||
if not ifObj(node) then obj.numFmtId := '176';
|
if not ifObj(node) then id := 176;
|
||||||
else begin
|
else begin
|
||||||
node := node.LastChildElement('numFmt');
|
node := node.LastChildElement('numFmt');
|
||||||
id := node.GetAttribute('numFmtId');
|
id := strtoint(node.GetAttribute('numFmtId')) + 1;
|
||||||
obj.numFmtId := strtoint(id) + 1;
|
|
||||||
end
|
end
|
||||||
|
obj.numFmtId := id;
|
||||||
End
|
End
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -865,8 +865,10 @@ Type xlsxWorkBook = Class
|
||||||
return strtofloat(default_ht);
|
return strtofloat(default_ht);
|
||||||
End
|
End
|
||||||
|
|
||||||
Function SetColWidth(sheet, startCol, endCol, width);
|
Function SetColWidth(sheet, bCol, eCol, width);
|
||||||
Begin
|
Begin
|
||||||
|
startCol := bCol;
|
||||||
|
endCol := eCol;
|
||||||
startCol := ColumnNameToNumber(startCol)[1];
|
startCol := ColumnNameToNumber(startCol)[1];
|
||||||
endCol := ColumnNameToNumber(endCol)[1];
|
endCol := ColumnNameToNumber(endCol)[1];
|
||||||
if startCol > endCol then return;
|
if startCol > endCol then return;
|
||||||
|
|
@ -915,13 +917,13 @@ 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 := ColumnNameToNumber(col)[1];
|
col_number := ColumnNameToNumber(col)[1];
|
||||||
node := col_node.FirstChildElement('col');
|
node := col_node.FirstChildElement('col');
|
||||||
while ifObj(node) do
|
while ifObj(node) do
|
||||||
Begin
|
Begin
|
||||||
min := strtoint(node.GetAttribute('min'));
|
min := strtoint(node.GetAttribute('min'));
|
||||||
max := strtoint(node.GetAttribute('max'));
|
max := strtoint(node.GetAttribute('max'));
|
||||||
if col >= min and col <= max then
|
if col_number >= min and col_number <= max then
|
||||||
Begin
|
Begin
|
||||||
width := trystrtofloat(node.GetAttribute('width'), r) ? r : -1;
|
width := trystrtofloat(node.GetAttribute('width'), r) ? r : -1;
|
||||||
if width = -1 then break;
|
if width = -1 then break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue