TSOffice/funcext/TSOffice/TSExcelFile.tsf

849 lines
24 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Version 1.0.5
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文件名
Function Create(alias, fname); overload;
Begin
init();
OpenFile(alias, fname);
End;
//析构函数
Function Destory();
Begin
End;
//初始化
Function init();
Begin
zipfile_ := new ZipFile();
End;
///打开excel文件
///alias: string文件目录别名
///fname: string文件名
///返回: [err, errmsg]
Function OpenFile(alias, fname);
Begin
init();
if not ifObj(zipfile_) then return array(-1, 'Create ZipFile object fail.');
[err, errmsg] := zipfile_.Open(alias, fname);
if err=0 then Begin
workbook_ := new xlsxWorkBook(zipfile_);
workbook_.Load();
End;
return array(err, errmsg);
End;
///新建excel文件
///返回: [err, info]
Function NewFile();
Begin
path := ExtractFileDir(ExtractFileDir(PluginPath()));
if path[1] = '/' then
defaultFileName := path + '/funcext/TSOffice/template/default.xlsx';
else
defaultFileName := path + '\\funcext\\TSOffice\\template\\default.xlsx';
return OpenFile('', defaultFileName);
End;
///保存文件
///返回: [err, info]
Function Save();
Begin
return zipfile_.Save();
End;
///另存为
///alias: string文件目录别名
///fname: string文件名
///返回: [err, info]
Function SaveAs(alias, fname);
Begin
return zipfile_.Save(alias, fname);
End;
///真实文件名
///返回: string
Function FileName();
Begin
return zipfile_.FileName();
End;
///获取工作表列表
///返回: array('Sheet1','Sheet2')
Function GetSheets();
Begin
sheets := workbook_.GetSheets();
for i:=0 to length(sheets)-1 do
begin
sheets[i] := class(xlsxXml).Utf8ToCurCodePage(sheets[i]);
end
return sheets;
End;
///获取工作表数
///返回: integer
Function GetSheetsCount();
Begin
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(class(xlsxXml).CurCodePageToUtf8(sourceName), class(xlsxXml).CurCodePageToUtf8(destName));
End;
///获取总列数
///sheet: string工作表名称
///返回: int
Function TotalCols(sheet);
Begin
return workbook_.TotalCols(class(xlsxXml).CurCodePageToUtf8(sheet));
End;
///获取总行数
///sheet: string工作表名称
///返回: int
Function TotalRows(sheet);
Begin
return workbook_.TotalRows(class(xlsxXml).CurCodePageToUtf8(sheet));
End;
///获取单元格的值
///sheet: string工作表名称
///axis: string单元格坐标如: "A6"
///返回: [err, value:string]
Function GetCellValue(sheet, axis);
Begin
[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;
///设置单元格的值
///sheet: string工作表名称
///axis: string单元格坐标如: "A6"
///val: Var可以是整数、字符串、数值型等nil 不设置值(可以调用ClearCell方法清空单元格),只设置属性
///[opt:Tany]可选参数单元格属性可以是xml字符串或天软数组
/// xml串opt := '<c t="s" s="1"></c>';
/// 数组: opt := array('t':'s', 's':'1');
/// 属性t单元格数据类型不设置的话数据类型为val的数据类型
/// t ->'s' 共享字符串、'b' bool 类型、'e' 错误类型、'inlineStr' 内联字符串类型、nil 数字类型、'str' 公式类型)
/// 属性s单元格样式
Function SetCellValue(sheet, axis, val, opt);
Begin
sheet_name := class(xlsxXml).CurCodePageToUtf8(sheet);
value := class(xlsxXml).CurCodePageToUtf8(val);
return workbook_.SetCellValue(sheet_name, axis, value, opt);
End;
///获取富文本格式
///sheet: string工作表名称
///axis: string单元格如"A7"
///返回: [err, richtxt:string]参见SetCellRichText
Function GetCellRichText(sheet, axis);
Begin
[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;
///设置富文本格式
///sheet: string工作表名称
///axis: string单元格如"A7"
///richtext: stringxml串或富文本对象TSOfficeObj('TRichText')
Function SetCellRichText(sheet, axis, richtext);
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, class(xlsxXml).CurCodePageToUtf8(xml), array('t':'s'), 'RichText');
end
End;
///清空单元格
///sheet: string工作表名称
///[topLeft: string],左上角坐标,可选参数
///[bottomRight: string],右下角坐标,可选参数,
/// 用法1ClearCell(); //Clear整个sheet
/// 用法2ClearCell('A2'); //Clear 'A2'单元格
/// 用法3ClearCell('A5', 'D8'); //Clear矩形区间所有单元格
Function ClearCell(sheet, topLeft, bottomRight);
Begin
return workbook_.ClearCell(class(xlsxXml).CurCodePageToUtf8(sheet), topLeft, bottomRight);
End;
///设置公式
///sheet: string工作表名称
///axis: string单元格如"A7"
///formula: string公式
Function SetCellFormula(sheet, axis, formula);
Begin
return workbook_.SetCellFormula(class(xlsxXml).CurCodePageToUtf8(sheet), axis, formula);
End;
///获取公式
///sheet: string工作表名称
///axis: string单元格如"A7"
///返回: [err, formula:string]
Function GetCellFormula(sheet, axis);
Begin
return workbook_.GetCellFormula(class(xlsxXml).CurCodePageToUtf8(sheet), axis);
End;
///按行赋值
///sheet: string工作表名称
///axis: string起始坐标如: "A4"
///slice: array()一维数组array(1,2,3,2,1,"hello")
Function SetSheetRow(sheet, axis, slice);
Begin
[err, col, row] := CellNameToCoordinates(axis);
if not err then
begin
for i:=0 to length(slice)-1 do
begin
[err, cell] := CoordinatesToCellName(col + i, row);
SetCellValue(sheet, cell, slice[i]);
end
end
End;
///插入数据表
///sheet: string工作表名称
///axis: string左上角坐标如: "A4"
///data: table数据表
///[IncludeHeader: bool] 是否包括表头默认FALSE
///[IncludeIndex: bool] 是否自动添加索引号默认FALSE
///返回: [err, info]
Function InsertTable(sheet, axis, data, IncludeHeader, IncludeIndex);
Begin
if not ifarray(data) or length(data)=0 then
return array(-1, "Invalid Data.");
if FieldCount(data)=0 then Begin //数据是一维数组
return SetSheetRow(sheet, axis, data);
End;
[err, colNum, rowNum] := CellNameToCoordinates(axis);
if err then
return array(err, colNum);
if IncludeHeader then Begin
fields := FieldNames(data);
if IncludeIndex then Begin
fields := array("Index") union fields;
End;
SetSheetRow(sheet, axis, fields);
rowNum ++;
End;
if IncludeIndex then Begin
for i:=0 to length(data)-1 do Begin
[err, cell] := CoordinatesToCellName(colNum, rowNum + i);
if err then
return array(err, cell);
SetCellValue(sheet, cell, i+1);
End;
colNum ++;
End;
for i:=0 to length(data)-1 do Begin
[err, cell] := CoordinatesToCellName(colNum, rowNum + i);
if err then
return array(err, cell);
t := sselect * from data where thisrowindex = i End;
SetSheetRow(sheet, cell, t);
if err then
return array(err, info);
End;
return array(0, "OK");
End;
///读取数据表
///sheet: string工作表名称
///topLeft: string左上角坐标如: "A4"
///bottomRight: string右下角坐标如: "B8"为空获取从topLeft开始的整张表
///返回: table
Function GetTable(sheet, topLeft, bottomRight);
Begin
return workbook_.GetTable(class(xlsxXml).CurCodePageToUtf8(sheet), topLeft, bottomRight);
End;
///插入列,在指定列前插入空白列
///sheet: string工作表名称
///col: string 列名,如: "D"
Function InsertCol(sheet, col);
Begin
return workbook_.InsertCol(class(xlsxXml).CurCodePageToUtf8(sheet), col);
End;
///插入行,在指定行前插入空白行
///sheet: string工作表名称
///row: int
Function InsertRow(sheet, row);
Begin
return workbook_.InsertRow(class(xlsxXml).CurCodePageToUtf8(sheet), row);
End;
///删除列
///sheet: string工作表名称
///col: string如: "D"
Function RemoveCol(sheet, col);
Begin
return workbook_.RemoveCol(class(xlsxXml).CurCodePageToUtf8(sheet), col);
End;
///删除行
///sheet: string工作表名称
///row: int
Function RemoveRow(sheet, row);
Begin
return workbook_.RemoveRow(class(xlsxXml).CurCodePageToUtf8(sheet), row);
End;
///设置行高度
///sheet: string工作表
///row: int
///height: double行高[0-409]
Function SetRowHeight(sheet, row, height);
Begin
return workbook_.SetRowHeight(class(xlsxXml).CurCodePageToUtf8(sheet), row, height);
End;
///获取行高度
///sheet: string工作表
///row: int
///返回: double
Function GetRowHeight(sheet, row);
Begin
return workbook_.GetRowHeight(class(xlsxXml).CurCodePageToUtf8(sheet), row);
End;
///设置列宽度
///sheet: string工作表
///startcol: string开始列如: "A"
///endcol: string结束列如: "D"
///width: double列宽[0-255]
Function SetColWidth(sheet, startCol, endCol, width);
Begin
return workbook_.SetColWidth(class(xlsxXml).CurCodePageToUtf8(sheet), startCol, endCol, width);
End;
///获取列宽度
///sheet: string工作表
///col: string
///返回: double
Function GetColWidth(sheet, col);
Begin
return workbook_.GetColWidth(class(xlsxXml).CurCodePageToUtf8(sheet), col);
End;
///设置工作表默认列宽
///sheet: string工作表
///width: double
Function SetSheetDefaultColWidth(sheet, width);
Begin
return workbook_.SetSheetDefaultColWidth(class(xlsxXml).CurCodePageToUtf8(sheet), width);
End;
///获取工作表默认列宽
///sheet: string工作表
///返回: double
Function GetSheetDefaultColWidth(sheet);
Begin
return workbook_.GetSheetDefaultColWidth(class(xlsxXml).CurCodePageToUtf8(sheet));
End;
///添加批注
///sheet: string工作表名称
///axis: string单元格如"A7"
///Author:string
///comment: string
Function AddComment(sheet, axis, Author, comment);
Begin
o := getOj(sheet, 'xlsxComment');
if ifObj(o) then o.AddComment(axis, Author, comment);
End;
///添加图表
///sheet: string工作表名称
///range:string图表所处矩形区域"A5:F10"
///chart:TChart对象
Function AddChart(sheet, range, chart);
Begin
o := getOj(sheet, 'xlsxChart');
if ifObj(chart) then return o.AddChart(range, chart);
End;
///获取图表列表
///sheet: string工作表名称
///返回: [err, ChartList]
Function GetCharts(sheet);
Begin
return workbook_.GetCharts(class(xlsxXml).CurCodePageToUtf8(sheet));
End;
///单元格坐标切分
///cell: string单元格坐标
///返回: [err, col:string, row:int]"AK47" -> return array(0, "AK", 47);
Function SplitCellName(cell);
Begin
return SplitCellName(cell);
End;
///列名转索引
///name: string
///返回 [err, index:int]"AK" -> return array(0, 37);
Function ColumnNameToNumber(name);
Begin
return ColumnNameToNumber(name);
End;
///索引转列名
///index: int
///返回 [err, name:string]37 -> return array(0, "AK");
Function ColumnNumberToName(index);
Begin
return ColumnNumberToName(index);
End;
///单元格坐标转索引
///cell: string
///返回 [err, col:int, row: int] "A2" -> [1,2]
Function CellNameToCoordinates(cell);
Begin
return CellNameToCoordinates(cell);
End;
///索引转单元格坐标
///col: int
///row: int
///abs: bool ,true返回"$A$1"格式false返回"A1"格式
///返回 [err, cell:string] [1,2,true] -> "$A$2"
Function CoordinatesToCellName(col, row, abs);
Begin
return CoordinatesToCellName(col, row, abs);
End;
///RGB与HSL色彩空间色值转换
///r: int
///g: int
///b: int
///返回: [h:double, s:double, l:double]
Function RGBToHSL(r, g, b);
Begin
return RGBToHSL(r, g, b);
End;
///HSL与RGB色彩空间色值转换
///h: double
///s: double
///l: double
///返回: [r:int, g:int, b:int]
Function HSLToRGB(h, s, l);
Begin
return HSLToRGB(h, s, l);
End;
///新建样式对象
///style: TStyle对象
///返回: styleid
Function NewStyle(style);
Begin
styleObj := new xlsxStyles('', self);
return styleObj.GetStyleId(style);
End;
///设置单元格样式
///sheet: string工作表名称
///topLeft: string左上角坐标
///bottomRight: string右下角坐标
///styleid: string样式Id
Function SetCellStyle(sheet, topLeft, bottomRight, styleid);
Begin
return workbook_.SetCellStyle(class(xlsxXml).CurCodePageToUtf8(sheet), topLeft, bottomRight, styleid);
End;
///获取单元格样式Id获取到的Id可以在复制单元格样式时作为调用 SetCellValue、或SetCellStyle 函数的参数使用。
///sheet: string工作表名称
///axis: string单元格如"A7"
///返回: styleId: string
Function GetCellStyle(sheet, axis);
Begin
return workbook_.GetCellStyle(class(xlsxXml).CurCodePageToUtf8(sheet), axis);
End;
///设置工作表页眉页脚
///sheet: string工作表名称
///headerFooter: THeaderFooter对象
Function SetSheetHeaderFooter(sheet, headerFooter);
Begin
o := getOj(sheet, 'xlsxHeaderFooter');
if ifObj(o) then o.SetHeaderFooter(headerFooter);
End;
///设置工作表可见性
///sheet: string, 工作表名称
///visible: boolean
Function SetSheetVisible(sheet, visible);
Begin
return workbook_.SetSheetVisible(class(xlsxXml).CurCodePageToUtf8(sheet), visible);
End;
///获取工作表可见性
///sheet: string工作表名称
///visibility: boolean
Function GetSheetVisible(sheet);
Begin
return workbook_.GetSheetVisible(class(xlsxXml).CurCodePageToUtf8(sheet));
End;
///设置行可见性
///sheet: string工作表
///row: int
///visible: boolean
Function SetRowVisible(sheet, row, visible)
Begin
return workbook_.SetRowVisible(class(xlsxXml).CurCodePageToUtf8(sheet), row, visible);
End;
///获取工作表行可见性
///sheet: string工作表名称
///row: int, 行
///返回: [err, visible:boolean]
Function GetRowVisble(sheet, row);
Begin
return workbook_.GetRowVisble(class(xlsxXml).CurCodePageToUtf8(sheet), row);
End;
///设置列可见性
///sheet: string工作表
///col: string'A'
///visible: boolean
Function SetColVisible(sheet, col, visible)
Begin
[err, col] := ColumnNameToNumber(col);
if err then return "Col error.";
return workbook_.SetColVisible(class(xlsxXml).CurCodePageToUtf8(sheet), col, visible);
End;
///获取列可见性
///sheet: string工作表名称
///col: string
///返回: [err, visible:int]
Function GetColVisble(sheet, col);
Begin
[err, col] := ColumnNameToNumber(col);
if err then return array(-1, col);
return workbook_.GetColVisble(class(xlsxXml).CurCodePageToUtf8(sheet), col);
End;
///设置工作表页边距
///sheet: string工作表名称
///margins: TMargins 对象
Function SetPageMargins(sheet, margins);
Begin
o := getOj(sheet, 'xlsxMargins');
if ifObj(o) then o.SetPageMargins(margins);
End;
///获取工作表页边距
///sheet: string工作表名称
///返回: TMargins对象
Function GetPageMargins(sheet);
Begin
o := getOj(sheet, 'xlsxMargins');
if ifObj(o) then return o.GetPageMargins();
return "sheet error";
End;
///合并单元格
///sheet: string工作表名称
///hcell: string左上角坐标
///vcell: string右下角坐标
Function MergeCell(sheet, hcell, vcell);
Begin
return workbook_.MergeCell(class(xlsxXml).CurCodePageToUtf8(sheet), hcell, vcell);
End;
///取消合并单元格
///sheet: string工作表名称
///hcell: string左上角坐标
///vcell: string右下角坐标
Function UnMergeCell(sheet, hcell, vcell);
Begin
return workbook_.UnMergeCell(class(xlsxXml).CurCodePageToUtf8(sheet), hcell, vcell);
End;
///设置工作表视图属性
///sheet: string工作表名称
///viewIndex: int视图索引
///sheet: objectTSheetView对象
Function SetSheetViewOptions(sheet, viewIndex, sheetView);
Begin
o := getOj(sheet, 'xlsxSheetView');
if ifObj(o) then return o.SetSheetViewOptions(viewIndex, sheetView);
End;
///获取工作表视图属性
///sheet: string工作表名称
///viewindex: int视图索引viewIndex 可以是负数,如果是这样,则向后计数(-1 代表最后一个视图)
///返回: object, TSheetView对象
Function GetSheetViewOptions(sheet, viewIndex);
Begin
o := getOj(sheet, 'xlsxSheetView');
if ifObj(o) then return o.GetSheetViewOptions(viewIndex);
End;
// TODO printerSettings1.bin?
///设置工作表页面设置
///sheet: string工作表名称
///pageLayout: TPageLayout对象属性:
Function SetPageLayout(sheet, pageLayout);
Begin
o := getOj(sheet, 'xlsxPageLayout');
if ifObj(o) then return o.SetPageLayout(class(xlsxXml).CurCodePageToUtf8(sheet), pageLayout);
End;
///获取工作表页面设置
///sheet: string工作表名称
///返回: TPageLayout对象
Function GetPageLayout(sheet);
Begin
o := getOj(sheet, 'xlsxPageLayout');
if ifObj(o) then return o.GetPageLayout();
return "error sheet";
End;
///sheet: string工作表名称
Function SetDefaultSheet(sheet);
Begin
return workbook_.SetDefaultSheet(class(xlsxXml).CurCodePageToUtf8(sheet));
End;
///获取默认工作表
///返回: string工作表名称
Function GetDefaultSheet();
Begin
sheet := workbook_.GetDefaultSheet();
return class(xlsxXml).Utf8ToCurCodePage(sheet);
End;
///设置超链接
///sheet: string工作表名称
///axis: string单元格如"A7"
///hyplink: THyperLink对象
Function SetCellHyperLink(sheet, axis, hyperlink);
Begin
o := getOj(sheet, 'xlsxHyperLink');
if ifObj(o) then return o.SetCellHyperLink(axis, hyperlink);
End;
// TODO 返回的结果有点问题
///获取超链接
///sheet: string工作表名称
///axis: string单元格如"A7"
///返回: THyperLink对象
Function GetCellHyperLink(sheet, axis);
Begin
o := getOj(sheet, 'xlsxHyperLink');
if not ifObj(o) then return array(1, 'The sheet is not exist.');
return o.GetCellHyperLink(axis);
End;
///设置工作表背景图片
///picture: TPicture图片对象
Function SetSheetBackground(sheet, picture);
Begin
o := getOj(sheet, 'xlsxImage');
if ifObj(o) then return o.SetSheetBackground(picture);
End;
///添加图片
///sheet: string, 工作表名称
///topLeft: string, 图片插入左上角单元格
///bottomRight: string, 图片插入右下角单元格
///picture: TPicture 图片对象
///format: TPictureFormat 图片设置对象
Function AddPicture(sheet, topLeft, bottomRight, picture, format);
Begin
o := getOj(sheet, 'xlsxImage');
if ifObj(o) then return o.AddPicture(topLeft, bottomRight, picture, format);
End;
///删除图片
///sheet: 工作表名称
///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
///[includeHeader: bool] 是否包括表头默认FALSE
Function AddTable(sheet, topLeft, bottomRight, tableStyle, includeHeader);
Begin
o := getOj(sheet, 'xlsxTable');
if ifObj(o) then return o.AddTable(topLeft, bottomRight, tableStyle, includeHeader);
End;
///指定行前插入分页符
///sheet: string工作表名称
///row: int行号
Function InsertPageBreak(sheet, row);
Begin
return workbook_.InsertPageBreak(class(xlsxXml).CurCodePageToUtf8(sheet), row);
End;
///删除指定行分页符
///sheet: string工作表名称
///row: int行号
Function RemovePageBreak(sheet, row);
Begin
return workbook_.RemovePageBreak(class(xlsxXml).CurCodePageToUtf8(sheet), row);
End;
///添加形状
///sheet: string工作表名称
///topLeft: string, 左上角单元格
///bottomRight: string, 右下角单元格
///shapeType: string, 形状类型
///format: 形状设置TShapeFormat类
Function AddShape(sheet, topLeft, bottomRight, shapeType, format);
Begin
o := getOj(sheet, 'xlsxShape');
if ifObj(o) then return o.AddShape(topLeft, bottomRight, shapeType, format);
End;
///设置工作簿的核心属性
///coreProps: TCoreProperty对象
Function SetCoreProps(coreProps);
Begin
o := getOj('', 'xlsxDocProps');
if ifObj(o) then return o.SetCoreProps(coreProps);
End;
///获取工作簿的核心属性
///返回: TCoreProperty对象
Function GetCoreProps();
Begin
o := getOj('', 'xlsxDocProps');
if ifObj(o) then return o.GetCoreProps();
End;
///设置工作簿应用程序属性
///appProps: TAppProperty对象属性:
Function SetAppProps(appProps);
Begin
o := getOj('', 'xlsxDocProps');
if ifObj(o) then return o.SetAppProps(appProps);
End;
///获取应用程序属性
///返回: TAppProperty对象
Function GetAppProps();
Begin
o := getOj('', 'xlsxDocProps');
return o.GetAppProps();
End;
Function WorkBook();
Begin
return workbook_;
End;
Function Zip();
Begin
return zipfile_;
End;
private
Function getOj(sheet, objname);
Begin
sheetname := class(xlsxXml).CurCodePageToUtf8(sheet);
if not ifarray(objMgr_) then objMgr_:= array();
k := sheetname + '.' + objname;
o := objMgr_[ k ];
if not ifnil(o) then return o;
case objname of
'xlsxMargin':
o := class(xlsxMargin).NewObject(sheetname, self);
'xlsxComment':
o := class(xlsxComment).NewObject(sheetname, self);
'xlsxStyles':
o := class(xlsxStyles).NewObject(sheetname, self);
'xlsxChart':
return class(xlsxChart).NewObject(sheetname, self);//不缓存xlsxChart对象
'xlsxHeaderFooter':
o := class(xlsxHeaderFooter).NewObject(sheetname, self);
'xlsxMargins':
o := class(xlsxMargins).NewObject(sheetname, self);
'xlsxSheetView':
o := class(xlsxSheetView).NewObject(sheetname, self);
'xlsxPageLayout':
o := class(xlsxPageLayout).NewObject(sheetname, self);
'xlsxDocProps':
return class(xlsxDocProps).NewObject(self);
'xlsxImage':
o := class(xlsxImage).NewObject(sheetname, self);
'xlsxHyperLink':
o := class(xlsxHyperLink).NewObject(sheetname, self);
'xlsxShape':
o := class(xlsxShape).NewObject(sheetname, self);
'xlsxTable':
o := class(xlsxTable).NewObject(sheetname, self);
End;
if ifObj(o) then objMgr_[k] := o;
return o;
End;
zipfile_; //压缩文件对象
workbook_; //WorkBook对象
objMgr_; //各种对象缓存、管理
End;