From c536c4d53154ca482f0ee8da1684f057f855c455 Mon Sep 17 00:00:00 2001 From: csh Date: Wed, 17 May 2023 13:57:13 +0800 Subject: [PATCH] =?UTF-8?q?excel=20=20`gettable`=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- funcext/TSOffice/worksheet/xlsxWorkBook.tsf | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/funcext/TSOffice/worksheet/xlsxWorkBook.tsf b/funcext/TSOffice/worksheet/xlsxWorkBook.tsf index a1ee763..a73540c 100644 --- a/funcext/TSOffice/worksheet/xlsxWorkBook.tsf +++ b/funcext/TSOffice/worksheet/xlsxWorkBook.tsf @@ -141,7 +141,25 @@ Type xlsxWorkBook = Class Function GetTable(sheet, topLeft, bottomRight); Begin 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; ///创建新sheet