v1.0.4
This commit is contained in:
parent
88aa334c7a
commit
ee77e920b3
|
|
@ -13,14 +13,10 @@ if err then
|
|||
return PrintError("NewFile", err, errinfo);
|
||||
PrintSuccess("NewFile", testing++);
|
||||
|
||||
[err, errinfo] := file.SetSheetName('Sheet1', 'ExcelFile');
|
||||
if err then
|
||||
return PrintError("SetSheetName", err, errinfo);
|
||||
file.SetSheetName('Sheet1', 'ExcelFile');
|
||||
PrintSuccess("SetSheetName", testing++);
|
||||
|
||||
[err, errinfo] := file.NewSheet("Functions");
|
||||
if err then
|
||||
return PrintError("NewSheet", err, errinfo);
|
||||
file.NewSheet("Functions");
|
||||
PrintSuccess("NewSheet", testing++);
|
||||
|
||||
file.SetDefaultSheet('ExcelFile');
|
||||
|
|
@ -140,7 +136,7 @@ End
|
|||
file.SetColWidth('Functions', 'A', 'A', 120);
|
||||
PrintSuccess('SetColWidth', testing++);
|
||||
|
||||
saveName := utf8toansi("d:\\temp\\ExcelFile使用帮助.xlsx");
|
||||
saveName := utf8toansi("ExcelFile使用帮助.xlsx");
|
||||
[err, errinfo] := file.SaveAs('', saveName);
|
||||
if err then
|
||||
return PrintError("SaveAs", err, errinfo);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
class(xlsxXml).CodePage('中文');
|
||||
|
||||
testCount := 0;
|
||||
sheetName := "hello";
|
||||
sheetName2 := "world";
|
||||
sheetName := "你好";
|
||||
sheetName2 := "中文";
|
||||
|
||||
// OpenFile
|
||||
excel := new TSExcelFile();
|
||||
|
|
@ -25,30 +27,41 @@ PrintInfo("NewFile", err, errmsg);
|
|||
name := excel.FileName();
|
||||
println("[success] name = {}", name);
|
||||
|
||||
// GetSheet
|
||||
sheets := excel.GetSheets();
|
||||
println("[success] sheets = {}", sheets);
|
||||
|
||||
// GetSheetsCount
|
||||
sheetCount := excel.GetSheetsCount();
|
||||
println("[success] GetSheetsCount = {}", sheetCount);
|
||||
|
||||
// SetSheetName
|
||||
[err, errmsg] := excel.SetSheetName("sheet1", sheetName);
|
||||
PrintInfo("SetSheetName", err, errmsg);
|
||||
excel.SetSheetName("sheet1", sheetName);
|
||||
println("[success] SetSheetName");
|
||||
|
||||
// GetSheetName
|
||||
sheetName := excel.GetSheetName(0);
|
||||
println("[success] GetSheetName = {}", sheetName);
|
||||
Name := excel.GetSheetName(0);
|
||||
println("[success] GetSheetName = {}", Name);
|
||||
|
||||
// NewSheet
|
||||
[err, errmsg] := excel.NewSheet(sheetName2);
|
||||
PrintInfo("NewSheet", err, errmsg);
|
||||
excel.NewSheet(sheetName2);
|
||||
println("[success] NewSheet");
|
||||
|
||||
// GetSheets
|
||||
sheets := excel.GetSheets();
|
||||
println("[success] sheets = {}", sheets);
|
||||
|
||||
// DeleteSheet
|
||||
[err, errmsg] := excel.NewSheet("test1");
|
||||
//[err, errmsg] := excel.DeleteSheet("test1");
|
||||
//PrintInfo("DeleteSheet", err, errmsg);
|
||||
excel.NewSheet("test1");
|
||||
excel.DeleteSheet("test1");
|
||||
println("[success] DeleteSheet");
|
||||
|
||||
// SetCellValue
|
||||
excel.SetCellValue(sheetName, "A1", 100);
|
||||
excel.SetCellValue(sheetName, "F1", "中文的壹佰");
|
||||
println("[success] SetCellValue");
|
||||
|
||||
// GetCellValue
|
||||
[err, errmsg] := excel.GetCellValue(sheetName, "A1");
|
||||
PrintInfo("GetCellValue A1 ", err, errmsg);
|
||||
[err, errmsg] := excel.GetCellValue(sheetName, "F1");
|
||||
PrintInfo("GetCellValue F1 ", err, errmsg);
|
||||
|
||||
// TotalCols
|
||||
totalCols := excel.TotalCols(sheetName);
|
||||
|
|
@ -58,17 +71,9 @@ println("[success] TotalCols = {}", totalCols);
|
|||
totalRows := excel.TotalRows(sheetName);
|
||||
println("[success] TotalRows = {}", totalRows);
|
||||
|
||||
// SetCellValue
|
||||
flag := excel.SetCellValue(sheetName, "A1", 100);
|
||||
println("[success] SetCellValue = ", flag);
|
||||
|
||||
// GetCellValue
|
||||
[err, errmsg] := excel.GetCellValue(sheetName, "A1");
|
||||
PrintInfo("GetCellValue", err, errmsg);
|
||||
|
||||
// SetCellRichText
|
||||
richText := TOfficeObj('TRichtext');
|
||||
text1 := richText.AddText('Hello');
|
||||
text1 := richText.AddText('Hello 你好');
|
||||
text1.Font.Size := 35;
|
||||
text1.Font.Color := "FFF000";
|
||||
text2 := richText.AddText(" World");
|
||||
|
|
@ -77,10 +82,9 @@ text2.Font.Bold := true;
|
|||
excel.SetCellRichText(sheetName, "A2", richText);
|
||||
text2.Text := "python";
|
||||
excel.SetCellRichText(sheetName, "A3", richText);
|
||||
println("[success] SetCellRichText");
|
||||
|
||||
// GetCellRichText
|
||||
arr := excel.GetCellRichText(sheetName, "A3");
|
||||
arr := excel.GetCellRichText(sheetName, "A2");
|
||||
println("[success] GetCellRichText = {}", arr);
|
||||
|
||||
// ClearCell
|
||||
|
|
@ -192,8 +196,6 @@ excel.NewSheet('Sheet1');
|
|||
[err, errinfo] := excel.InsertTable("Sheet1","A5",data, true);
|
||||
chart1 := excel.AddChart('Sheet1', 'A11:G30', chart);
|
||||
println("[success] AddChart");
|
||||
[err, errmsg] := excel.saveas("", "d:\\temp\\test.xlsx");
|
||||
println("saveas : {}", err);
|
||||
|
||||
// GetCharts
|
||||
[err, charts] := excel.GetCharts('Sheet1');
|
||||
|
|
@ -443,6 +445,8 @@ shape_format.EndColOff := 7653;
|
|||
shape_format.BegRowOff := 55577;
|
||||
shape_format.EndRowOff := 66675;
|
||||
shape_type := "roundRect";
|
||||
//excel.AddShape(sheetName2, "A15", "C17", shape_type, shape_format);
|
||||
//println("[success] AddShape");
|
||||
|
||||
// SetCoreProps
|
||||
core := TOfficeObj('TCoreProperty');
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ _Faq(docx);
|
|||
///目录
|
||||
docx.AddTableContent(paragraphTitle, 1, 3);
|
||||
|
||||
v := docx.SaveAs('', 'TSDocFile-Help.docx');
|
||||
v := docx.SaveAs('', UTF8ToAnsi('DocxFile使用帮助.docx'));
|
||||
println('Test Over!\n Save {}: {},time={}秒', file, v, mtoc);
|
||||
|
||||
//info := GetProfilerInfo(true);
|
||||
|
|
@ -119,7 +119,7 @@ Begin
|
|||
|
||||
//添加段落
|
||||
preface := TOfficeObj('TParagraph');
|
||||
preface.Run.T := '本文档由word_help.tsl脚本,调用本文档中描述的接口自动生成!';
|
||||
preface.Run.SetText( '本文档由word_help.tsl脚本,调用本文档中描述的接口自动生成!' );
|
||||
preface.Format.FirstLineIndent := 220; //指定段落第一行缩进的相对差异的值
|
||||
preface.Format.LeftIndent := 440;//段落左边距
|
||||
preface.Font.Name := '宋体';
|
||||
|
|
@ -154,6 +154,7 @@ Begin
|
|||
|
||||
///TParagraph属性
|
||||
_AddTitle(docx, 'TParagraph属性', 2); //第二级标题
|
||||
attrs := array(('类别':'缺省w:r元素', '接口':'Run', '说明':'TRun对象'));
|
||||
formatObj := new TOfficeObj('TwpPr');
|
||||
_LoadObjectAttributes(formatObj, attrs, '段落属性', 'Format');
|
||||
fontObj := new TOfficeObj('TwrPr');
|
||||
|
|
@ -166,10 +167,16 @@ Begin
|
|||
conf union= _LoadClassInfo(docx.GetPath() + '\\funcext\\TSOffice\\TOfficeObj.tsf', 'DocObject');
|
||||
_AddFunctionHelpInfo(docx, '' $ paragraph $ '.2.', conf, 3);
|
||||
|
||||
///TRun方法
|
||||
_AddTitle(docx, 'TRun方法(段落中w:r元素)', 2);
|
||||
conf := _LoadClassInfo(docx.GetPath() + '\\funcext\\TSOffice\\TOfficeObj.tsf', 'TRun');
|
||||
conf union= _LoadClassInfo(docx.GetPath() + '\\funcext\\TSOffice\\TOfficeObj.tsf', 'DocObject');
|
||||
_AddFunctionHelpInfo(docx, '' $ paragraph $ '.3.', conf, 3);
|
||||
|
||||
///TTabStops对象
|
||||
_AddTitle(docx, 'TTabStops对象', 2);
|
||||
conf := _LoadClassInfo(docx.GetPath() + '\\funcext\\TSOffice\\TOfficeObj.tsf', 'TTabStops');
|
||||
_AddFunctionHelpInfo(docx, '' $ paragraph $ '.3.', conf, 3);
|
||||
_AddFunctionHelpInfo(docx, '' $ paragraph $ '.4.', conf, 3);
|
||||
|
||||
///TabStop属性
|
||||
_AddTitle(docx, 'TTabStop属性', 2); //第二级标题
|
||||
|
|
@ -287,7 +294,7 @@ Begin
|
|||
p1 := TOfficeObj('TParagraph');
|
||||
p1.Format.FirstLineIndent := 220; //指定段落第一行缩进的相对差异的值
|
||||
p1.Format.LeftIndent := 440;//段落左边距
|
||||
p1.Run.AddText('本文档由天软科技制作。');
|
||||
p1.Run.SetText('本文档由天软科技制作。');
|
||||
p1.Run.rPr.Name := '宋体';
|
||||
p1.Run.rPr.Bold := true;
|
||||
p1.Run.rPr.Size := 32;
|
||||
|
|
@ -375,7 +382,7 @@ Begin
|
|||
p1 := TOfficeObj('TParagraph');
|
||||
p1.Format.FirstLineIndent := 220; //指定段落第一行缩进的相对差异的值
|
||||
p1.Format.LeftIndent := 440;//段落左边距
|
||||
p1.Run.T := '插入案例。';
|
||||
p1.Run.SetText( '插入案例。' );
|
||||
p1.Run.rPr.Name := '宋体';
|
||||
p1.Run.rPr.Bold := true;
|
||||
p1.Run.rPr.Size := 32;
|
||||
|
|
@ -394,7 +401,7 @@ Begin
|
|||
p1 := TOfficeObj('TParagraph');
|
||||
p1.Format.FirstLineIndent := 220; //指定段落第一行缩进的相对差异的值
|
||||
p1.Format.LeftIndent := 440;//段落左边距
|
||||
p1.Run.T := '删除修订案例。';
|
||||
p1.Run.SetText( '删除修订案例。' );
|
||||
p1.Run.rPr.Name := '宋体';
|
||||
p1.Run.rPr.Bold := true;
|
||||
p1.Run.rPr.Size := 32;
|
||||
|
|
@ -481,7 +488,7 @@ Begin
|
|||
///添加页眉、页脚案例
|
||||
_AddTitle(docx, '添加页眉、页脚案例', 2);
|
||||
help := TOfficeObj('TParagraph');
|
||||
help.Run.T := '参考word_help.tsl脚本(TDocxFile::Sections, TDocSection::AddHeader, TDocSection::AddFooter)!';
|
||||
help.Run.SetText( '参考word_help.tsl脚本(TDocxFile::Sections, TDocSection::AddHeader, TDocSection::AddFooter)!' );
|
||||
help.Format.FirstLineIndent := 220; //指定段落第一行缩进的相对差异的值
|
||||
help.Format.LeftIndent := 440;//段落左边距
|
||||
help.Font.Name := '宋体';
|
||||
|
|
@ -494,7 +501,7 @@ Begin
|
|||
footer := section.AddFooter('');//添加缺省页脚
|
||||
//页脚内容
|
||||
p := TOfficeObj('TParagraph');
|
||||
p.Run.T := '电 话:0755-83937039';
|
||||
p.Run.SetText( '电 话:0755-83937039' );
|
||||
p.AddRun('网 址:http://www.tinysoft.com.cn', true);
|
||||
p.AddRun('公司地址:深圳市福田区莲花街道梅岭社区新闻路59号深茂商业中心19F', true);
|
||||
p.Format.Bdr.Top.val := 'single';//页脚横线
|
||||
|
|
@ -512,7 +519,7 @@ Begin
|
|||
//添加页眉
|
||||
header := section.AddHeader('');//添加缺省页眉
|
||||
p := TOfficeObj('TParagraph');
|
||||
p.Run.T := '深圳市天软科技开发有限公司';
|
||||
p.Run.SetText( '深圳市天软科技开发有限公司' );
|
||||
p.Format.Alignment := 'right'; //据右对齐
|
||||
//p.Format.Bdr.Bottom.val := 'single';//页眉横线
|
||||
p.Font.Name := '宋体';
|
||||
|
|
@ -565,7 +572,7 @@ Begin
|
|||
p1 := TOfficeObj('TParagraph');
|
||||
p1.Format.FirstLineIndent := 220; //指定段落第一行缩进的相对差异的值
|
||||
p1.Format.LeftIndent := 440;//段落左边距
|
||||
p1.Run.T := '深圳市天软公司';
|
||||
p1.Run.SetText( '深圳市天软公司' );
|
||||
p1.Run.rPr.Name := '宋体';
|
||||
pTest := docx.AddParagraph(p1, -1, nil);
|
||||
//修改部分文字字体
|
||||
|
|
@ -641,7 +648,7 @@ Begin
|
|||
p.Font.Color := 'FF0000';
|
||||
p.Font.Bold := true;
|
||||
p.Format.LeftIndent := 700;//段落左边距
|
||||
p.Run.T := 'NumberId("bullet", ' $ i $ ')';
|
||||
p.Run.SetText( 'NumberId("bullet", ' $ i $ ')' );
|
||||
docx.AddParagraph(p, -1, nil);
|
||||
End;
|
||||
|
||||
|
|
@ -814,7 +821,7 @@ Begin
|
|||
if not ifString(conf[i]['comment']) or conf[i]['comment'] = '' then continue;
|
||||
arr := str2array(conf[i]['funcname'], '(');
|
||||
k := lowercase(arr[0]);
|
||||
if hash[k]=1 and ( not k in array('create')) then continue;
|
||||
if hash[k]=1 and not (k in array('create')) then continue;
|
||||
hash[k] := 1;
|
||||
subject := head $ ind++ $ ' ' $ conf[i]['funcname'];
|
||||
_AddTitle(docx, conf[i]['funcname'], level);
|
||||
|
|
@ -825,7 +832,7 @@ Begin
|
|||
pFun.Format.LeftIndent := 1760;//段落左边距
|
||||
pFun.Font.Name := '宋体';
|
||||
println(' Subject:{}', subject);
|
||||
pFun.Run.T := 'Function ' + conf[i]['funcname'];
|
||||
pFun.Run.SetText( 'Function ' + conf[i]['funcname'] );
|
||||
p1 := docx.AddParagraph(pFun, -1, nil);//函数方法
|
||||
//设置首行字体颜色、黑体
|
||||
firstRun := p1.GetRun(0);
|
||||
|
|
@ -836,7 +843,7 @@ Begin
|
|||
//添加函数帮助信息段落
|
||||
arr := str2array(conf[i]['comment'], '\n');
|
||||
for j:=0 to length(arr)-1 do Begin
|
||||
pFun.Run.T := '///' + arr[j];
|
||||
pFun.Run.SetText('///' + arr[j]);
|
||||
p2 := docx.AddParagraph(pFun, -1, nil);
|
||||
End;
|
||||
|
||||
|
|
@ -1088,7 +1095,7 @@ Begin
|
|||
str := str[2:];
|
||||
println(' FAQ: {}', str);
|
||||
End;
|
||||
p.Run.T := str;
|
||||
p.Run.SetText( str );
|
||||
End;
|
||||
if title then Begin
|
||||
p.Format.numPr.Level := 0;//项目编号
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,3 +1,4 @@
|
|||
// Version 1.0.4
|
||||
Function TOfficeObj(n);
|
||||
Begin
|
||||
case lowercase(n) of
|
||||
|
|
@ -199,8 +200,8 @@ Begin
|
|||
return new TwInline();
|
||||
"twdrawing":
|
||||
return new TwDrawing();
|
||||
"tinstrtext":
|
||||
return new TInstrText();
|
||||
"ttext":
|
||||
return new TText();
|
||||
"trun":
|
||||
return new TRun();
|
||||
"tbookmark":
|
||||
|
|
@ -333,52 +334,59 @@ type TFont=class(NodeInfo)
|
|||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"Background","name":"background","obj":Background,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Bold","name":"b","obj":Bold,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Color","name":"color","obj":Color,"attrEx":"","nodeType":"","attrName":"rgb", "desc":"", "class":"")
|
||||
,("field":"ColorIndex","name":"color","obj":ColorIndex,"attrEx":"index","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"FontStyle","name":"fontstyle","obj":FontStyle,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Italic","name":"i","obj":Italic,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Name","name":"name","obj":Name,"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":"")
|
||||
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":"Strikethrough","name":"strike","obj":Strikethrough,"attrEx":"","nodeType":"empty","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Subscript","name":"subscript","obj":Subscript,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Superscript","name":"superscript","obj":Superscript,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Underline","name":"u","obj":Underline,"attrEx":"","nodeType":"empty_string","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":"TintAndShade","name":"tintandshade","obj":TintAndShade,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ThemeFont","name":"scheme","obj":ThemeFont,"attrEx":"","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":"")
|
||||
,("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":"")
|
||||
,("field":"TintAndShade","name":"tintandshade","obj":TintAndShade,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Background","name":"background","obj":Background,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"rFont","name":"rFont","obj":rFont,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ThemeFont","name":"scheme","obj":ThemeFont,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ColorIndex","name":"color","obj":ColorIndex,"attrEx":"index","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Subscript","name":"subscript","obj":Subscript,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Superscript","name":"superscript","obj":Superscript,"attrEx":"","nodeType":"","attrName":"", "desc":"", "class":"")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
Property Name write writeName;
|
||||
Function writeName(n);
|
||||
Begin
|
||||
nName := class(xlsxXml).CurCodePageToUtf8(n);
|
||||
FontName := nName;
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
|
||||
//Nodes
|
||||
Background;
|
||||
Bold;
|
||||
Color;
|
||||
ColorIndex;
|
||||
FontStyle;
|
||||
Italic;
|
||||
Name;
|
||||
OutlineFont;
|
||||
Shadow;
|
||||
FontName;
|
||||
Size;
|
||||
Strikethrough;
|
||||
Subscript;
|
||||
Superscript;
|
||||
Underline;
|
||||
Bold;
|
||||
Italic;
|
||||
Color;
|
||||
ThemeColor;
|
||||
TintAndShade;
|
||||
ThemeFont;
|
||||
Strikethrough;
|
||||
Script;
|
||||
Charset;
|
||||
Underline;
|
||||
FontStyle;
|
||||
OutlineFont;
|
||||
Shadow;
|
||||
TintAndShade;
|
||||
Background;
|
||||
rFont;
|
||||
ThemeFont;
|
||||
ColorIndex;
|
||||
Subscript;
|
||||
Superscript;
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
|
@ -3660,7 +3668,7 @@ type THyperLink=class(NodeInfo)
|
|||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("LinkType", "linkType", LinkType, ""),("LinkUrl", "linkUrl", LinkUrl, ""),("Axis", "ref", Axis, ""),("Display", "display", Display, ""),("Tooltip", "tooltip", Tooltip, "")) union ExtAttr;
|
||||
return array(("LinkType", "linkType", LinkType, ""),("Url", "linkUrl", Url, ""),("Axis", "ref", Axis, ""),("LinkDisplay", "display", LinkDisplay, ""),("LinkTooltip", "tooltip", LinkTooltip, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
|
|
@ -3669,12 +3677,30 @@ type THyperLink=class(NodeInfo)
|
|||
return ExtNodes;
|
||||
End;
|
||||
|
||||
Property LinkUrl read Url write writeUrl;
|
||||
Function writeUrl(str);
|
||||
Begin
|
||||
Url := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Display read LinkDisplay write writeLinkDisplay;
|
||||
Function writeLinkDisplay(str);
|
||||
Begin
|
||||
LinkDisplay := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Tooltip read LinkTooltip write writeLinkTooltip;
|
||||
Function writeLinkTooltip(str);
|
||||
Begin
|
||||
LinkTooltip := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
LinkType;
|
||||
LinkUrl;
|
||||
Url;
|
||||
Axis;
|
||||
Display;
|
||||
Tooltip;
|
||||
LinkDisplay;
|
||||
LinkTooltip;
|
||||
|
||||
//Nodes
|
||||
End;
|
||||
|
|
@ -3798,30 +3824,54 @@ type TAppProperty=class(NodeInfo)
|
|||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"Application","name":"Application","obj":Application,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
return array(("field":"AppApplication","name":"Application","obj":AppApplication,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"DocSecurity","name":"DocSecurity","obj":DocSecurity,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ScaleCrop","name":"ScaleCrop","obj":ScaleCrop,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Manager","name":"Manager","obj":Manager,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Company","name":"Company","obj":Company,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"AppManager","name":"Manager","obj":AppManager,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"AppCompany","name":"Company","obj":AppCompany,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"LinksUpToDate","name":"LinksUpToDate","obj":LinksUpToDate,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"SharedDoc","name":"SharedDoc","obj":SharedDoc,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"HyperlinkBase","name":"HyperlinkBase","obj":HyperlinkBase,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"AppHyperlinkBase","name":"HyperlinkBase","obj":AppHyperlinkBase,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"HyperlinksChanged","name":"HyperlinksChanged","obj":HyperlinksChanged,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"AppVersion","name":"AppVersion","obj":AppVersion,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
Property Application read AppApplication write writeAppApplication;
|
||||
Function writeAppApplication(str);
|
||||
Begin
|
||||
AppApplication := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Manager read AppManager write writeAppManager;
|
||||
Function writeAppManager(str);
|
||||
Begin
|
||||
AppManager := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Company read AppCompany write writeAppCompany;
|
||||
Function writeAppCompany(str);
|
||||
Begin
|
||||
AppCompany := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property HyperlinkBase read AppHyperlinkBase write writeAppHyperlinkBase;
|
||||
Function writeAppHyperlinkBase(str);
|
||||
Begin
|
||||
AppHyperlinkBase := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
|
||||
//Nodes
|
||||
Application;
|
||||
AppApplication;
|
||||
DocSecurity;
|
||||
ScaleCrop;
|
||||
Manager;
|
||||
Company;
|
||||
AppManager;
|
||||
AppCompany;
|
||||
LinksUpToDate;
|
||||
SharedDoc;
|
||||
HyperlinkBase;
|
||||
AppHyperlinkBase;
|
||||
HyperlinksChanged;
|
||||
AppVersion;
|
||||
End;
|
||||
|
|
@ -3855,30 +3905,84 @@ type TCoreProperty=class(NodeInfo)
|
|||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"Title","name":"dc:title","obj":Title,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Subject","name":"dc:subject","obj":Subject,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Creator","name":"dc:creator","obj":Creator,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Keywords","name":"cp:keywords","obj":Keywords,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Description","name":"dc:description","obj":Description,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"LastModifiedBy","name":"cp:lastModifiedBy","obj":LastModifiedBy,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"LastPrinted","name":"cp:lastPrinted","obj":LastPrinted,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"Category","name":"cp:category","obj":Category,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"ContentStatus","name":"cp:contentStatus","obj":ContentStatus,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
return array(("field":"CoreTitle","name":"dc:title","obj":CoreTitle,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"CoreSubject","name":"dc:subject","obj":CoreSubject,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"CoreCreator","name":"dc:creator","obj":CoreCreator,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"CoreKeywords","name":"cp:keywords","obj":CoreKeywords,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"CoreDescription","name":"dc:description","obj":CoreDescription,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"CoreLastModifiedBy","name":"cp:lastModifiedBy","obj":CoreLastModifiedBy,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"CoreLastPrinted","name":"cp:lastPrinted","obj":CoreLastPrinted,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"CoreCategory","name":"cp:category","obj":CoreCategory,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
,("field":"CoreContentStatus","name":"cp:contentStatus","obj":CoreContentStatus,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
Property Title read CoreTitle write writeCoreTitle;
|
||||
Function writeCoreTitle(str);
|
||||
Begin
|
||||
CoreTitle := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Subject read CoreSubject write writeCoreSubject;
|
||||
Function writeCoreSubject(str);
|
||||
Begin
|
||||
CoreSubject := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Creator read CoreCreator write writeCoreCreator;
|
||||
Function writeCoreCreator(str);
|
||||
Begin
|
||||
CoreCreator := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Keywords read CoreKeywords write writeCoreKeywords;
|
||||
Function writeCoreKeywords(str);
|
||||
Begin
|
||||
CoreKeywords := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Description read CoreDescription write writeCoreDescription;
|
||||
Function writeCoreDescription(str);
|
||||
Begin
|
||||
CoreDescription := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property LastModifiedBy read CoreLastModifiedBy write writeCoreLastModifiedBy;
|
||||
Function writeCoreLastModifiedBy(str);
|
||||
Begin
|
||||
CoreLastModifiedBy := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property LastPrinted read CoreLastPrinted write writeCoreLastPrinted;
|
||||
Function writeCoreLastPrinted(str);
|
||||
Begin
|
||||
CoreLastPrinted := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property Category read CoreCategory write writeCoreCategory;
|
||||
Function writeCoreCategory(str);
|
||||
Begin
|
||||
CoreCategory := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
Property ContentStatus read CoreContentStatus write writeCoreContentStatus;
|
||||
Function writeCoreContentStatus(str);
|
||||
Begin
|
||||
CoreContentStatus := class(xlsxXml).CurCodePageToUtf8(str);
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
|
||||
//Nodes
|
||||
Title;
|
||||
Subject;
|
||||
Creator;
|
||||
Keywords;
|
||||
Description;
|
||||
LastModifiedBy;
|
||||
LastPrinted;
|
||||
Category;
|
||||
ContentStatus;
|
||||
CoreTitle;
|
||||
CoreSubject;
|
||||
CoreCreator;
|
||||
CoreKeywords;
|
||||
CoreDescription;
|
||||
CoreLastModifiedBy;
|
||||
CoreLastPrinted;
|
||||
CoreCategory;
|
||||
CoreContentStatus;
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
|
@ -4019,10 +4123,13 @@ type TwrPr=class(NodeInfo)
|
|||
Property Name write writeName;
|
||||
Function writeName(n);
|
||||
Begin
|
||||
rFont.cs := n;
|
||||
rFont.eastAsia := n;
|
||||
rFont.hAnsi := n;
|
||||
rFont.ascii := n;
|
||||
nName := n;
|
||||
if not class(xlsxXml).IsUtf8() then
|
||||
nName := class(xlsxXml).CurCodePageToUtf8(n);
|
||||
rFont.cs := nName;
|
||||
rFont.eastAsia := nName;
|
||||
rFont.hAnsi := nName;
|
||||
rFont.ascii := nName;
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
|
|
@ -5073,12 +5180,12 @@ type TwDrawing=class(NodeInfo)
|
|||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
/// TInstrText
|
||||
/// TText
|
||||
///////////////////////////////////////////////////////////////
|
||||
type TInstrText=class(NodeInfo)
|
||||
type TText=class(NodeInfo)
|
||||
Function Create(); overload;
|
||||
Begin
|
||||
Create(nil, 'w:instrText');
|
||||
Create(nil, 'w:t');
|
||||
End;
|
||||
|
||||
Function Create(p, name); overload;
|
||||
|
|
@ -5101,7 +5208,7 @@ type TInstrText=class(NodeInfo)
|
|||
Function GetChildren(); override;
|
||||
Begin
|
||||
HandleChildren();
|
||||
return array(("field":"Data","name":"Data","obj":Data,"attrEx":"","nodeType":"pcdata","attrName":"", "desc":"", "class":"")
|
||||
return array(("field":"Text","name":"Text","obj":Text,"attrEx":"","nodeType":"tcdata","attrName":"", "desc":"", "class":"")
|
||||
) union ExtNodes;
|
||||
End;
|
||||
|
||||
|
|
@ -5109,7 +5216,7 @@ type TInstrText=class(NodeInfo)
|
|||
Space;
|
||||
|
||||
//Nodes
|
||||
Data;
|
||||
Text;
|
||||
End;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
|
@ -7463,7 +7570,7 @@ type TTableStyle=class(NodeInfo)
|
|||
Function GetAttrs(); override;
|
||||
Begin
|
||||
HandleAttrs();
|
||||
return array(("TableName", "tableName", TableName, ""),("TableStyle", "name", TableStyle, ""),("ShowFirstColumn", "showFirstColumn", ShowFirstColumn, ""),("ShowLastColumn", "showLastColumn", ShowLastColumn, ""),("ShowRowStripes", "showRowStripes", ShowRowStripes, ""),("ShowColumnStripes", "showColumnStripes", ShowColumnStripes, ""),("HeaderRowCount", "HeaderRowCount", HeaderRowCount, ""),("TotalsRowShown", "totalsRowShown", TotalsRowShown, "")) union ExtAttr;
|
||||
return array(("Name", "tableName", Name, ""),("TableStyle", "name", TableStyle, ""),("ShowFirstColumn", "showFirstColumn", ShowFirstColumn, ""),("ShowLastColumn", "showLastColumn", ShowLastColumn, ""),("ShowRowStripes", "showRowStripes", ShowRowStripes, ""),("ShowColumnStripes", "showColumnStripes", ShowColumnStripes, ""),("HeaderRowCount", "HeaderRowCount", HeaderRowCount, ""),("TotalsRowShown", "totalsRowShown", TotalsRowShown, "")) union ExtAttr;
|
||||
End;
|
||||
|
||||
Function GetChildren(); override;
|
||||
|
|
@ -7472,8 +7579,14 @@ type TTableStyle=class(NodeInfo)
|
|||
return ExtNodes;
|
||||
End;
|
||||
|
||||
Property TableName read Name write writeName;
|
||||
Function writeName(n);
|
||||
Begin
|
||||
Name := class(xlsxXml).CurCodePageToUtf8(n);
|
||||
End;
|
||||
|
||||
//Attributes
|
||||
TableName;
|
||||
Name;
|
||||
TableStyle;
|
||||
ShowFirstColumn;
|
||||
ShowLastColumn;
|
||||
|
|
@ -7655,6 +7768,13 @@ Type DocObject = Class
|
|||
Begin
|
||||
obj.NodeName := 'w:ins';
|
||||
obj.name_ := obj.NodeName;
|
||||
tmpAuthor := obj.Author;
|
||||
tmpTxt := obj.InsText;
|
||||
if not class(xlsxXml).IsUtf8() then Begin
|
||||
if ifstring(obj.Author) then
|
||||
obj.Author := class(xlsxXml).CurCodePageToUtf8(obj.Author);
|
||||
obj.InsText := class(xlsxXml).CurCodePageToUtf8(obj.InsText);
|
||||
End;
|
||||
r := _split_range(obj.sPos, 0);
|
||||
if length(r) then Begin
|
||||
rNode := r[length(r)-1]['rNode'];
|
||||
|
|
@ -7676,7 +7796,9 @@ Type DocObject = Class
|
|||
node2 := node.InsertEndChild('element', 'w:r');
|
||||
End;
|
||||
run := new TRun(node2);
|
||||
run.SetText(obj.InsText);
|
||||
run.SetText(obj.InsText, true);
|
||||
obj.InsText := tmpTxt;
|
||||
obj.Author := tmpAuthor;
|
||||
obj.Init(node);
|
||||
return true;
|
||||
End;
|
||||
|
|
@ -7686,6 +7808,9 @@ Type DocObject = Class
|
|||
///返回:成功 true,失败 false
|
||||
Function DelRevision(obj);
|
||||
Begin
|
||||
tmpAuthor := obj.Author;
|
||||
if ifstring(obj.Author) and not class(xlsxXml).IsUtf8() then
|
||||
obj.Author := class(xlsxXml).CurCodePageToUtf8(obj.Author);
|
||||
r := _split_range(obj.sPos, obj.SelectLength);
|
||||
for i:=0 to length(r)-1 do Begin
|
||||
rNode := r[i]['rNode'];
|
||||
|
|
@ -7695,6 +7820,7 @@ Type DocObject = Class
|
|||
delNode.InsertFirstChild(rXml);
|
||||
rNode.Parent().DeleteChild(rNode);
|
||||
End;
|
||||
obj.Author := tmpAuthor;
|
||||
return length(r);
|
||||
End;
|
||||
|
||||
|
|
@ -7804,7 +7930,9 @@ Type DocObject = Class
|
|||
rSize := 0;
|
||||
for i:=0 to length(r)-1 do Begin
|
||||
run := new TRun(r[i]['rNode']);
|
||||
txt := UTF8ToAnsi(run.Text());
|
||||
txt := run.Text();
|
||||
if class(xlsxXml).IsUtf8() then
|
||||
txt := UTF8ToAnsi(txt);
|
||||
txtLen := lengthW(txt);
|
||||
if rangeLength >= 0 and sPos + rangeLength <= rSize then Begin
|
||||
return t;
|
||||
|
|
@ -8242,8 +8370,8 @@ Type TParagraph = Class(DocObject, TParagraphImpl)
|
|||
o := new TRun();
|
||||
o.Parent := self;
|
||||
NewChildNode( array("field":"", "name":"w:r", "obj":o, "attrEx":"", "nodeType":"") );
|
||||
if ifString(txt) then
|
||||
o.T := txt;
|
||||
if txt then
|
||||
o.SetText(txt);
|
||||
if newLine then
|
||||
o.Br.Type := '';
|
||||
return o;
|
||||
|
|
@ -8492,26 +8620,52 @@ Type TRun = Class(DocObject, TRunImpl)
|
|||
End;
|
||||
|
||||
///添加文字
|
||||
Function AddText(txt);
|
||||
///[isUtf8]:可选参数,当前字符集是否utf8,缺省false
|
||||
Function AddText(txt, isUtf8);
|
||||
Begin
|
||||
str := txt;
|
||||
if not isUtf8 and not class(xlsxXml).IsUtf8() then
|
||||
str := class(xlsxXml).CurCodePageToUtf8(txt);
|
||||
if ifObj(node_) then Begin
|
||||
_insertText(txt, false);
|
||||
_insertText(str, false);
|
||||
return;
|
||||
End;
|
||||
lines := str2array(txt,'\n');
|
||||
for i:=0 to length(lines)-1 do Begin
|
||||
//line := TrimRight(lines[i]);
|
||||
if i then
|
||||
NewChildNode( array("field":"", "name":"w:br", "obj":1, "attrEx":"", "nodeType":"empty") );
|
||||
lines := str2array(str,'\n');
|
||||
T := lines[0];
|
||||
if _preserve(T) then
|
||||
Space := 'preserve';
|
||||
for i:=1 to length(lines)-1 do Begin
|
||||
NewChildNode( array("field":"", "name":"w:br", "obj":1, "attrEx":"", "nodeType":"empty") );
|
||||
NewChildNode( array("field":"", "name":"w:t", "obj":lines[i], "attrEx":"", "nodeType":"pcdata") );
|
||||
if _preserve(lines[i]) then
|
||||
NewChildNode( array("field":"", "name":"w:t", "obj":'preserve', "attrEx":"xml:space", "nodeType":"") );
|
||||
End;
|
||||
End;
|
||||
|
||||
///修改文字
|
||||
Function SetText(txt);
|
||||
///[isUtf8]:可选参数,当前字符集是否utf8,缺省false
|
||||
Function SetText(txt, isUtf8);
|
||||
Begin
|
||||
ClearText();//删除原来文字
|
||||
_insertText(txt, false);//添加文字
|
||||
str := txt;
|
||||
if not isUtf8 and not class(xlsxXml).IsUtf8() then
|
||||
str := class(xlsxXml).CurCodePageToUtf8(txt);
|
||||
if ifObj(node_) then Begin
|
||||
ClearText();//删除原来文字
|
||||
_insertText(str, false);//添加文字
|
||||
return;
|
||||
End;
|
||||
ExtNodes := array();
|
||||
T := nil;
|
||||
AddText(str, true);
|
||||
End;
|
||||
|
||||
Function _preserve(str);
|
||||
Begin
|
||||
cnt := length(str);
|
||||
spaceArr := array(' ',' ');
|
||||
if cnt and (str[1] in spaceArr or (cnt > 1 and str[cnt] in spaceArr)) then
|
||||
return true;
|
||||
return false;
|
||||
End;
|
||||
|
||||
Function _insertText(txt, first);
|
||||
|
|
@ -8545,6 +8699,8 @@ Type TRun = Class(DocObject, TRunImpl)
|
|||
// txt += '\n';
|
||||
tNode := tNode.NextElement();
|
||||
End;
|
||||
if not class(xlsxXml).IsUtf8() then
|
||||
return class(xlsxXml).Utf8ToCurCodePage(txt);
|
||||
return txt;
|
||||
End;
|
||||
|
||||
|
|
@ -8559,11 +8715,13 @@ Type TRun = Class(DocObject, TRunImpl)
|
|||
///清除全部文字内容
|
||||
Function ClearText();
|
||||
Begin
|
||||
n := node_.FirstChildElement('w:t');
|
||||
while ifObj(n) do Begin
|
||||
next := n.NextElement('w:t');
|
||||
node_.DeleteChild(n);
|
||||
n := next;
|
||||
if ifObj(node_) then Begin
|
||||
n := node_.FirstChildElement('w:t');
|
||||
while ifObj(n) do Begin
|
||||
next := n.NextElement('w:t');
|
||||
node_.DeleteChild(n);
|
||||
n := next;
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
|
||||
|
|
@ -8732,7 +8890,22 @@ Type TChart = Class(TChartImpl)
|
|||
///添加图表Series数据
|
||||
Function AddSeries(Name, Categories, Value);
|
||||
Begin
|
||||
Series union= array(("Name":Name,"Categories":Categories,"Values":Value));
|
||||
SerName := name;
|
||||
catArr := Categories;
|
||||
if not class(xlsxXml).IsUtf8() then Begin
|
||||
if name and ifstring(name) then
|
||||
SerName := class(xlsxXml).CurCodePageToUtf8(name);
|
||||
if ifstring(catArr) then
|
||||
catArr := class(xlsxXml).CurCodePageToUtf8(catArr);
|
||||
else if istable(catArr) then Begin
|
||||
for i:=0 to length(catArr)-1 do Begin
|
||||
if ifstring(catArr[i]) then
|
||||
catArr[i] := class(xlsxXml).CurCodePageToUtf8(catArr[i]);
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
|
||||
Series union= array(("Name":SerName,"Categories":catArr,"Values":Value));
|
||||
return length(Series);
|
||||
End;
|
||||
|
||||
|
|
@ -9996,7 +10169,7 @@ Type TDocumentBody = Class(DocObject)
|
|||
Function AddHeading(title, posOpt, styleId);
|
||||
Begin
|
||||
paragraph := new TParagraph();
|
||||
paragraph.Run.T := title;
|
||||
paragraph.Run.SetText( title );
|
||||
if ifObj(document_) then Begin
|
||||
id := document_.GetBookMarkID();
|
||||
paragraph.MarkStart.Name := '_Toc' $ id;
|
||||
|
|
@ -10127,14 +10300,7 @@ Type TDocumentBody = Class(DocObject)
|
|||
tcArr union= array(('name':'w:tc','obj':tc,'attrEx':'','nodeType':'','attrName':''));
|
||||
tc.TcPr.Width := colWidth;
|
||||
tc.TcPr.Type := 'dxa';
|
||||
tc.AddText(data[i, j]);
|
||||
{
|
||||
tc.P.pPr.rPr.Lang := 'en-US';
|
||||
tc.P.pPr.rPr.eastAsia := 'zh-CN';
|
||||
tc.P.Run.rPr.Lang := 'en-US';
|
||||
tc.P.Run.rPr.eastAsia := 'zh-CN';
|
||||
tc.P.Run.AddText( getText(data[i, j]) );
|
||||
}
|
||||
tc.SetText(data[i, j]);
|
||||
End;
|
||||
tr.Tc := tcArr;
|
||||
End;
|
||||
|
|
@ -10214,7 +10380,7 @@ Type TDocumentBody = Class(DocObject)
|
|||
picId := getPictureMaxId() + 1;
|
||||
picture.Run.Drawing.WInline.ID := picId;
|
||||
picture.Run.Drawing.WInline.Name := '图片 ' $ picId;
|
||||
picture.Run.Drawing.WInline.Descr := picture.Descr;
|
||||
picture.Run.Drawing.WInline.Descr := class(xlsxXml).CurCodePageToUtf8(picture.Descr);
|
||||
picture.Run.Drawing.WInline.cNvGraphicFramePr.xmlns := 'http://schemas.openxmlformats.org/drawingml/2006/main';
|
||||
picture.Run.Drawing.WInline.cNvGraphicFramePr.noChangeAspect := 1;
|
||||
picture.Run.Drawing.WInline.Graphic.xmlns := 'http://schemas.openxmlformats.org/drawingml/2006/main';
|
||||
|
|
@ -10592,8 +10758,7 @@ Type TDocHeaderFooter = Class(TDocumentBody)
|
|||
class(xlsxXml).CopyRprFormat(run.rPr, font);
|
||||
End
|
||||
else Begin
|
||||
run.space := 'preserve';
|
||||
run.T := r[i];
|
||||
run.SetText( r[i] );
|
||||
class(xlsxXml).CopyRprFormat(Run.rPr, font);
|
||||
End;
|
||||
End;
|
||||
|
|
@ -10848,7 +11013,7 @@ Type TCell = Class(TDocumentBody, TWTc)
|
|||
End;
|
||||
|
||||
///添加文字
|
||||
Function AddText(txt);
|
||||
Function SetText(txt);
|
||||
Begin
|
||||
if not ifString(txt) then
|
||||
lines := array('' $ txt);
|
||||
|
|
@ -10860,7 +11025,7 @@ Type TCell = Class(TDocumentBody, TWTc)
|
|||
newp.pPr.rPr.eastAsia := 'zh-CN';
|
||||
newp.Run.rPr.Lang := 'en-US';
|
||||
newp.Run.rPr.eastAsia := 'zh-CN';
|
||||
newp.Run.T := lines[i];
|
||||
newp.Run.SetText( lines[i] );
|
||||
NewChildNode( array("field":"", "name":"w:p", "obj":newp, "attrEx":"", "nodeType":"") );
|
||||
End;
|
||||
if not istable(lines) then
|
||||
|
|
@ -11169,57 +11334,57 @@ Type TCoreProperties = Class(DocObject)
|
|||
private
|
||||
Function readAuthor();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'dc:creator');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dc:creator'));
|
||||
End;
|
||||
|
||||
Function readCategory();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'cp:category');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:category'));
|
||||
End;
|
||||
|
||||
Function readDescription();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'dc:description');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dc:description'));
|
||||
End;
|
||||
|
||||
Function readSubject();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'dc:subject');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dc:subject'));
|
||||
End;
|
||||
|
||||
Function readTitle();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'dc:title');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dc:title'));
|
||||
End;
|
||||
|
||||
Function readVersion();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'cp:version');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:version'));
|
||||
End;
|
||||
|
||||
Function readRversion();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'cp:rversion');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:rversion'));
|
||||
End;
|
||||
|
||||
Function readKeyWords();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'cp:keywords');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:keywords'));
|
||||
End;
|
||||
|
||||
Function readLastModifiedBy();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'cp:lastModifiedBy');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'cp:lastModifiedBy'));
|
||||
End;
|
||||
|
||||
Function readCreated();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'dcterms:created');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dcterms:created'));
|
||||
End;
|
||||
|
||||
Function readModified();
|
||||
Begin
|
||||
return class(xlsxXml).GetNode(node_, 'dcterms:modified');
|
||||
return class(xlsxXml).Utf8ToCurCodePage(class(xlsxXml).GetNode(node_, 'dcterms:modified'));
|
||||
End;
|
||||
|
||||
Function propNode(k);
|
||||
|
|
@ -11231,47 +11396,47 @@ private
|
|||
|
||||
Function writeAuthor(v);
|
||||
Begin
|
||||
return propNode('dc:creator').SetValue(v);
|
||||
return propNode('dc:creator').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeCategory(v);
|
||||
Begin
|
||||
return propNode('cp:category').SetValue(v);
|
||||
return propNode('cp:category').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeDescription(v);
|
||||
Begin
|
||||
return propNode('dc:description').SetValue(v);
|
||||
return propNode('dc:description').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeSubject(v);
|
||||
Begin
|
||||
return propNode('dc:subject').SetValue(v);
|
||||
return propNode('dc:subject').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeTitle(v);
|
||||
Begin
|
||||
return propNode('dc:title').SetValue(v);
|
||||
return propNode('dc:title').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeVersion(v);
|
||||
Begin
|
||||
return propNode('cp:version').SetValue(v);
|
||||
return propNode('cp:version').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeRversion(v);
|
||||
Begin
|
||||
return propNode('cp:rversion').SetValue(v);
|
||||
return propNode('cp:rversion').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeKeyWords(v);
|
||||
Begin
|
||||
return propNode('cp:keywords').SetValue(v);
|
||||
return propNode('cp:keywords').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeLastModifiedBy(v);
|
||||
Begin
|
||||
return propNode('cp:lastModifiedBy').SetValue(v);
|
||||
return propNode('cp:lastModifiedBy').SetValue(class(xlsxXml).CurCodePageToUtf8(v));
|
||||
End;
|
||||
|
||||
Function writeCreated(v);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
// Version 1.0.4
|
||||
|
||||
Type TSDocxFile = Class
|
||||
///Version: V1.0 2022-09-20
|
||||
///适用于 Microsoft Word docx格式文件
|
||||
|
|
@ -22,7 +24,7 @@ Type TSDocxFile = Class
|
|||
Function Destory();
|
||||
Begin
|
||||
End;
|
||||
|
||||
|
||||
Function init();
|
||||
Begin
|
||||
zipfile_ := new ZipFile();
|
||||
|
|
@ -304,8 +306,10 @@ Type TSDocxFile = Class
|
|||
node := node.NextElement('w:comment');
|
||||
End;
|
||||
c := TOfficeObj('TDocComment');
|
||||
c.p.Run.T := txt;
|
||||
c.p.Run.SetText( txt );
|
||||
c.Author := author;
|
||||
if author and not class(xlsxXml).IsUtf8() then
|
||||
c.Author := class(xlsxXml).CurCodePageToUtf8(author);
|
||||
c.ID := id;
|
||||
xmlfile.FirstChildElement('w:comments').InsertEndChild(c.Marshal());
|
||||
return c;
|
||||
|
|
|
|||
|
|
@ -1,18 +1,20 @@
|
|||
// Version 1.0.4
|
||||
|
||||
Type TSExcelFile = Class
|
||||
///Version: V1.0 2022-08-08
|
||||
///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。
|
||||
///纯TSL模块实现
|
||||
///Excel文件读写接口
|
||||
|
||||
//缺省构造函数
|
||||
///缺省构造函数
|
||||
Function Create(); overload;
|
||||
Begin
|
||||
init();
|
||||
End;
|
||||
|
||||
//构造函数,打开已经存在的excel文件
|
||||
//alias: string,文件目录别名
|
||||
//fname: string,文件名
|
||||
///构造函数,打开已经存在的excel文件
|
||||
///alias: string,文件目录别名
|
||||
///fname: string,文件名
|
||||
Function Create(alias, fname); overload;
|
||||
Begin
|
||||
init();
|
||||
|
|
@ -51,9 +53,9 @@ Type TSExcelFile = Class
|
|||
Begin
|
||||
path := ExtractFileDir(ExtractFileDir(PluginPath()));
|
||||
if path[1] = '/' then
|
||||
defaultFileName := path + '\\funcext\\TSOffice\\template\\default.xlsx';
|
||||
else
|
||||
defaultFileName := path + '/funcext/TSOffice/template/default.xlsx';
|
||||
else
|
||||
defaultFileName := path + '\\funcext\\TSOffice\\template\\default.xlsx';
|
||||
return OpenFile('', defaultFileName);
|
||||
End;
|
||||
|
||||
|
|
@ -84,7 +86,12 @@ Type TSExcelFile = Class
|
|||
///返回: array('Sheet1','Sheet2')
|
||||
Function GetSheets();
|
||||
Begin
|
||||
return workbook_.GetSheets();
|
||||
sheets := workbook_.GetSheets();
|
||||
for i:=0 to length(sheets)-1 do
|
||||
begin
|
||||
sheets[i] := class(xlsxXml).Utf8ToCurCodePage(sheets[i]);
|
||||
end
|
||||
return sheets;
|
||||
End;
|
||||
|
||||
///获取工作表数
|
||||
|
|
@ -94,38 +101,36 @@ Type TSExcelFile = Class
|
|||
return workbook_.GetSheetsCount();
|
||||
End;
|
||||
|
||||
///获取工作表名
|
||||
///index: int,工作表索引
|
||||
///返回: string
|
||||
Function GetSheetName(index);
|
||||
Begin
|
||||
name := workbook_.GetSheetName(index);
|
||||
return class(xlsxXml).Utf8ToCurCodePage(name);
|
||||
End;
|
||||
|
||||
///创建新sheet
|
||||
///sheet: string,工作表名称
|
||||
Function NewSheet(sheet);
|
||||
Begin
|
||||
return workbook_.NewSheet(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
End;
|
||||
|
||||
///删除sheet
|
||||
///sheet: string,工作表名称
|
||||
Function DeleteSheet(sheet);
|
||||
Begin
|
||||
return workbook_.DeleteSheet(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
End;
|
||||
|
||||
///设置工作表名
|
||||
///sourceName: string, 原工作表名
|
||||
///destName: string,目标工作表名
|
||||
///返回: [err, errinfo]
|
||||
Function SetSheetName(sourceName, destName);
|
||||
Begin
|
||||
return workbook_.SetSheetName(sourceName, destName);
|
||||
End;
|
||||
|
||||
///获取工作表名
|
||||
///index: int,工作表索引
|
||||
///返回: string
|
||||
Function GetSheetName(index);
|
||||
Begin
|
||||
name := workbook_.GetSheets()[index];
|
||||
return ifString(name) ? name : '';
|
||||
End;
|
||||
|
||||
///创建新sheet
|
||||
///sheet: string,工作表名称
|
||||
///返回: [err, info]
|
||||
Function NewSheet(sheet);
|
||||
Begin
|
||||
return workbook_.NewSheet(sheet);
|
||||
End;
|
||||
|
||||
///删除sheet
|
||||
///sheet: string,工作表名称
|
||||
///返回: [err, info]
|
||||
Function DeleteSheet(sheet);
|
||||
Begin
|
||||
return workbook_.DeleteSheet(sheet);
|
||||
return workbook_.SetSheetName(class(xlsxXml).CurCodePageToUtf8(sourceName), class(xlsxXml).CurCodePageToUtf8(destName));
|
||||
End;
|
||||
|
||||
///获取总列数
|
||||
|
|
@ -133,8 +138,7 @@ Type TSExcelFile = Class
|
|||
///返回: int
|
||||
Function TotalCols(sheet);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.TotalCols();
|
||||
return workbook_.TotalCols(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
End;
|
||||
|
||||
///获取总行数
|
||||
|
|
@ -142,8 +146,7 @@ Type TSExcelFile = Class
|
|||
///返回: int
|
||||
Function TotalRows(sheet);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.TotalRows();
|
||||
return workbook_.TotalRows(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
End;
|
||||
|
||||
///获取单元格的值
|
||||
|
|
@ -152,9 +155,9 @@ Type TSExcelFile = Class
|
|||
///返回: [err, value:string]
|
||||
Function GetCellValue(sheet, axis);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.GetCellValue(axis);
|
||||
return class(ErrorMessage).Fail();
|
||||
[err, value] := workbook_.GetCellValue(class(xlsxXml).CurCodePageToUtf8(sheet), axis);
|
||||
if not err then return array(err, class(xlsxXml).Utf8ToCurCodePage(value));
|
||||
return array(err, value);
|
||||
End;
|
||||
|
||||
///设置单元格的值
|
||||
|
|
@ -169,8 +172,9 @@ Type TSExcelFile = Class
|
|||
/// 属性s:单元格样式
|
||||
Function SetCellValue(sheet, axis, val, opt);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.SetCellValue(axis, val, opt);
|
||||
sheet_name := class(xlsxXml).CurCodePageToUtf8(sheet);
|
||||
value := class(xlsxXml).CurCodePageToUtf8(val);
|
||||
return workbook_.SetCellValue(sheet_name, axis, value, opt);
|
||||
End;
|
||||
|
||||
///获取富文本格式
|
||||
|
|
@ -179,9 +183,9 @@ Type TSExcelFile = Class
|
|||
///返回: [err, richtxt:string],参见SetCellRichText
|
||||
Function GetCellRichText(sheet, axis);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.GetCellValue(axis, 'RichText');
|
||||
return class(ErrorMessage).Fail();
|
||||
[err, str] := workbook_.GetCellRichText(class(xlsxXml).CurCodePageToUtf8(sheet), axis);
|
||||
if err then return array(err, str);
|
||||
else return array(err, class(xlsxXml).Utf8ToCurCodePage(str));
|
||||
End;
|
||||
|
||||
///设置富文本格式
|
||||
|
|
@ -190,11 +194,13 @@ Type TSExcelFile = Class
|
|||
///richtext: string,xml串或富文本对象TSOfficeObj('TRichText')
|
||||
Function SetCellRichText(sheet, axis, richtext);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then begin
|
||||
o := workbook_.GetSheetObj(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
if ifObj(o) then
|
||||
begin
|
||||
xml := richtext;
|
||||
if ifObj(richtext) then
|
||||
xml := class(xlsxXml).Dom2Xml(richtext.Marshal());
|
||||
return o.SetCellValue(axis, xml, array('t':'s'), 'RichText');
|
||||
return o.SetCellValue(axis, class(xlsxXml).CurCodePageToUtf8(xml), array('t':'s'), 'RichText');
|
||||
end
|
||||
End;
|
||||
|
||||
|
|
@ -207,8 +213,7 @@ Type TSExcelFile = Class
|
|||
/// 用法3:ClearCell('A5', 'D8'); //Clear矩形区间所有单元格
|
||||
Function ClearCell(sheet, topLeft, bottomRight);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then o.ClearCell(topLeft, bottomRight);
|
||||
return workbook_.ClearCell(class(xlsxXml).CurCodePageToUtf8(sheet), topLeft, bottomRight);
|
||||
End;
|
||||
|
||||
///设置公式
|
||||
|
|
@ -217,8 +222,7 @@ Type TSExcelFile = Class
|
|||
///formula: string,公式
|
||||
Function SetCellFormula(sheet, axis, formula);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then o.SetCellFormula(axis, formula);
|
||||
return workbook_.SetCellFormula(class(xlsxXml).CurCodePageToUtf8(sheet), axis, formula);
|
||||
End;
|
||||
|
||||
///获取公式
|
||||
|
|
@ -227,9 +231,7 @@ Type TSExcelFile = Class
|
|||
///返回: [err, formula:string]
|
||||
Function GetCellFormula(sheet, axis);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.GetCellFormula(axis);
|
||||
return class(ErrorMessage).Fail();
|
||||
return workbook_.GetCellFormula(class(xlsxXml).CurCodePageToUtf8(sheet), axis);
|
||||
End;
|
||||
|
||||
///按行赋值
|
||||
|
|
@ -302,8 +304,7 @@ Type TSExcelFile = Class
|
|||
///返回: table
|
||||
Function GetTable(sheet, topLeft, bottomRight);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.Import(topLeft, bottomRight);
|
||||
return workbook_.GetTable(class(xlsxXml).CurCodePageToUtf8(sheet), topLeft, bottomRight);
|
||||
End;
|
||||
|
||||
///插入列,在指定列前插入空白列
|
||||
|
|
@ -311,7 +312,7 @@ Type TSExcelFile = Class
|
|||
///col: string 列名,如: "D"
|
||||
Function InsertCol(sheet, col);
|
||||
Begin
|
||||
return workbook_.InsertCol(sheet, col);
|
||||
return workbook_.InsertCol(class(xlsxXml).CurCodePageToUtf8(sheet), col);
|
||||
End;
|
||||
|
||||
///插入行,在指定行前插入空白行
|
||||
|
|
@ -319,7 +320,7 @@ Type TSExcelFile = Class
|
|||
///row: int
|
||||
Function InsertRow(sheet, row);
|
||||
Begin
|
||||
return workbook_.InsertRow(sheet, row);
|
||||
return workbook_.InsertRow(class(xlsxXml).CurCodePageToUtf8(sheet), row);
|
||||
End;
|
||||
|
||||
///删除列
|
||||
|
|
@ -327,7 +328,7 @@ Type TSExcelFile = Class
|
|||
///col: string,如: "D"
|
||||
Function RemoveCol(sheet, col);
|
||||
Begin
|
||||
return workbook_.RemoveCol(sheet, col);
|
||||
return workbook_.RemoveCol(class(xlsxXml).CurCodePageToUtf8(sheet), col);
|
||||
End;
|
||||
|
||||
///删除行
|
||||
|
|
@ -335,7 +336,7 @@ Type TSExcelFile = Class
|
|||
///row: int
|
||||
Function RemoveRow(sheet, row);
|
||||
Begin
|
||||
return workbook_.RemoveRow(sheet, row);
|
||||
return workbook_.RemoveRow(class(xlsxXml).CurCodePageToUtf8(sheet), row);
|
||||
End;
|
||||
|
||||
///设置行高度
|
||||
|
|
@ -344,7 +345,7 @@ Type TSExcelFile = Class
|
|||
///height: double,行高[0-409]
|
||||
Function SetRowHeight(sheet, row, height);
|
||||
Begin
|
||||
return workbook_.SetRowHeight(sheet, row, height);
|
||||
return workbook_.SetRowHeight(class(xlsxXml).CurCodePageToUtf8(sheet), row, height);
|
||||
End;
|
||||
|
||||
///获取行高度
|
||||
|
|
@ -353,7 +354,7 @@ Type TSExcelFile = Class
|
|||
///返回: double
|
||||
Function GetRowHeight(sheet, row);
|
||||
Begin
|
||||
return workbook_.GetRowHeight(sheet, row);
|
||||
return workbook_.GetRowHeight(class(xlsxXml).CurCodePageToUtf8(sheet), row);
|
||||
End;
|
||||
|
||||
///设置列宽度
|
||||
|
|
@ -363,7 +364,7 @@ Type TSExcelFile = Class
|
|||
///width: double,列宽[0-255]
|
||||
Function SetColWidth(sheet, startCol, endCol, width);
|
||||
Begin
|
||||
return workbook_.SetColWidth(sheet, startCol, endCol, width);
|
||||
return workbook_.SetColWidth(class(xlsxXml).CurCodePageToUtf8(sheet), startCol, endCol, width);
|
||||
End;
|
||||
|
||||
///获取列宽度
|
||||
|
|
@ -372,7 +373,7 @@ Type TSExcelFile = Class
|
|||
///返回: double
|
||||
Function GetColWidth(sheet, col);
|
||||
Begin
|
||||
return workbook_.GetColWidth(sheet, col);
|
||||
return workbook_.GetColWidth(class(xlsxXml).CurCodePageToUtf8(sheet), col);
|
||||
End;
|
||||
|
||||
///设置工作表默认列宽
|
||||
|
|
@ -380,7 +381,7 @@ Type TSExcelFile = Class
|
|||
///width: double
|
||||
Function SetSheetDefaultColWidth(sheet, width);
|
||||
Begin
|
||||
return workbook_.SetSheetDefaultColWidth(sheet, width);
|
||||
return workbook_.SetSheetDefaultColWidth(class(xlsxXml).CurCodePageToUtf8(sheet), width);
|
||||
End;
|
||||
|
||||
///获取工作表默认列宽
|
||||
|
|
@ -388,7 +389,7 @@ Type TSExcelFile = Class
|
|||
///返回: double
|
||||
Function GetSheetDefaultColWidth(sheet);
|
||||
Begin
|
||||
return workbook_.GetSheetDefaultColWidth(sheet);
|
||||
return workbook_.GetSheetDefaultColWidth(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
End;
|
||||
|
||||
///添加批注
|
||||
|
|
@ -417,7 +418,7 @@ Type TSExcelFile = Class
|
|||
///返回: [err, ChartList]
|
||||
Function GetCharts(sheet);
|
||||
Begin
|
||||
return workbook_.GetCharts(sheet);
|
||||
return workbook_.GetCharts(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
End;
|
||||
|
||||
///单元格坐标切分
|
||||
|
|
@ -507,8 +508,7 @@ Type TSExcelFile = Class
|
|||
///styleid: string,样式Id
|
||||
Function SetCellStyle(sheet, topLeft, bottomRight, styleid);
|
||||
Begin
|
||||
o := workbook_.GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.SetCellStyle(topLeft, bottomRight, styleid);
|
||||
return workbook_.SetCellStyle(class(xlsxXml).CurCodePageToUtf8(sheet), topLeft, bottomRight, styleid);
|
||||
End;
|
||||
|
||||
///获取单元格样式Id,获取到的Id可以在复制单元格样式时,作为调用 SetCellValue、或SetCellStyle 函数的参数使用。
|
||||
|
|
@ -517,7 +517,7 @@ Type TSExcelFile = Class
|
|||
///返回: styleId: string
|
||||
Function GetCellStyle(sheet, axis);
|
||||
Begin
|
||||
return workbook_.GetCellStyle(sheet, axis);
|
||||
return workbook_.GetCellStyle(class(xlsxXml).CurCodePageToUtf8(sheet), axis);
|
||||
End;
|
||||
|
||||
///设置工作表页眉页脚
|
||||
|
|
@ -534,7 +534,7 @@ Type TSExcelFile = Class
|
|||
///visible: boolean
|
||||
Function SetSheetVisible(sheet, visible);
|
||||
Begin
|
||||
return workbook_.SetSheetVisible(sheet, visible);
|
||||
return workbook_.SetSheetVisible(class(xlsxXml).CurCodePageToUtf8(sheet), visible);
|
||||
End;
|
||||
|
||||
///获取工作表可见性
|
||||
|
|
@ -542,7 +542,7 @@ Type TSExcelFile = Class
|
|||
///visibility: boolean
|
||||
Function GetSheetVisible(sheet);
|
||||
Begin
|
||||
return workbook_.GetSheetVisible(sheet);
|
||||
return workbook_.GetSheetVisible(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
End;
|
||||
|
||||
///设置行可见性
|
||||
|
|
@ -551,7 +551,7 @@ Type TSExcelFile = Class
|
|||
///visible: boolean
|
||||
Function SetRowVisible(sheet, row, visible)
|
||||
Begin
|
||||
return workbook_.SetRowVisible(sheet, row, visible);
|
||||
return workbook_.SetRowVisible(class(xlsxXml).CurCodePageToUtf8(sheet), row, visible);
|
||||
End;
|
||||
|
||||
///获取工作表行可见性
|
||||
|
|
@ -560,7 +560,7 @@ Type TSExcelFile = Class
|
|||
///返回: [err, visible:boolean]
|
||||
Function GetRowVisble(sheet, row);
|
||||
Begin
|
||||
return workbook_.GetRowVisble(sheet, row);
|
||||
return workbook_.GetRowVisble(class(xlsxXml).CurCodePageToUtf8(sheet), row);
|
||||
End;
|
||||
|
||||
///设置列可见性
|
||||
|
|
@ -571,7 +571,7 @@ Type TSExcelFile = Class
|
|||
Begin
|
||||
[err, col] := ColumnNameToNumber(col);
|
||||
if err then return "Col error.";
|
||||
return workbook_.SetColVisible(sheet, col, visible);
|
||||
return workbook_.SetColVisible(class(xlsxXml).CurCodePageToUtf8(sheet), col, visible);
|
||||
End;
|
||||
|
||||
///获取列可见性
|
||||
|
|
@ -582,7 +582,7 @@ Type TSExcelFile = Class
|
|||
Begin
|
||||
[err, col] := ColumnNameToNumber(col);
|
||||
if err then return array(-1, col);
|
||||
return workbook_.GetColVisble(sheet, col);
|
||||
return workbook_.GetColVisble(class(xlsxXml).CurCodePageToUtf8(sheet), col);
|
||||
End;
|
||||
|
||||
///设置工作表页边距
|
||||
|
|
@ -610,7 +610,7 @@ Type TSExcelFile = Class
|
|||
///vcell: string,右下角坐标
|
||||
Function MergeCell(sheet, hcell, vcell);
|
||||
Begin
|
||||
return workbook_.MergeCell(sheet, hcell, vcell);
|
||||
return workbook_.MergeCell(class(xlsxXml).CurCodePageToUtf8(sheet), hcell, vcell);
|
||||
End;
|
||||
|
||||
///取消合并单元格
|
||||
|
|
@ -619,7 +619,7 @@ Type TSExcelFile = Class
|
|||
///vcell: string,右下角坐标
|
||||
Function UnMergeCell(sheet, hcell, vcell);
|
||||
Begin
|
||||
return workbook_.UnMergeCell(sheet, hcell, vcell);
|
||||
return workbook_.UnMergeCell(class(xlsxXml).CurCodePageToUtf8(sheet), hcell, vcell);
|
||||
End;
|
||||
|
||||
///设置工作表视图属性
|
||||
|
|
@ -649,7 +649,7 @@ Type TSExcelFile = Class
|
|||
Function SetPageLayout(sheet, pageLayout);
|
||||
Begin
|
||||
o := getOj(sheet, 'xlsxPageLayout');
|
||||
if ifObj(o) then return o.SetPageLayout(sheet, pageLayout);
|
||||
if ifObj(o) then return o.SetPageLayout(class(xlsxXml).CurCodePageToUtf8(sheet), pageLayout);
|
||||
End;
|
||||
|
||||
///获取工作表页面设置
|
||||
|
|
@ -665,14 +665,15 @@ Type TSExcelFile = Class
|
|||
///sheet: string,工作表名称
|
||||
Function SetDefaultSheet(sheet);
|
||||
Begin
|
||||
return workbook_.SetDefaultSheet(sheet);
|
||||
return workbook_.SetDefaultSheet(class(xlsxXml).CurCodePageToUtf8(sheet));
|
||||
End;
|
||||
|
||||
///获取默认工作表
|
||||
///返回: string,工作表名称
|
||||
Function GetDefaultSheet();
|
||||
Begin
|
||||
return workbook_.GetDefaultSheet();
|
||||
sheet := workbook_.GetDefaultSheet();
|
||||
return class(xlsxXml).Utf8ToCurCodePage(sheet);
|
||||
End;
|
||||
|
||||
///设置超链接
|
||||
|
|
@ -744,7 +745,7 @@ Type TSExcelFile = Class
|
|||
///row: int,行号
|
||||
Function InsertPageBreak(sheet, row);
|
||||
Begin
|
||||
return workbook_.InsertPageBreak(sheet, row);
|
||||
return workbook_.InsertPageBreak(class(xlsxXml).CurCodePageToUtf8(sheet), row);
|
||||
End;
|
||||
|
||||
///删除指定行分页符
|
||||
|
|
@ -752,7 +753,7 @@ Type TSExcelFile = Class
|
|||
///row: int,行号
|
||||
Function RemovePageBreak(sheet, row);
|
||||
Begin
|
||||
return workbook_.RemovePageBreak(sheet, row);
|
||||
return workbook_.RemovePageBreak(class(xlsxXml).CurCodePageToUtf8(sheet), row);
|
||||
End;
|
||||
|
||||
///添加形状
|
||||
|
|
@ -810,8 +811,9 @@ Type TSExcelFile = Class
|
|||
End;
|
||||
|
||||
private
|
||||
Function getOj(sheetname, objname);
|
||||
Function getOj(sheet, objname);
|
||||
Begin
|
||||
sheetname := class(xlsxXml).CurCodePageToUtf8(sheet);
|
||||
if not ifarray(objMgr_) then objMgr_:= array();
|
||||
k := sheetname + '.' + objname;
|
||||
o := objMgr_[ k ];
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ Type TSChart = Class
|
|||
Function Apply(xmlObj);
|
||||
Begin
|
||||
chartData_.Serialize(IsWord()); //初始化图表数据
|
||||
task := array(('c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t', 'pcdata', chartData_.Title),
|
||||
task := array(('c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t', 'pcdata', class(xlsxXml).CurCodePageToUtf8(chartData_.Title)),
|
||||
('c:chartSpace/c:chart/c:plotVisOnly', 'val', chartData_.plotVisOnly),
|
||||
('c:chartSpace/c:chart/c:dispBlanksAs', 'val', chartData_.ShowBlanksAs),
|
||||
('c:chartSpace/c:chart/c:legend', 'Del', ifnil(chartData_.Legend)),
|
||||
|
|
|
|||
|
|
@ -303,6 +303,42 @@ Type xlsxXml = Class
|
|||
r1.rFont.cs := _cp(r1.rFont.cs, r2.rFont.cs);
|
||||
End;
|
||||
End;
|
||||
|
||||
class Function CodePage(zw);
|
||||
Begin
|
||||
cp := 'utf8';//默认环境为UTF8格式
|
||||
str := StrToBase64(zw);
|
||||
case str of
|
||||
'1tDOxA==':
|
||||
cp := 'gbk';
|
||||
'5Lit5paH':
|
||||
cp := 'utf8';
|
||||
'pKSk5Q==':
|
||||
cp := 'big5';
|
||||
End;
|
||||
sysparams['CodePage'] := cp;
|
||||
End;
|
||||
|
||||
class Function IsUtf8();
|
||||
Begin
|
||||
if ifnil(sysparams['CodePage']) or sysparams['CodePage'] = 'utf8' then
|
||||
return true;
|
||||
return false;
|
||||
End;
|
||||
|
||||
class Function Utf8ToCurCodePage(str);
|
||||
Begin
|
||||
if ifstring(str) and not class(xlsxXml).IsUtf8() then
|
||||
return UTF8ToAnsi(str);
|
||||
return str;
|
||||
End;
|
||||
|
||||
class Function CurCodePageToUtf8(str);
|
||||
Begin
|
||||
if ifstring(str) and not class(xlsxXml).IsUtf8() then
|
||||
return AnsiToUTF8(str);
|
||||
return str;
|
||||
End;
|
||||
|
||||
//字体属性
|
||||
class Function ReadRprFormat(node);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Type TDocxChart = Class(TSChart)
|
|||
</a:graphic>
|
||||
</wp:inline>
|
||||
</w:drawing>
|
||||
</w:r>', integer(chartData_.Width * ETU), integer(chartData_.Height * ETU), chartId_, chartData_.Name, rId_);
|
||||
</w:r>', integer(chartData_.Width * ETU), integer(chartData_.Height * ETU), chartId_, class(xlsxXml).CurCodePageToUtf8(chartData_.Name), rId_);
|
||||
End;
|
||||
|
||||
Function IsWord();override;
|
||||
|
|
|
|||
|
|
@ -33,4 +33,11 @@ Apply()函数可以修改属性值,例如:
|
|||
newParagraph.Format.StyleId := StyleId; //设置新段落StyleId
|
||||
newParagraph.Apply();
|
||||
★docx.StyleObject()(TDocxStyles对象),可以用户自己插入段落样式(innerXml串或自定义TDocxStyle对象)。
|
||||
|
||||
*如何设置字符集(中文支持)?
|
||||
★用户的脚本可能是UFT8格式,或可能是GBK码格式,系统提供API自动设置当前字符集环境:
|
||||
class(xlsxXml).CodePage('中文'); //系统检测当前的环境字符集
|
||||
...
|
||||
p.Run.SetText('系统可以自动识别这里的中文字符集(utf8或gbk)!');
|
||||
★不设置,默认当前字符集为UTF8
|
||||
|
||||
|
|
@ -75,16 +75,16 @@ private
|
|||
col_index := 1;
|
||||
if not includeHeader then
|
||||
begin
|
||||
excel_.InsertRow(sheetName_, row);
|
||||
excel_.WorkBook().InsertRow(sheetName_, row);
|
||||
end
|
||||
for i:=begCol to endCol do
|
||||
begin
|
||||
[err, cell] := excel_.CoordinatesToCellName(i, row, false);
|
||||
if includeHeader then
|
||||
name := excel_.GetCellValue(sheetName_, cell)[1];
|
||||
name := excel_.WorkBook().GetCellValue(sheetName_, cell)[1];
|
||||
else begin
|
||||
name := "列" $ col_index++;
|
||||
excel_.SetCellValue(sheetName_, cell, name);
|
||||
excel_.WorkBook().SetCellValue(sheetName_, cell, name);
|
||||
end
|
||||
table_str += fmt('<tableColumn id="{}" name="{}" />', id++, name);
|
||||
end
|
||||
|
|
|
|||
|
|
@ -57,19 +57,81 @@ Type xlsxWorkBook = Class
|
|||
End;
|
||||
|
||||
///获取工作表列表
|
||||
///返回: arry()
|
||||
Function GetSheets();
|
||||
Begin
|
||||
return sselect ['name'] from sheetNames_ end;
|
||||
End;
|
||||
|
||||
Function GetSheetName(index);
|
||||
Begin
|
||||
name := GetSheets()[index];
|
||||
return ifString(name) ? name : '';
|
||||
End;
|
||||
|
||||
Function TotalCols(sheet);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.TotalCols();
|
||||
End;
|
||||
|
||||
Function TotalRows(sheet);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.TotalRows();
|
||||
End;
|
||||
|
||||
Function GetCellValue(sheet, axis);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.GetCellValue(axis);
|
||||
return class(ErrorMessage).Fail();
|
||||
End;
|
||||
|
||||
Function SetCellValue(sheet, axis, val, opt);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.SetCellValue(axis, val, opt);
|
||||
End;
|
||||
|
||||
Function GetCellRichText(sheet, axis);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.GetCellValue(axis, 'RichText');
|
||||
return class(ErrorMessage).Fail();
|
||||
End;
|
||||
|
||||
Function ClearCell(sheet, topLeft, bottomRight);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then o.ClearCell(topLeft, bottomRight);
|
||||
End;
|
||||
|
||||
Function SetCellFormula(sheet, axis, formula);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if not o.CellIsExists(axis) then SetCellValue(sheet, axis, '');
|
||||
if ifObj(o) then o.SetCellFormula(axis, formula);
|
||||
End;
|
||||
|
||||
Function GetCellFormula(sheet, axis);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.GetCellFormula(axis);
|
||||
return class(ErrorMessage).Fail();
|
||||
End;
|
||||
|
||||
Function GetTable(sheet, topLeft, bottomRight);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.Import(topLeft, bottomRight);
|
||||
End;
|
||||
|
||||
///创建新sheet
|
||||
///sheet: string,工作表名称
|
||||
///返回: [err, info]
|
||||
Function NewSheet(sheet);
|
||||
Begin
|
||||
lname := LowerCase(sheet);
|
||||
if ifint(sheetIndexMap_[ lname ]) then return class(ErrorMessage).SheetExist('The sheet');
|
||||
if ifint(sheetIndexMap_[ lname ]) then return 'The sheet already exists.';
|
||||
rid := getWorkbookRelsRid();
|
||||
|
||||
//添加文件xl/worksheets/sheetN.xml
|
||||
|
|
@ -89,9 +151,9 @@ Type xlsxWorkBook = Class
|
|||
//设置 xl/workbook.xml
|
||||
workbook := GetXmlFileObj('xl/workbook.xml');
|
||||
node := workbook.FirstChildElement('workbook').FirstChildElement('sheets').InsertEndChild('element','sheet');
|
||||
node.SetAttribute('r:id', rid);
|
||||
node.SetAttribute('sheetId', sheetId);
|
||||
node.SetAttribute('name', sheet);
|
||||
node.SetAttribute('sheetId', sheetId);
|
||||
node.SetAttribute('r:id', rid);
|
||||
//workbook.Print();
|
||||
|
||||
//设置docProps/app.xml
|
||||
|
|
@ -126,7 +188,6 @@ Type xlsxWorkBook = Class
|
|||
sheetIndexMap_[ LowerCase(sheet) ] := sheetsCount_;
|
||||
sheetsCount_ ++;
|
||||
SetDefaultSheet(sheet);
|
||||
return class(ErrorMessage).Ok();
|
||||
End;
|
||||
|
||||
///删除sheet
|
||||
|
|
@ -134,9 +195,9 @@ Type xlsxWorkBook = Class
|
|||
///返回: [err, info]
|
||||
Function DeleteSheet(sheet);
|
||||
Begin
|
||||
if sheetsCount_ <= 1 then return class(ErrorMessage).DeleteFailure();
|
||||
if sheetsCount_ <= 1 then return 'Cant not delete the last sheet.';
|
||||
ind := sheetIndexMap_[ LowerCase(sheet) ];
|
||||
if not ifint(ind) then return class(ErrorMessage).Ok();
|
||||
if not ifint(ind) then return ;
|
||||
|
||||
del := sheetNames_[ind];
|
||||
defaultSheet := GetDefaultSheet();
|
||||
|
|
@ -233,27 +294,29 @@ Type xlsxWorkBook = Class
|
|||
xmlFileObjMap_ := array();
|
||||
|
||||
//设置默认工作表
|
||||
ind := sheetIndexMap_[sheet];
|
||||
sheet_name := LowerCase(sheet);
|
||||
ind := sheetIndexMap_[sheet_name];
|
||||
for k, v in sheetIndexMap_ do
|
||||
Begin
|
||||
if v > ind then sheetIndexMap_[k] := v - 1;
|
||||
End
|
||||
reindex(sheetIndexMap_, array(sheet: nil));
|
||||
reindex(sheetIndexMap_, array(sheet_name: nil));
|
||||
ind--;
|
||||
if ind < 0 then SetDefaultSheet(sheetNames_[0]['name']);
|
||||
else if ind = length(sheetIndexMap_) then SetDefaultSheet(sheetNames_[length(sheetIndexMap_)]['name']);
|
||||
else SetDefaultSheet(sheetNames_[ind]['name']);
|
||||
|
||||
return class(ErrorMessage).Ok();
|
||||
xmlFileObjMap_ := array();
|
||||
|
||||
End;
|
||||
|
||||
Function SetSheetName(sourceName, destName);
|
||||
Begin
|
||||
ind := sheetIndexMap_[ LowerCase(destName) ];
|
||||
if ifint(ind) then return class(ErrorMessage).SheetExist(destName);
|
||||
if ifint(ind) then return destName $ ' already exists.';
|
||||
|
||||
ind := sheetIndexMap_[ LowerCase(sourceName) ];
|
||||
if not ifint(ind) then return class(ErrorMessage).SheetNotExist(sourceName);
|
||||
if not ifint(ind) then return sourceName $ ' does not exists.';
|
||||
|
||||
//设置 xl/workbook.xml
|
||||
workbook := GetXmlFileObj('xl/workbook.xml');
|
||||
|
|
@ -282,7 +345,6 @@ Type xlsxWorkBook = Class
|
|||
sheetNames_[ind]['name'] := destName;
|
||||
reindex(sheetIndexMap_, array(LowerCase(sourceName) : LowerCase(destName)));
|
||||
sheetObjMap_ := array();
|
||||
return class(ErrorMessage).Ok();
|
||||
End;
|
||||
|
||||
Function InsertCol(sheet, col);
|
||||
|
|
@ -309,9 +371,6 @@ Type xlsxWorkBook = Class
|
|||
if ifObj(sObj) then sObj.RemoveRow(row);
|
||||
End;
|
||||
|
||||
///获取图表列表
|
||||
///sheet: string,工作表名称
|
||||
///返回: [err, ChartList]
|
||||
Function GetCharts(sheet);
|
||||
Begin
|
||||
ind := sheetIndexMap_[ LowerCase(sheet) ];
|
||||
|
|
@ -370,6 +429,14 @@ Type xlsxWorkBook = Class
|
|||
workbook := GetXmlFileObj('xl/workbook.xml');
|
||||
node := workbook.FirstChildElement('workbook').FirstChildElement('sheets').FirstChildElement('sheet');
|
||||
hidden := visible = 1 ? 0 : 1;
|
||||
default_sheet_name := GetDefaultSheet();
|
||||
if default_sheet_name = sheet then
|
||||
begin
|
||||
ind := sheetIndexMap_[LowerCase(default_sheet_name)];
|
||||
if ind = 0 then default_name := sheetNames_[ind + 1]['name'];
|
||||
else default_name := sheetNames_[ind - 1]['name'];
|
||||
SetDefaultSheet(default_name);
|
||||
end
|
||||
while ifObj(node) do
|
||||
Begin
|
||||
name := node.GetAttribute('name');
|
||||
|
|
@ -407,6 +474,12 @@ Type xlsxWorkBook = Class
|
|||
Begin
|
||||
hidden := visible = 1 ? 0 : 1;
|
||||
sheet_obj := GetSheetObj(sheet);
|
||||
is_exists := sheet_obj.RowIsExists(row);
|
||||
if not is_exists then
|
||||
begin
|
||||
[err, cell] := xlsx_call("CoordinatesToCellName", 1, row);
|
||||
sheet_obj.SetCellValue(cell, '');
|
||||
end
|
||||
sheet_obj.SetAttribute(row, array("hidden": hidden));
|
||||
End
|
||||
|
||||
|
|
@ -421,7 +494,7 @@ Type xlsxWorkBook = Class
|
|||
if not err then
|
||||
return array(0, hidden = '1' ? 0 : 1);
|
||||
end
|
||||
return array(0, 0);
|
||||
return array(0, 1);
|
||||
End
|
||||
|
||||
Function SetColVisible(sheet, col, visible)
|
||||
|
|
@ -577,6 +650,12 @@ Type xlsxWorkBook = Class
|
|||
return default_width;
|
||||
End;
|
||||
|
||||
Function SetCellStyle(sheet, topLeft, bottomRight, styleid);
|
||||
Begin
|
||||
o := GetSheetObj(sheet);
|
||||
if ifObj(o) then return o.SetCellStyle(topLeft, bottomRight, styleid);
|
||||
End;
|
||||
|
||||
Function GetCellStyle(sheet, axis);
|
||||
Begin
|
||||
sheet_obj := GetSheetObj(sheet);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# 2022-12-30
|
||||
|
||||
## V1.0.4
|
||||
|
||||
### word
|
||||
|
||||
1. 初步支持中文
|
||||
|
||||
### excel
|
||||
|
||||
1. 初步支持中文
|
||||
2. `SetSheetName`,`NewSheet` 返回值不再是`[err, errinfo]`
|
||||
3. 修复清除单元格`ClearCell`不正确问题
|
||||
4. 修复`SetCellFormula`,`GetCellFormula`问题
|
||||
5. 修复`SetRowVisible`,`GetRowVisible`,`SetSheetVisible`问题
|
||||
|
||||
如何设置字符集(中文支持)?
|
||||
★用户的脚本可能是UFT8格式,或可能是GBK码格式,系统提供API自动设置当前字符集环境:`class(xlsxXml).CodePage('中文');` 在文件头设置该代码后,系统会自动检测当前的环境字符集
|
||||
Loading…
Reference in New Issue