v1.1.4
This commit is contained in:
parent
8276de4e92
commit
bdf358b39b
|
|
@ -519,12 +519,15 @@ println("[success] ProtectSheet");
|
|||
|
||||
// SetDefaultFont
|
||||
font := tofficeobj('tfont');
|
||||
font.name := '黑体';
|
||||
font.size := 13;
|
||||
font.themecolor := 1;
|
||||
font.Name := '黑体';
|
||||
font.Size := 13;
|
||||
font.ThemeColor := 1;
|
||||
excel.SetDefaultFont(font);
|
||||
println("[success] SetDefaultFont");
|
||||
|
||||
tfont := excel.GetDefaultFont();
|
||||
println("[success] GetDefaultFont , name = {}, size = {}, themecolor = {}", tfont.Name, tfont.Size, tfont.ThemeColor);
|
||||
|
||||
[err, errmsg] := excel.saveas("", "d:\\temp\\test.xlsx");
|
||||
println("saveas : {}", err);
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +1,4 @@
|
|||
// Version 1.1.3
|
||||
|
||||
Version 1.1.4
|
||||
Function TOfficeObj(n);
|
||||
Begin
|
||||
case lowercase(n) of
|
||||
|
|
@ -337,6 +336,136 @@ type TFont=class(NodeInfo)
|
|||
RootObj := node;
|
||||
End;
|
||||
|
||||
Property Name read readXMLName write writeXMLName;
|
||||
Function readXMLName();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Name'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLName);
|
||||
End;
|
||||
|
||||
Function writeXMLName(str);
|
||||
Begin
|
||||
XMLName := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Size read readXMLSize write writeXMLSize;
|
||||
Function readXMLSize();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Size'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLSize);
|
||||
End;
|
||||
|
||||
Function writeXMLSize(str);
|
||||
Begin
|
||||
XMLSize := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Bold read readXMLBold write writeXMLBold;
|
||||
Function readXMLBold();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Bold'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLBold);
|
||||
End;
|
||||
|
||||
Function writeXMLBold(str);
|
||||
Begin
|
||||
XMLBold := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Italic read readXMLItalic write writeXMLItalic;
|
||||
Function readXMLItalic();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Italic'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLItalic);
|
||||
End;
|
||||
|
||||
Function writeXMLItalic(str);
|
||||
Begin
|
||||
XMLItalic := 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 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 Strikethrough read readXMLStrikethrough write writeXMLStrikethrough;
|
||||
Function readXMLStrikethrough();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Strikethrough'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLStrikethrough);
|
||||
End;
|
||||
|
||||
Function writeXMLStrikethrough(str);
|
||||
Begin
|
||||
XMLStrikethrough := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Script read readXMLScript write writeXMLScript;
|
||||
Function readXMLScript();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Script'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLScript);
|
||||
End;
|
||||
|
||||
Function writeXMLScript(str);
|
||||
Begin
|
||||
XMLScript := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Charset read readXMLCharset write writeXMLCharset;
|
||||
Function readXMLCharset();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Charset'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLCharset);
|
||||
End;
|
||||
|
||||
Function writeXMLCharset(str);
|
||||
Begin
|
||||
XMLCharset := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Underline read readXMLUnderline write writeXMLUnderline;
|
||||
Function readXMLUnderline();
|
||||
Begin
|
||||
tmpVal := class(TSXml).Utf8ToCurCodePage(Value('Underline'));
|
||||
if not ifNil(tmpVal) then return tmpVal;
|
||||
return class(TSXml).Utf8ToCurCodePage(XMLUnderline);
|
||||
End;
|
||||
|
||||
Function writeXMLUnderline(str);
|
||||
Begin
|
||||
XMLUnderline := class(TSXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
|
|
@ -346,16 +475,16 @@ type TFont=class(NodeInfo)
|
|||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"FontName","name":"name","obj":FontName,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Size","name":"sz","obj":Size,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Bold","name":"b","obj":Bold,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Italic","name":"i","obj":Italic,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Color","name":"color","obj":Color,"attrEx":"","nodeType":"","attrName":"rgb", "desc":"", "class":"")
|
||||
,("field":"ThemeColor","name":"color","obj":ThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Strikethrough","name":"strike","obj":Strikethrough,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Script","name":"vertAlign","obj":Script,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Charset","name":"charset","obj":Charset,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Underline","name":"u","obj":Underline,"attrEx":"","nodeType":"empty_string","attrName":"", "desc":"", "class":"")
|
||||
return array(("field":"Name","name":"name","obj":XMLName,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Size","name":"sz","obj":XMLSize,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Bold","name":"b","obj":XMLBold,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Italic","name":"i","obj":XMLItalic,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Color","name":"color","obj":XMLColor,"attrEx":"","nodeType":"","attrName":"rgb", "desc":"", "class":"")
|
||||
,("field":"ThemeColor","name":"color","obj":XMLThemeColor,"attrEx":"theme","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Strikethrough","name":"strike","obj":XMLStrikethrough,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Script","name":"vertAlign","obj":XMLScript,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Charset","name":"charset","obj":XMLCharset,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Underline","name":"u","obj":XMLUnderline,"attrEx":"","nodeType":"empty_string","attrName":"", "desc":"", "class":"")
|
||||
,("field":"FontStyle","name":"fontstyle","obj":FontStyle,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"OutlineFont","name":"outlinefont","obj":OutlineFont,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Shadow","name":"shadow","obj":Shadow,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
|
|
@ -369,26 +498,19 @@ type TFont=class(NodeInfo)
|
|||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
Property Name write writeName;
|
||||
Function writeName(n);
|
||||
Begin
|
||||
nName := class(TSXml).CurCodePageToUtf8(n);
|
||||
FontName := nName;
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
|
||||
//Nodes
|
||||
FontName;
|
||||
Size;
|
||||
Bold;
|
||||
Italic;
|
||||
Color;
|
||||
ThemeColor;
|
||||
Strikethrough;
|
||||
Script;
|
||||
Charset;
|
||||
Underline;
|
||||
XMLName;
|
||||
XMLSize;
|
||||
XMLBold;
|
||||
XMLItalic;
|
||||
XMLColor;
|
||||
XMLThemeColor;
|
||||
XMLStrikethrough;
|
||||
XMLScript;
|
||||
XMLCharset;
|
||||
XMLUnderline;
|
||||
FontStyle;
|
||||
OutlineFont;
|
||||
Shadow;
|
||||
|
|
@ -14176,3 +14298,5 @@ private
|
|||
middlePosition;
|
||||
|
||||
End
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// Version 1.1.3
|
||||
|
||||
Version 1.1.4
|
||||
Type TSDocxFile = Class
|
||||
///Version: V1.0 2022-09-20
|
||||
///适用于 Microsoft Word docx格式文件
|
||||
|
|
@ -466,3 +465,4 @@ private
|
|||
numberingObj_;
|
||||
DocPrId_;
|
||||
End;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// Version 1.1.3
|
||||
|
||||
Version 1.1.4
|
||||
Type TSExcelFile = Class
|
||||
///Version: V1.0 2022-08-08
|
||||
///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。
|
||||
|
|
@ -839,6 +838,13 @@ Type TSExcelFile = Class
|
|||
return workbook_.SetDefaultFont(font);
|
||||
End;
|
||||
|
||||
///获取默认字体
|
||||
///返回: TFont对象
|
||||
Function GetDefaultFont();
|
||||
Begin
|
||||
return workbook_.GetDefaultFont();
|
||||
End;
|
||||
|
||||
Function WorkBook();
|
||||
Begin
|
||||
return workbook_;
|
||||
|
|
@ -893,3 +899,4 @@ private
|
|||
workbook_; //WorkBook对象
|
||||
objMgr_; //各种对象缓存、管理
|
||||
End;
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ Type TNumbering = Class
|
|||
Function _setNsId(o);
|
||||
Begin
|
||||
v := Integer(RandomRange(1000000000,2000000000));
|
||||
id := inttohex(v);
|
||||
id := inttohex(v, 1);
|
||||
if hash_[id] then
|
||||
return _setNsId(o);
|
||||
hash_[id] := 1;
|
||||
|
|
|
|||
|
|
@ -1133,6 +1133,16 @@ Type xlsxWorkBook = Class
|
|||
fonts_node.InsertFirstChild(font.Marshal());
|
||||
End;
|
||||
|
||||
Function GetDefaultFont();
|
||||
Begin
|
||||
style_xml := GetXmlFileObj('xl/styles.xml');
|
||||
fonts_node := style_xml.FirstChildElement('styleSheet').FirstChildElement('fonts');
|
||||
first_node := fonts_node.FirstChildElement('font');
|
||||
tfont := TOfficeObj('TFont');
|
||||
tfont.RootObj := first_node;
|
||||
return tfont;
|
||||
End;
|
||||
|
||||
private
|
||||
Function generateRow(c1, c2, r);
|
||||
Begin
|
||||
|
|
|
|||
Loading…
Reference in New Issue