v1.2.2
This commit is contained in:
+557
-233
@@ -1,4 +1,4 @@
|
||||
// Version 1.2.1
|
||||
// Version 1.2.2
|
||||
|
||||
Function TOfficeObj(n);
|
||||
Begin
|
||||
@@ -121,10 +121,10 @@ Begin
|
||||
return new TBorders();
|
||||
"tnumfmts":
|
||||
return new TNumFmts();
|
||||
"tfills":
|
||||
return new TFills();
|
||||
"tgradient":
|
||||
return new TGradient();
|
||||
"tfills":
|
||||
return new TFills();
|
||||
"tpattern":
|
||||
return new TPattern();
|
||||
"tstop":
|
||||
@@ -3560,31 +3560,83 @@ type TBorder=class(NodeInfo)
|
||||
RootObj := node;
|
||||
End;
|
||||
|
||||
Property Color read readXMLColor write writeXMLColor;
|
||||
Function readXMLColor();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Color'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLColor);
|
||||
End;
|
||||
|
||||
Function writeXMLColor(str);
|
||||
Begin
|
||||
XMLColor := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ThemeColor read readXMLThemeColor write writeXMLThemeColor;
|
||||
Function readXMLThemeColor();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ThemeColor'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLThemeColor);
|
||||
End;
|
||||
|
||||
Function writeXMLThemeColor(str);
|
||||
Begin
|
||||
XMLThemeColor := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ThemeColorTint read readXMLThemeColorTint write writeXMLThemeColorTint;
|
||||
Function readXMLThemeColorTint();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ThemeColorTint'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLThemeColorTint);
|
||||
End;
|
||||
|
||||
Function writeXMLThemeColorTint(str);
|
||||
Begin
|
||||
XMLThemeColorTint := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property LineStyle read readXMLLineStyle write writeXMLLineStyle;
|
||||
Function readXMLLineStyle();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('LineStyle'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLLineStyle);
|
||||
End;
|
||||
|
||||
Function writeXMLLineStyle(str);
|
||||
Begin
|
||||
XMLLineStyle := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("LineStyle", "style", LineStyle, "")) union ExtAttr;
|
||||
return array(("LineStyle", "style", XMLLineStyle, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"Color","name":"color","obj":Color,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ColorIndex","name":"ColorIndex","obj":ColorIndex,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
return array(("field":"Color","name":"color","obj":XMLColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ThemeColor","name":"color","obj":XMLThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ThemeColorTint","name":"color","obj":XMLThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Weight","name":"weight","obj":Weight,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ThemeColor","name":"color","obj":ThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"TintAndShade","name":"tintandshade","obj":TintAndShade,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
LineStyle;
|
||||
XMLLineStyle;
|
||||
|
||||
//Nodes
|
||||
Color;
|
||||
ColorIndex;
|
||||
XMLColor;
|
||||
XMLThemeColor;
|
||||
XMLThemeColorTint;
|
||||
Weight;
|
||||
ThemeColor;
|
||||
TintAndShade;
|
||||
End;
|
||||
|
||||
@@ -3623,6 +3675,32 @@ type TBorders=class(NodeInfo)
|
||||
Diagonal.InitRootNode(node);
|
||||
End;
|
||||
|
||||
Property DiagonalDown read readXMLDiagonalDown write writeXMLDiagonalDown;
|
||||
Function readXMLDiagonalDown();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('DiagonalDown'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLDiagonalDown);
|
||||
End;
|
||||
|
||||
Function writeXMLDiagonalDown(str);
|
||||
Begin
|
||||
XMLDiagonalDown := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property DiagonalUp read readXMLDiagonalUp write writeXMLDiagonalUp;
|
||||
Function readXMLDiagonalUp();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('DiagonalUp'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLDiagonalUp);
|
||||
End;
|
||||
|
||||
Function writeXMLDiagonalUp(str);
|
||||
Begin
|
||||
XMLDiagonalUp := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
@@ -3637,8 +3715,8 @@ type TBorders=class(NodeInfo)
|
||||
,("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")
|
||||
,("field":"Diagonal","name":Diagonal.NodeName,"obj":Diagonal,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TBorder")
|
||||
,("field":"DiagonalDown","name":"diagonalDown","obj":DiagonalDown,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"DiagonalUp","name":"diagonalUp","obj":DiagonalUp,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"DiagonalDown","name":"diagonalDown","obj":XMLDiagonalDown,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"DiagonalUp","name":"diagonalUp","obj":XMLDiagonalUp,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
@@ -3650,8 +3728,8 @@ type TBorders=class(NodeInfo)
|
||||
Top;
|
||||
Bottom;
|
||||
Diagonal;
|
||||
DiagonalDown;
|
||||
DiagonalUp;
|
||||
XMLDiagonalDown;
|
||||
XMLDiagonalUp;
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -3679,10 +3757,36 @@ type TNumFmts=class(NodeInfo)
|
||||
RootObj := node;
|
||||
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;
|
||||
Function readXMLFormatCode();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('FormatCode'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLFormatCode);
|
||||
End;
|
||||
|
||||
Function writeXMLFormatCode(str);
|
||||
Begin
|
||||
XMLFormatCode := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("NumFmtId", "numFmtId", NumFmtId, ""),("FormatCode", "formatCode", FormatCode, "")) union ExtAttr;
|
||||
return array(("NumFmtId", "numFmtId", XMLNumFmtId, ""),("FormatCode", "formatCode", XMLFormatCode, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
@@ -3692,12 +3796,150 @@ type TNumFmts=class(NodeInfo)
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
NumFmtId;
|
||||
FormatCode;
|
||||
XMLNumFmtId;
|
||||
XMLFormatCode;
|
||||
|
||||
//Nodes
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
/// TGradient
|
||||
///////////////////////////////////////////////////////////////
|
||||
type TGradient=class(NodeInfo)
|
||||
Function Create(); overload;
|
||||
Begin
|
||||
Create(nil, 'gradientFill');
|
||||
End;
|
||||
|
||||
Function Create(p, name); overload;
|
||||
Begin
|
||||
Class(NodeInfo).Create(p, name);
|
||||
Init();
|
||||
End;
|
||||
|
||||
Function Init();
|
||||
Begin
|
||||
Stop1 := new TStop(self, 'stop');
|
||||
Stop2 := new TStop(self, 'stop');
|
||||
Stop3 := new TStop(self, 'stop');
|
||||
//TODO...
|
||||
End;
|
||||
|
||||
Function InitRootNode(node);
|
||||
Begin
|
||||
RootObj := node;
|
||||
Stop1.InitRootNode(node);
|
||||
Stop2.InitRootNode(node);
|
||||
Stop3.InitRootNode(node);
|
||||
End;
|
||||
|
||||
Property Degree read readXMLDegree write writeXMLDegree;
|
||||
Function readXMLDegree();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Degree'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLDegree);
|
||||
End;
|
||||
|
||||
Function writeXMLDegree(str);
|
||||
Begin
|
||||
XMLDegree := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Type read readXMLType write writeXMLType;
|
||||
Function readXMLType();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Type'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLType);
|
||||
End;
|
||||
|
||||
Function writeXMLType(str);
|
||||
Begin
|
||||
XMLType := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Left read readXMLLeft write writeXMLLeft;
|
||||
Function readXMLLeft();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Left'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLLeft);
|
||||
End;
|
||||
|
||||
Function writeXMLLeft(str);
|
||||
Begin
|
||||
XMLLeft := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Right read readXMLRight write writeXMLRight;
|
||||
Function readXMLRight();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Right'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLRight);
|
||||
End;
|
||||
|
||||
Function writeXMLRight(str);
|
||||
Begin
|
||||
XMLRight := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Top read readXMLTop write writeXMLTop;
|
||||
Function readXMLTop();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Top'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLTop);
|
||||
End;
|
||||
|
||||
Function writeXMLTop(str);
|
||||
Begin
|
||||
XMLTop := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Bottom read readXMLBottom write writeXMLBottom;
|
||||
Function readXMLBottom();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Bottom'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLBottom);
|
||||
End;
|
||||
|
||||
Function writeXMLBottom(str);
|
||||
Begin
|
||||
XMLBottom := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("Degree", "degree", XMLDegree, ""),("Type", "type", XMLType, ""),("Left", "left", XMLLeft, ""),("Right", "right", XMLRight, ""),("Top", "top", XMLTop, ""),("Bottom", "bottom", XMLBottom, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"Stop1","name":Stop1.NodeName,"obj":Stop1,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TStop")
|
||||
,("field":"Stop2","name":Stop2.NodeName,"obj":Stop2,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TStop")
|
||||
,("field":"Stop3","name":Stop3.NodeName,"obj":Stop3,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"TStop")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
XMLDegree;
|
||||
XMLType;
|
||||
XMLLeft;
|
||||
XMLRight;
|
||||
XMLTop;
|
||||
XMLBottom;
|
||||
|
||||
//Nodes
|
||||
Stop1;
|
||||
Stop2;
|
||||
Stop3;
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
/// TFills
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -3748,53 +3990,6 @@ type TFills=class(NodeInfo)
|
||||
Gradient;
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
/// TGradientImpl
|
||||
///////////////////////////////////////////////////////////////
|
||||
type TGradientImpl=class(NodeInfo)
|
||||
Function Create(); overload;
|
||||
Begin
|
||||
Create(nil, 'gradientFill');
|
||||
End;
|
||||
|
||||
Function Create(p, name); overload;
|
||||
Begin
|
||||
Class(NodeInfo).Create(p, name);
|
||||
Init();
|
||||
End;
|
||||
|
||||
Function Init();
|
||||
Begin
|
||||
//TODO...
|
||||
End;
|
||||
|
||||
Function InitRootNode(node);
|
||||
Begin
|
||||
RootObj := node;
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("Shading", "Shading", Shading, ""),("Color1", "color", Color1, ""),("ThemeColor1", "color", ThemeColor1, ""),("Color2", "color", Color2, ""),("ThemeColor2", "color", ThemeColor2, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return ExtNodes;
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
Shading;
|
||||
Color1;
|
||||
ThemeColor1;
|
||||
Color2;
|
||||
ThemeColor2;
|
||||
|
||||
//Nodes
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
/// TPattern
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -3820,34 +4015,125 @@ type TPattern=class(NodeInfo)
|
||||
RootObj := node;
|
||||
End;
|
||||
|
||||
Property PatternType read readXMLPatternType write writeXMLPatternType;
|
||||
Function readXMLPatternType();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('PatternType'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLPatternType);
|
||||
End;
|
||||
|
||||
Function writeXMLPatternType(str);
|
||||
Begin
|
||||
XMLPatternType := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ForegroundColor read readXMLForegroundColor write writeXMLForegroundColor;
|
||||
Function readXMLForegroundColor();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ForegroundColor'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLForegroundColor);
|
||||
End;
|
||||
|
||||
Function writeXMLForegroundColor(str);
|
||||
Begin
|
||||
XMLForegroundColor := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property BackgroundColor read readXMLBackgroundColor write writeXMLBackgroundColor;
|
||||
Function readXMLBackgroundColor();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('BackgroundColor'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLBackgroundColor);
|
||||
End;
|
||||
|
||||
Function writeXMLBackgroundColor(str);
|
||||
Begin
|
||||
XMLBackgroundColor := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ForegroundThemeColor read readXMLForegroundThemeColor write writeXMLForegroundThemeColor;
|
||||
Function readXMLForegroundThemeColor();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ForegroundThemeColor'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLForegroundThemeColor);
|
||||
End;
|
||||
|
||||
Function writeXMLForegroundThemeColor(str);
|
||||
Begin
|
||||
XMLForegroundThemeColor := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property BackgroundThemeColor read readXMLBackgroundThemeColor write writeXMLBackgroundThemeColor;
|
||||
Function readXMLBackgroundThemeColor();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('BackgroundThemeColor'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLBackgroundThemeColor);
|
||||
End;
|
||||
|
||||
Function writeXMLBackgroundThemeColor(str);
|
||||
Begin
|
||||
XMLBackgroundThemeColor := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ForegroundThemeColorTint read readXMLForegroundThemeColorTint write writeXMLForegroundThemeColorTint;
|
||||
Function readXMLForegroundThemeColorTint();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ForegroundThemeColorTint'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLForegroundThemeColorTint);
|
||||
End;
|
||||
|
||||
Function writeXMLForegroundThemeColorTint(str);
|
||||
Begin
|
||||
XMLForegroundThemeColorTint := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property BackgroundThemeColorTint read readXMLBackgroundThemeColorTint write writeXMLBackgroundThemeColorTint;
|
||||
Function readXMLBackgroundThemeColorTint();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('BackgroundThemeColorTint'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLBackgroundThemeColorTint);
|
||||
End;
|
||||
|
||||
Function writeXMLBackgroundThemeColorTint(str);
|
||||
Begin
|
||||
XMLBackgroundThemeColorTint := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("PatternType", "patternType", PatternType, "")) union ExtAttr;
|
||||
return array(("PatternType", "patternType", XMLPatternType, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"ForegroundColor","name":"fgColor","obj":ForegroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"BackgroundColor","name":"bgColor","obj":BackgroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ForegroundThemeColor","name":"fgColor","obj":ForegroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"BackgroundThemeColor","name":"bgColor","obj":BackgroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ForegroundThemeColorTint","name":"fgColor","obj":ForegroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"BackgroundThemeColorTint","name":"bgColor","obj":BackgroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
return array(("field":"ForegroundColor","name":"fgColor","obj":XMLForegroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"BackgroundColor","name":"bgColor","obj":XMLBackgroundColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ForegroundThemeColor","name":"fgColor","obj":XMLForegroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"BackgroundThemeColor","name":"bgColor","obj":XMLBackgroundThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ForegroundThemeColorTint","name":"fgColor","obj":XMLForegroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"BackgroundThemeColorTint","name":"bgColor","obj":XMLBackgroundThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
PatternType;
|
||||
XMLPatternType;
|
||||
|
||||
//Nodes
|
||||
ForegroundColor;
|
||||
BackgroundColor;
|
||||
ForegroundThemeColor;
|
||||
BackgroundThemeColor;
|
||||
ForegroundThemeColorTint;
|
||||
BackgroundThemeColorTint;
|
||||
XMLForegroundColor;
|
||||
XMLBackgroundColor;
|
||||
XMLForegroundThemeColor;
|
||||
XMLBackgroundThemeColor;
|
||||
XMLForegroundThemeColorTint;
|
||||
XMLBackgroundThemeColorTint;
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -3875,28 +4161,95 @@ type TStop=class(NodeInfo)
|
||||
RootObj := node;
|
||||
End;
|
||||
|
||||
Property Position read readXMLPosition write writeXMLPosition;
|
||||
Function readXMLPosition();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Position'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLPosition);
|
||||
End;
|
||||
|
||||
Function writeXMLPosition(str);
|
||||
Begin
|
||||
XMLPosition := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Color read readXMLColor write writeXMLColor;
|
||||
Function readXMLColor();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Color'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLColor);
|
||||
End;
|
||||
|
||||
Function writeXMLColor(str);
|
||||
Begin
|
||||
XMLColor := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ColorIndex read readXMLColorIndex write writeXMLColorIndex;
|
||||
Function readXMLColorIndex();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ColorIndex'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLColorIndex);
|
||||
End;
|
||||
|
||||
Function writeXMLColorIndex(str);
|
||||
Begin
|
||||
XMLColorIndex := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ThemeColor read readXMLThemeColor write writeXMLThemeColor;
|
||||
Function readXMLThemeColor();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ThemeColor'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLThemeColor);
|
||||
End;
|
||||
|
||||
Function writeXMLThemeColor(str);
|
||||
Begin
|
||||
XMLThemeColor := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ThemeColorTint read readXMLThemeColorTint write writeXMLThemeColorTint;
|
||||
Function readXMLThemeColorTint();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ThemeColorTint'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLThemeColorTint);
|
||||
End;
|
||||
|
||||
Function writeXMLThemeColorTint(str);
|
||||
Begin
|
||||
XMLThemeColorTint := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("Position", "position", Position, "")) union ExtAttr;
|
||||
return array(("Position", "position", XMLPosition, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"Color","name":"color","obj":Color,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ColorIndex","name":"color","obj":ColorIndex,"attrEx":"index","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ThemeColor","name":"color","obj":ThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
return array(("field":"Color","name":"color","obj":XMLColor,"attrEx":"rgb","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ColorIndex","name":"color","obj":XMLColorIndex,"attrEx":"index","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ThemeColor","name":"color","obj":XMLThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ThemeColorTint","name":"color","obj":XMLThemeColorTint,"attrEx":"tint","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
Position;
|
||||
XMLPosition;
|
||||
|
||||
//Nodes
|
||||
Color;
|
||||
ColorIndex;
|
||||
ThemeColor;
|
||||
XMLColor;
|
||||
XMLColorIndex;
|
||||
XMLThemeColor;
|
||||
XMLThemeColorTint;
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
@@ -3924,10 +4277,75 @@ type TAlignment=class(NodeInfo)
|
||||
RootObj := node;
|
||||
End;
|
||||
|
||||
Property Horizontal read readXMLHorizontal write writeXMLHorizontal;
|
||||
Function readXMLHorizontal();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Horizontal'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLHorizontal);
|
||||
End;
|
||||
|
||||
Function writeXMLHorizontal(str);
|
||||
Begin
|
||||
XMLHorizontal := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Vertical read readXMLVertical write writeXMLVertical;
|
||||
Function readXMLVertical();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Vertical'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLVertical);
|
||||
End;
|
||||
|
||||
Function writeXMLVertical(str);
|
||||
Begin
|
||||
XMLVertical := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property WrapText read readXMLWrapText write writeXMLWrapText;
|
||||
Function readXMLWrapText();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('WrapText'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLWrapText);
|
||||
End;
|
||||
|
||||
Function writeXMLWrapText(str);
|
||||
Begin
|
||||
XMLWrapText := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ReadingOrder read readXMLReadingOrder write writeXMLReadingOrder;
|
||||
Function readXMLReadingOrder();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('ReadingOrder'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLReadingOrder);
|
||||
End;
|
||||
|
||||
Function writeXMLReadingOrder(str);
|
||||
Begin
|
||||
XMLReadingOrder := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property TextRotation read readXMLTextRotation write writeXMLTextRotation;
|
||||
Function readXMLTextRotation();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('TextRotation'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLTextRotation);
|
||||
End;
|
||||
|
||||
Function writeXMLTextRotation(str);
|
||||
Begin
|
||||
XMLTextRotation := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("Horizontal", "horizontal", Horizontal, ""),("Vertical", "vertical", Vertical, ""),("WrapText", "wrapText", WrapText, ""),("ReadingOrder", "readingOrder", ReadingOrder, ""),("TextRotation", "textRotation", TextRotation, "")) union ExtAttr;
|
||||
return array(("Horizontal", "horizontal", XMLHorizontal, ""),("Vertical", "vertical", XMLVertical, ""),("WrapText", "wrapText", XMLWrapText, ""),("ReadingOrder", "readingOrder", XMLReadingOrder, ""),("TextRotation", "textRotation", XMLTextRotation, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
@@ -3937,11 +4355,11 @@ type TAlignment=class(NodeInfo)
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
Horizontal;
|
||||
Vertical;
|
||||
WrapText;
|
||||
ReadingOrder;
|
||||
TextRotation;
|
||||
XMLHorizontal;
|
||||
XMLVertical;
|
||||
XMLWrapText;
|
||||
XMLReadingOrder;
|
||||
XMLTextRotation;
|
||||
|
||||
//Nodes
|
||||
End;
|
||||
@@ -3971,10 +4389,36 @@ type TProtection=class(NodeInfo)
|
||||
RootObj := node;
|
||||
End;
|
||||
|
||||
Property Lock read readXMLLock write writeXMLLock;
|
||||
Function readXMLLock();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Lock'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLLock);
|
||||
End;
|
||||
|
||||
Function writeXMLLock(str);
|
||||
Begin
|
||||
XMLLock := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Hide read readXMLHide write writeXMLHide;
|
||||
Function readXMLHide();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Hide'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLHide);
|
||||
End;
|
||||
|
||||
Function writeXMLHide(str);
|
||||
Begin
|
||||
XMLHide := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("Lock", "locked", Lock, ""),("Hide", "hidden", Hide, "")) union ExtAttr;
|
||||
return array(("Lock", "locked", XMLLock, ""),("Hide", "hidden", XMLHide, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
@@ -3984,8 +4428,8 @@ type TProtection=class(NodeInfo)
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
Lock;
|
||||
Hide;
|
||||
XMLLock;
|
||||
XMLHide;
|
||||
|
||||
//Nodes
|
||||
End;
|
||||
@@ -4045,6 +4489,22 @@ type TStyle=class(NodeInfo)
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
Function Apply();
|
||||
Begin
|
||||
children := GetChildren();
|
||||
for i:=0 to length(children)-1 do
|
||||
begin
|
||||
obj := children[i]["obj"];
|
||||
if ifObj(obj) then
|
||||
begin
|
||||
root := obj.Root();
|
||||
if not ifObj(root) then continue;
|
||||
marshal := obj.Marshal();
|
||||
class(TSXml).UpdateNode(root, marshal["attributes"], marshal["children"]);
|
||||
end
|
||||
end
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
|
||||
//Nodes
|
||||
@@ -14420,140 +14880,4 @@ Begin
|
||||
if cnt and (str[1] in spaceArr or (cnt > 1 and str[cnt] in spaceArr)) then
|
||||
return true;
|
||||
return false;
|
||||
End;///////////////////////////////////////////////////////////////////////////////////////////
|
||||
///XLSX文档实现
|
||||
|
||||
Type TGradient = class(TGradientImpl)
|
||||
|
||||
Function Create();
|
||||
Begin
|
||||
Class(TGradientImpl).Create();
|
||||
End;
|
||||
|
||||
Function HandleAttrs(); override;
|
||||
Begin
|
||||
case Shading of
|
||||
0: degree := 90;
|
||||
1: degree := 270;
|
||||
2: degree := 90;
|
||||
3: degree := nil;
|
||||
4: degree := 180;
|
||||
5: degree := nil;
|
||||
6: degree := 45;
|
||||
7: degree := 225;
|
||||
8: degree := 45;
|
||||
9: degree := 135;
|
||||
10: degree := 315;
|
||||
11: degree := 135;
|
||||
12:
|
||||
begin
|
||||
degree := nil;
|
||||
type := "path";
|
||||
end
|
||||
13:
|
||||
begin
|
||||
degree := nil;
|
||||
type := "path";
|
||||
left := 1;
|
||||
right := 1;
|
||||
end
|
||||
14:
|
||||
begin
|
||||
degree := nil;
|
||||
type := "path";
|
||||
top := 1;
|
||||
bottom := 1;
|
||||
end
|
||||
15:
|
||||
begin
|
||||
degree := nil;
|
||||
type := "path";
|
||||
left := 1;
|
||||
right := 1;
|
||||
top := 1;
|
||||
bottom := 1;
|
||||
end
|
||||
16:
|
||||
begin
|
||||
degree := nil;
|
||||
type := "path";
|
||||
left := 0.5;
|
||||
right := 0.5;
|
||||
top := "0.5";
|
||||
bottom := 0.5;
|
||||
end
|
||||
end
|
||||
End
|
||||
|
||||
Function HandleChildren(); override;
|
||||
Begin
|
||||
setColor();
|
||||
End
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(
|
||||
('degree', 'degree', degree),
|
||||
('type', 'type', type),
|
||||
('left', 'left', left),
|
||||
('right', 'right', right),
|
||||
('top', 'top', top),
|
||||
('bottom', 'bottom', bottom),
|
||||
) union ExtAttr;
|
||||
End
|
||||
|
||||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(
|
||||
('field': 'stop', 'name': 'stop', 'obj': topPosition, 'attrEx': '', 'nodeType': '', 'attrName': ''),
|
||||
('field': 'stop', 'name': 'stop', 'obj': middlePosition, 'attrEx': '', 'nodeType': '', 'attrName': ''),
|
||||
('field': 'stop', 'name': 'stop', 'obj': bottomPosition, 'attrEx': '', 'nodeType': '', 'attrName': ''),
|
||||
) union ExtNodes;
|
||||
End
|
||||
|
||||
private
|
||||
|
||||
Function setColor();
|
||||
Begin
|
||||
if ifnil(Shading) then return;
|
||||
topPosition := new TStop();
|
||||
topPosition.Position := 0;
|
||||
bottomPosition := new TStop();
|
||||
bottomPosition.Position := 1;
|
||||
middlePosition := new TStop();
|
||||
|
||||
if not ifnil(Color1) then topPosition.Color := Color1;
|
||||
else topPosition.ThemeColor := ThemeColor1 ? : "0";
|
||||
|
||||
if Shading in array(2, 5, 8, 11) then
|
||||
begin
|
||||
middlePosition.Position := 0.5;
|
||||
if not ifnil(Color2) then middlePosition.Color := Color2;
|
||||
else middlePosition.ThemeColor := ThemeColor2 ? : "0";
|
||||
if not ifnil(Color1) then bottomPosition.Color := Color1;
|
||||
else bottomPosition.ThemeColor := ThemeColor1 ? : "0";
|
||||
end
|
||||
else begin
|
||||
if not ifnil(Color2) then bottomPosition.Color := Color2;
|
||||
else bottomPosition.ThemeColor := ThemeColor2 ? : "0";
|
||||
end
|
||||
End
|
||||
|
||||
private
|
||||
// Attributes
|
||||
type;
|
||||
degree;
|
||||
left;
|
||||
right;
|
||||
top;
|
||||
bottom;
|
||||
|
||||
// Nodes
|
||||
topPosition;
|
||||
bottomPosition;
|
||||
middlePosition;
|
||||
|
||||
End
|
||||
|
||||
End;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Version 1.2.1
|
||||
// Version 1.2.2
|
||||
|
||||
Type TSDocxFile = Class
|
||||
///Version: V1.0 2022-09-20
|
||||
@@ -487,4 +487,3 @@ private
|
||||
numberingObj_;
|
||||
DocPrId_;
|
||||
End;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Version 1.2.1
|
||||
// Version 1.2.2
|
||||
|
||||
Type TSExcelFile = Class
|
||||
///Version: V1.0 2022-08-08
|
||||
@@ -199,6 +199,15 @@ Type TSExcelFile = Class
|
||||
return array(err, value);
|
||||
End;
|
||||
|
||||
///获取单元格数据类型
|
||||
///sheet: string,工作表名称
|
||||
///axis: string,单元格坐标,如: "A6"
|
||||
///返回: type:string
|
||||
Function GetCellValueType(sheet, axis);
|
||||
Begin
|
||||
return workbook_.GetCellValueType(class(TSXml).CurCodePageToUtf8(sheet), axis);
|
||||
End;
|
||||
|
||||
///设置单元格的值
|
||||
///sheet: string,工作表名称
|
||||
///axis: string,单元格坐标,如: "A6"
|
||||
@@ -442,6 +451,19 @@ Type TSExcelFile = Class
|
||||
if ifObj(o) then o.AddComment(axis, Author, comment);
|
||||
End;
|
||||
|
||||
///获取批注
|
||||
///sheet: string,工作表名称
|
||||
///axis: string,单元格,如"A7"
|
||||
///返回: [author:string, comment: string]
|
||||
Function GetComment(sheet, axis);
|
||||
Begin
|
||||
author := '';
|
||||
comment := '';
|
||||
o := getOj(sheet, 'xlsxComment');
|
||||
if ifObj(o) then [author, comment] := o.GetComment(axis);
|
||||
return array(class(TSXml).Utf8ToCurCodePage(author), class(TSXml).Utf8ToCurCodePage(comment));
|
||||
End;
|
||||
|
||||
///添加图表
|
||||
///sheet: string,工作表名称
|
||||
///range:string,图表所处矩形区域,"A5:F10"
|
||||
@@ -531,6 +553,14 @@ Type TSExcelFile = Class
|
||||
return styleObj.GetStyleId(style);
|
||||
End;
|
||||
|
||||
///获取样式对象
|
||||
///返回: TStyle对象
|
||||
Function GetStyle(styleid);
|
||||
Begin
|
||||
styleObj := new xlsxStyles('', self);
|
||||
return styleObj.GetStyle(styleid);
|
||||
End;
|
||||
|
||||
///设置单元格样式
|
||||
///sheet: string,工作表名称
|
||||
///topLeft: string,左上角坐标
|
||||
@@ -753,8 +783,8 @@ Type TSExcelFile = Class
|
||||
|
||||
///添加图片
|
||||
///sheet: string, 工作表名称
|
||||
///topLeft: string, 图片插入左上角单元格
|
||||
///bottomRight: string, 图片插入右下角单元格
|
||||
///topLeft: string, 图片插入左上角单元格
|
||||
///bottomRight: string, 图片插入右下角单元格
|
||||
///picture: TPicture 图片对象
|
||||
///format: TPictureFormat 图片设置对象
|
||||
Function AddPicture(sheet, topLeft, bottomRight, picture, format);
|
||||
@@ -765,19 +795,19 @@ Type TSExcelFile = Class
|
||||
|
||||
///删除图片
|
||||
///sheet: 工作表名称
|
||||
///topLeft: string, 图片插入左上角单元格
|
||||
///bottomRight: string, 图片插入右下角单元格
|
||||
///topLeft: string, 图片插入左上角单元格
|
||||
///bottomRight: string, 图片插入右下角单元格
|
||||
Function DeletePicture(sheet, topLeft, bottomRight);
|
||||
Begin
|
||||
o := getOj(sheet, 'xlsxImage');
|
||||
if ifObj(o) then return o.DeletePicture(topLeft, bottomRight);
|
||||
End;
|
||||
|
||||
///创建表格
|
||||
///创建表格
|
||||
///sheet: string,工作表名称
|
||||
///topLeft: string, 左上角单元格
|
||||
///bottomRight: string, 右下角单元格
|
||||
///tableStyle: 表格选项类 TTableStyle
|
||||
///topLeft: string, 左上角单元格
|
||||
///bottomRight: string, 右下角单元格
|
||||
///tableStyle: 表格选项类 TTableStyle
|
||||
///[includeHeader: bool] 是否包括表头,默认FALSE
|
||||
Function AddTable(sheet, topLeft, bottomRight, tableStyle, includeHeader);
|
||||
Begin
|
||||
@@ -803,8 +833,8 @@ Type TSExcelFile = Class
|
||||
|
||||
///添加形状
|
||||
///sheet: string,工作表名称
|
||||
///topLeft: string, 左上角单元格
|
||||
///bottomRight: string, 右下角单元格
|
||||
///topLeft: string, 左上角单元格
|
||||
///bottomRight: string, 右下角单元格
|
||||
///shapeType: string, 形状类型
|
||||
///format: 形状设置,TShapeFormat类
|
||||
Function AddShape(sheet, topLeft, bottomRight, shapeType, format);
|
||||
@@ -813,7 +843,7 @@ Type TSExcelFile = Class
|
||||
if ifObj(o) then return o.AddShape(topLeft, bottomRight, shapeType, format);
|
||||
End;
|
||||
|
||||
///设置工作簿的核心属性
|
||||
///设置工作簿的核心属性
|
||||
///coreProps: TCoreProperty对象
|
||||
Function SetCoreProps(coreProps);
|
||||
Begin
|
||||
@@ -896,6 +926,48 @@ Type TSExcelFile = Class
|
||||
return workbook_.GetCalcOptions();
|
||||
End;
|
||||
|
||||
///创建行的分级显示,根据给定的工作表、行号和分级参数创建组
|
||||
///sheet: string, 工作表名称
|
||||
///row: int, 行号
|
||||
///level: int, 分级参数
|
||||
Function SetRowOutlineLevel(sheet, row, level);
|
||||
Begin
|
||||
return workbook_.SetRowOutlineLevel(class(TSXml).CurCodePageToUtf8(sheet), row, level);
|
||||
End;
|
||||
|
||||
///获取行的分级参数
|
||||
///sheet: string, 工作表名称
|
||||
///row: int, 行号
|
||||
///返回: int,分级参数,分级不存在返回0
|
||||
Function GetRowOutlineLevel(sheet, row);
|
||||
Begin
|
||||
return workbook_.GetRowOutlineLevel(class(TSXml).CurCodePageToUtf8(sheet), row);
|
||||
End;
|
||||
|
||||
///
|
||||
|
||||
///创建列的分级显示,根据给定的工作表、列名和分级参数创建组
|
||||
///sheet: string, 工作表名称
|
||||
///col: string, 列名
|
||||
///level: int, 分级参数
|
||||
Function SetColOutlineLevel(sheet, col, level);
|
||||
Begin
|
||||
[err, col] := ColumnNameToNumber(col);
|
||||
if err then return "Col error.";
|
||||
return workbook_.SetColOutlineLevel(class(TSXml).CurCodePageToUtf8(sheet), col, level);
|
||||
End;
|
||||
|
||||
///获取列的分级参数
|
||||
///sheet: string, 工作表名称
|
||||
///col: string, 列名
|
||||
///返回: int,分级参数,分级不存在返回0
|
||||
Function GetColOutlineLevel(sheet, col);
|
||||
Begin
|
||||
[err, col] := ColumnNameToNumber(col);
|
||||
if err then return "Col error.";
|
||||
return workbook_.GetColOutlineLevel(class(TSXml).CurCodePageToUtf8(sheet), col);
|
||||
End;
|
||||
|
||||
Function WorkBook();
|
||||
Begin
|
||||
return workbook_;
|
||||
@@ -948,4 +1020,3 @@ private
|
||||
workbook_; //WorkBook对象
|
||||
objMgr_; //各种对象缓存、管理
|
||||
End;
|
||||
|
||||
|
||||
@@ -276,15 +276,9 @@ Type TTableContent = class
|
||||
z := docx_.Zip();
|
||||
xml := z.Get('word/' + name);
|
||||
if not ifObj(xml) then Begin
|
||||
path := docx_.GetPath();
|
||||
if path[1] = '/' then Begin
|
||||
fName := path + '/funcext/TSOffice/template/' + name;
|
||||
End
|
||||
else Begin
|
||||
fName := path + '\\funcext\\TSOffice\\template\\' + name;
|
||||
End;
|
||||
if not ReadFile(rwraw(), '', fName, 0, 100 * 1024, xmlData) then
|
||||
return;
|
||||
xmlData := TOfficeTemplate(name);
|
||||
if not ifString(xmlData) then
|
||||
return ;
|
||||
z.Add('word/' + name, xmlData);
|
||||
rels := 'word/_rels/document.xml.rels';
|
||||
relsObj := z.Get(rels);
|
||||
|
||||
@@ -60,6 +60,7 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||
authors_[ author ] := i ++;
|
||||
node := node.NextElement();
|
||||
End;
|
||||
initCommentObjs();
|
||||
//println('sheet={},commentfile={},vmlfile={}',sheet, commentXmlFile_, drawingVML_);
|
||||
End;
|
||||
|
||||
@@ -95,12 +96,13 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||
commentObj.Font.Bold := nil;
|
||||
commentObj.Space := 'preserve';
|
||||
domData := comments.Marshal();
|
||||
node := getComment(cell);
|
||||
if ifObj(node) then
|
||||
node := commentObjs_[cell];
|
||||
if ifObj(node) then
|
||||
node.DeleteChildren();
|
||||
else
|
||||
node := commentXmlFile_.FirstChildElement('comments').FirstChildElement('commentList').InsertEndChild('element', 'comment');
|
||||
node.UnMarshal(domData);
|
||||
commentObjs_[cell] := node;
|
||||
//commentXmlFile_.print;
|
||||
innerxml := '<v:shape id="_x0000_s1025" o:spt="202" type="#_x0000_t202" style="position:absolute;left:0pt;top:0pt;margin-left:59.85pt;margin-top:1.5pt;height:60pt;width:97.5pt;visibility:hidden;" fillcolor="#FFFFE1" filled="t" stroked="t" o:insetmode="auto" coordsize="21600,21600">
|
||||
<v:path/>
|
||||
@@ -126,14 +128,41 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||
clientData.Row := row - 1;
|
||||
ClientData.Column := col - 1;
|
||||
node.UnMarshal(clientData.Marshal());
|
||||
commentObjs_[ length(commentObjs_) ] := array(cell, node);
|
||||
//xmlObj.Print;
|
||||
End;
|
||||
End;
|
||||
return 'ok';
|
||||
End;
|
||||
|
||||
Function getComment(cell);
|
||||
Function GetComment(cell);
|
||||
Begin
|
||||
o := commentObjs_[cell];
|
||||
if not ifObj(o) then return array('', '');
|
||||
r_node := o.FirstChildElement('text').FirstChildElement('r');
|
||||
author := r_node.FirstChildElement('t').GetText();
|
||||
if length(author) > 1 then author := author[:length(author)-1];
|
||||
r_node := r_node.NextElement();
|
||||
comment := '';
|
||||
while ifObj(r_node) do
|
||||
begin
|
||||
comment += r_node.FirstChildElement('t').GetText();
|
||||
r_node := r_node.NextElement();
|
||||
end
|
||||
if length(comment) > 1 then comment := comment[2:];
|
||||
return array(author, comment);
|
||||
End;
|
||||
|
||||
Function RemoveComment(cell);
|
||||
Begin
|
||||
node := commentObjs_(cell);
|
||||
if ifObj(node) then
|
||||
commentXmlFile_.FirstChildElement('comments').DeleteChild(node);
|
||||
return array(0, 'ok');
|
||||
End;
|
||||
|
||||
private
|
||||
|
||||
Function initCommentObjs();
|
||||
Begin
|
||||
if not ifarray(commentObjs_) then Begin
|
||||
commentObjs_ := array();
|
||||
@@ -143,21 +172,12 @@ xmlns:v="urn:schemas-microsoft-com:vml">
|
||||
node := node.FirstChildElement('comment');
|
||||
while ifObj(node) do Begin
|
||||
ref := node.GetAttribute('ref');
|
||||
commentObjs_[index++] := array(ref, node);
|
||||
commentObjs_[ref] := node;
|
||||
node := node.NextElement();
|
||||
End;
|
||||
End;
|
||||
return vselect [1] from commentObjs_ where [0] = cell end;
|
||||
End;
|
||||
|
||||
Function RemoveComment(cell);
|
||||
Begin
|
||||
node := getComment(cell);
|
||||
if ifObj(node) then
|
||||
commentXmlFile_.FirstChildElement('comments').DeleteChild(node);
|
||||
return array(0, 'ok');
|
||||
End;
|
||||
private
|
||||
|
||||
authors_;
|
||||
commentId_;
|
||||
commentFileName_:string;//'../comments/comment1.xml'
|
||||
|
||||
@@ -43,7 +43,38 @@ Type xlsxStyles = Class
|
||||
node.InsertEndChild(xf.Marshal());
|
||||
node.SetAttribute('count', strtoint(count) + 1);
|
||||
return count;
|
||||
End
|
||||
End;
|
||||
|
||||
Function GetStyle(styleId);
|
||||
Begin
|
||||
if styleId = '' then return nil;
|
||||
style_node := styleXmlFile_.FirstChildElement('styleSheet');
|
||||
cellXfs_node := style_node.FirstChildElement('cellXfs');
|
||||
count := strtoint(cellXfs_node.GetAttribute('count'));
|
||||
Id := strtoint(styleId);
|
||||
if Id < count-1 then return nil;
|
||||
|
||||
xf := getNode(style_node, 'cellXfs', 'xf', Id);
|
||||
attrs := xf.Attributes();
|
||||
numfmt_id := trystrtoint(attrs['numFmtId'], r) ? r-1 : 0;
|
||||
font_id := trystrtoint(attrs['fontId'], r) ? r : 0;
|
||||
border_id := trystrtoint(attrs['borderId'], r) ? r : 0;
|
||||
fill_id := trystrtoint(attrs['fillId'], r) ? r : 0;
|
||||
|
||||
alignment := xf.FirstChildElement('alignment');
|
||||
protection := xf.FirstChildElement('protection');
|
||||
style := TOfficeObj('TStyle');
|
||||
setRootObj(style.NumberFormat, getNode(style_node, 'numFmts', 'numFmt', numfmt_id));
|
||||
setRootObj(style.Font, getNode(style_node, 'fonts', 'font', font_id));
|
||||
setRootObj(style.Border, getNode(style_node, 'borders', 'border', border_id));
|
||||
node := getNode(style_node, 'fills', 'fill', fill_id);
|
||||
setRootObj(style.Fill, node);
|
||||
setFillGradientObj(style.Fill.Gradient, node);
|
||||
style.Alignment.RootObj := ifObj(alignment) ? alignment : nil;
|
||||
style.Protection.RootObj := ifObj(protection) ? protection : nil;
|
||||
setNodeUri(style);
|
||||
return style;
|
||||
End;
|
||||
|
||||
class Function NewObject(sheetname, file);
|
||||
Begin
|
||||
@@ -54,6 +85,70 @@ Type xlsxStyles = Class
|
||||
End;
|
||||
|
||||
private
|
||||
|
||||
Function setFillGradientObj(obj, node);
|
||||
Begin
|
||||
gradient_node := node.FirstChildElement('gradientFill');
|
||||
if not ifObj(gradient_node) then return;
|
||||
stop_node := gradient_node.FirstChildElement('stop');
|
||||
if ifObj(stop_node) then
|
||||
begin
|
||||
obj.Stop1.RootObj := stop_node;
|
||||
obj.Stop1.NodeUri := '';
|
||||
end
|
||||
stop_node := stop_node.NextElement();
|
||||
if ifObj(stop_node) then
|
||||
begin
|
||||
obj.Stop2.RootObj := stop_node;
|
||||
obj.Stop2.NodeUri := '';
|
||||
end
|
||||
stop_node := stop_node.NextElement();
|
||||
if ifObj(stop_node) then
|
||||
begin
|
||||
obj.Stop3.RootObj := stop_node;
|
||||
obj.Stop3.NodeUri := '';
|
||||
end
|
||||
End;
|
||||
|
||||
Function setRootObj(obj, node);
|
||||
Begin
|
||||
obj.RootObj := node;
|
||||
children := obj.GetChildren();
|
||||
for i:=0 to length(children)-1 do
|
||||
begin
|
||||
val := children[i]['obj'];
|
||||
if ifObj(val) then
|
||||
begin
|
||||
val.NodeUri := children[i]['name'];
|
||||
val.RootObj := node;
|
||||
end
|
||||
end;
|
||||
End;
|
||||
|
||||
Function setNodeUri(obj);
|
||||
Begin
|
||||
obj.NodeUri := '';
|
||||
children := obj.GetChildren();
|
||||
for i:=0 to length(children)-1 do
|
||||
begin
|
||||
val := children[i]['obj'];
|
||||
if ifObj(val) then val.NodeUri := '';
|
||||
end;
|
||||
End;
|
||||
|
||||
Function getNode(rootNode, nodeName, name, count);
|
||||
Begin
|
||||
node := rootNode.FirstChildElement(nodeName);
|
||||
if not ifObj(node) then return nil;
|
||||
node := node.FirstChildElement(name);
|
||||
while count > 0 do
|
||||
begin
|
||||
node := node.NextElement();
|
||||
count--;
|
||||
end
|
||||
return node;
|
||||
End;
|
||||
|
||||
Function insertNode(rootNode, childName, obj);
|
||||
Begin
|
||||
marshal := obj.Marshal();
|
||||
|
||||
@@ -98,6 +98,13 @@ Type xlsxWorkBook = Class
|
||||
return class(ErrorMessage).Fail();
|
||||
End;
|
||||
|
||||
Function GetCellValueType(sheet, axis);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.GetAttribute(axis, '', 't')[1];
|
||||
return '';
|
||||
End;
|
||||
|
||||
Function SetCellValue(sheet, axis, val, opt);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
@@ -979,7 +986,7 @@ Type xlsxWorkBook = Class
|
||||
End
|
||||
node := node.NextElement();
|
||||
End
|
||||
ref := hcell $ ":" $ vcell;
|
||||
ref := hcell $ ":" $ vcell;
|
||||
node := merge_node.InsertEndChild('element', 'mergeCell');
|
||||
node.SetAttribute('ref', ref);
|
||||
merge_node.SetAttribute('count', count + 1);
|
||||
@@ -1351,7 +1358,100 @@ Type xlsxWorkBook = Class
|
||||
margins := TOfficeObj('tmargins');
|
||||
margins.RootObj := node;
|
||||
return margins;
|
||||
End
|
||||
End;
|
||||
|
||||
Function SetRowOutlineLevel(sheet, row, level);
|
||||
Begin
|
||||
sheet_obj := GetSheetObj(sheet);
|
||||
o := GetSheetObj(sheet);
|
||||
if not sheet_obj.RowIsExists(row) then
|
||||
begin
|
||||
[err, cell] := CoordinatesToCellName(1, row);
|
||||
sheet_obj.SetCellValue(cell, '');
|
||||
end
|
||||
sheet_obj.SetAttribute(row, array("outlineLevel": level));
|
||||
End;
|
||||
|
||||
Function GetRowOutlineLevel(sheet, row);
|
||||
Begin
|
||||
sheet_obj := GetSheetObj(sheet);
|
||||
o := GetSheetObj(sheet);
|
||||
if not sheet_obj.RowIsExists(row) then return 0;
|
||||
[err, level] := sheet_obj.GetAttribute(row, 'outlineLevel');
|
||||
return level = '' ? 0 : strtoint(level);
|
||||
End;
|
||||
|
||||
Function SetColOutlineLevel(sheet, col, level);
|
||||
Begin
|
||||
sheet_xml_file := GetSheetXmlFile(sheet);
|
||||
if not ifObj(sheet_xml_file) then return 'The Sheet is not exist.';
|
||||
work_node := sheet_xml_file.FirstChildElement('worksheet');
|
||||
col_node := work_node.FirstChildElement('cols');
|
||||
prev_node := class(TSXml).GetWorkSheetPrevNode(work_node, 'cols');
|
||||
if not ifObj(col_node) then col_node := work_node.InsertAfterChild(prev_node,'element', 'cols');
|
||||
node := col_node.FirstChildElement('col');
|
||||
while ifObj(node) do
|
||||
Begin
|
||||
min := strtoint(node.GetAttribute('min'));
|
||||
max := strtoint(node.GetAttribute('max'));
|
||||
if col >= min and col <= max then
|
||||
Begin
|
||||
level_val := node.GetAttribute('outlineLevel');
|
||||
if strtoint(level_val) = level then return;
|
||||
else Begin
|
||||
if col = min and col = max then node.SetAttribute('outlineLevel', level);
|
||||
else begin
|
||||
node2 := col_node.InsertAfterChild(node, node.Marshal()[0]);
|
||||
if col = min then
|
||||
begin
|
||||
node.SetAttribute('max', col);
|
||||
node.SetAttribute('outlineLevel', level);
|
||||
node2.SetAttribute('min', col-1);
|
||||
end
|
||||
else if col = max then
|
||||
begin
|
||||
node.SetAttribute('max', col-1);
|
||||
node2.SetAttribute('outlineLevel', level);
|
||||
node2.SetAttribute('min', col);
|
||||
end
|
||||
else begin
|
||||
node3 := col_node.InsertAfterChild(node, node.Marshal()[0]);
|
||||
node.SetAttribute('max', col - 1);
|
||||
node2.SetAttribute('min', col + 1);
|
||||
node3.SetAttribute('min', col);
|
||||
node3.SetAttribute('max', col);
|
||||
node3.SetAttribute('outlineLevel', level);
|
||||
end
|
||||
end
|
||||
return 'ok';
|
||||
End
|
||||
End
|
||||
node := node.NextElement();
|
||||
End
|
||||
arr := array('type': 'element', 'name': 'col', 'attributes': ('min': col, 'max': col, 'outlineLevel': level, 'customWidth': 1, 'width': 9.06640625));
|
||||
col_node.InsertEndChild(arr);
|
||||
return 'ok';
|
||||
End;
|
||||
|
||||
Function GetColOutlineLevel(sheet, col);
|
||||
Begin
|
||||
sheet_xml_file := GetSheetXmlFile(sheet);
|
||||
if not ifObj(sheet_xml_file) then return "Sheet error";
|
||||
work_node := sheet_xml_file.FirstChildElement('worksheet');
|
||||
col_node := work_node.FirstChildElement('cols');
|
||||
if not ifObj(col_node) then return 0;
|
||||
node := col_node.FirstChildElement('col');
|
||||
while ifObj(node) do
|
||||
begin
|
||||
min := strtoint(node.GetAttribute('min'));
|
||||
max := strtoint(node.GetAttribute('max'));
|
||||
val := node.GetAttribute('outlineLevel');
|
||||
if col >= min and col <= max then return val = '' ? 0 : strtoint(val);
|
||||
node := node.NextElement();
|
||||
end
|
||||
return 0;
|
||||
End;
|
||||
|
||||
|
||||
private
|
||||
Function generateRow(c1, c2, r);
|
||||
@@ -1433,5 +1533,5 @@ private
|
||||
sheetPrefix_:string;
|
||||
zipfile_;
|
||||
xmlFileObjMap_; //XmlFile对象存储
|
||||
sheetObjMap_; //XmlSheet对象存储
|
||||
sheetObjMap_; //XmlSheet对象存储
|
||||
End;
|
||||
|
||||
Reference in New Issue
Block a user