This commit is contained in:
csh
2025-01-08 15:31:04 +08:00
parent 3c16ce510a
commit 0f07603d73
5 changed files with 24 additions and 9 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
// Version 1.7.5
// Version 1.7.6
Function TOfficeObj(n);
Begin
case lowercase(n) of
+1 -1
View File
@@ -1,4 +1,4 @@
// Version 1.7.5
// Version 1.7.6
Type TSDocxFile = Class
///Version: V1.0 2022-09-20
///适用于 Microsoft Word docx格式文件
+5 -5
View File
@@ -1,4 +1,4 @@
// Version 1.7.5
// Version 1.7.6
Type TSXlsxFile = Class
///Version: V1.0 2022-08-08
///适用于 Microsoft Excel? 2007 及以上版本创建的电子表格文档。支持 XLSX / XLSM / XLTM / XLTX 等多种文档格式。
@@ -649,9 +649,9 @@ Type TSXlsxFile = Class
///visible: boolean
Function SetColVisible(sheet, col, visible)
Begin
[err, col] := ColumnNameToNumber(col);
[err, new_col] := ColumnNameToNumber(col);
if err then return "Col error.";
return workbook_.SetColVisible(class(TSXml).CurCodePageToUtf8(sheet), col, visible);
return workbook_.SetColVisible(class(TSXml).CurCodePageToUtf8(sheet), new_col, visible);
End;
///获取列可见性
@@ -660,9 +660,9 @@ Type TSXlsxFile = Class
///返回: [err, visible:int]
Function GetColVisble(sheet, col);
Begin
[err, col] := ColumnNameToNumber(col);
[err, new_col] := ColumnNameToNumber(col);
if err then return array(-1, col);
return workbook_.GetColVisble(class(TSXml).CurCodePageToUtf8(sheet), col);
return workbook_.GetColVisble(class(TSXml).CurCodePageToUtf8(sheet), new_col);
End;
///设置工作表页边距
+8 -2
View File
@@ -419,7 +419,8 @@ Type xlsxWorkBook = Class
for i:=0 to length(sheetNames_)-1 do Begin
sheetNames_[i]['rid'] := 'rId' + inttostr(i + 1); //重置rId
oldname := sheetNames_[i]['file'];
newname := sheetPrefix_ + inttostr(i + 1) + '.xml';
fdir := ExtractFileDir(oldname);
newname := fdir + "/" + "sheet" + inttostr(i + 1) + '.xml';
sheetNames_[i]['file'] := newname;
if oldname <> newname then Begin
n := vselect thisrowindex from files where ['FileName'] = oldname end;
@@ -473,7 +474,7 @@ Type xlsxWorkBook = Class
node.SetAttribute('sheetId', sheetNames_[i]['sheetId']);
node.SetAttribute('r:id', sheetNames_[i]['rid']);
End;
//workbook.Print();
// workbook.Print();
//设置docProps/app.xml
app := GetXmlFileObj(class(TSXml).GetFileName('docProps_app'));
@@ -899,6 +900,11 @@ Type xlsxWorkBook = Class
Function SetRowHeight(sheet, row, height);
Begin
obj := GetSheetObj(sheet);
if not obj.RowIsExists(row) then
begin
axis := CoordinatesToCellName(1, row, False)[1];
if not obj.CellIsExists(axis) then SetCellValue(sheet, axis, '');
end
obj.SetAttribute(row, array('ht': height, "customHeight": 1));
End