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

View File

@ -1,4 +1,4 @@
// Version 1.7.5
// Version 1.7.6
Function TOfficeObj(n);
Begin
case lowercase(n) of

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格式文件

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;
///设置工作表页边距

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;
@ -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

View File

@ -1,5 +1,14 @@
# 更新日志
## 2025-1-8
### V1.7.6
#### excel
1. **fix**`SetRowHeight`单元格不存在无法设置
2. **fix**`Set[Get]ColVisible`修改传入的列参数
## 2025-1-7
### V1.7.5