excel `gettable`中文

This commit is contained in:
csh 2023-05-17 13:57:13 +08:00
parent 4dc02530ba
commit c536c4d531
1 changed files with 19 additions and 1 deletions

View File

@ -141,7 +141,25 @@ Type xlsxWorkBook = Class
Function GetTable(sheet, topLeft, bottomRight); Function GetTable(sheet, topLeft, bottomRight);
Begin Begin
o := GetSheetObj(sheet); o := GetSheetObj(sheet);
if ifObj(o) then return o.Import(topLeft, bottomRight); if ifObj(o) then
begin
data := o.Import(topLeft, bottomRight, includeHeader, includeIndex, forceSingle);
if not TOfficeApi().IsUtf8() then
begin
fields := fieldnames(data);
if ifarray(fields) and length(fields) then
begin
map := array();
for i:=0 to length(fields)-1 do
map[fields[i]] := class(TSXml).Utf8ToCurCodePage(fields[i]);
reindex(data, nil, map);
end
data::begin
if ifstring(mcell) then mcell := class(TSXml).Utf8ToCurCodePage(mcell);
end
end
return data;
end
End; End;
///创建新sheet ///创建新sheet