<κλάση header="doc-nav" aria-label="Πλοήγηση τεκμηρίωσης"> Τεκμηρίωση HotXLS <κλάση nav="doc-links"> Περιεχόμενα Αρχική Επισκόπηση TGridToXLS IXLSWorkbook <κλάση div="nav topic-quick-nav" aria-label="Topic shortcuts"> Αρχική Περιεχόμενα Επισκόπηση

AddTable μέθοδος

<κλάση div="indent"> <κλάση div="txt"> Attaches a BIFF8 Table (Excel ListObject) to a cell range, returning the new TXLSTable object so additional properties (StyleName, banded-row flags, TotalsRowShown) can be tuned before save. The shape mirrors TXLSXWorksheet.AddTable on the XLSX side so format-agnostic code can call the same signature. (Available since v2.33.0.)

Σύνταξη

<κλάση div="indent"> <κλάση div="txt"> function AddTable(const AName, ARange: WideString; AColumns: TStrings): TXLSTable; <κλάση table="synd"> <κλάση td="syni">AName <κλάση td="synid">WideString. The structured-reference table name shown in Excel's Name Box, e.g. 'SalesTable'. Becomes both Name and DisplayName on the returned object <κλάση td="syni">ARange <κλάση td="synid">WideString. The cell range the Table covers in A1 notation, e.g. 'A1:D10'. The first row of the range is treated as the header row <κλάση td="syni">AColumns <κλάση td="synid">TStrings. Header text per column. Must contain exactly as many entries as the range is wide

Παρατηρήσεις

<κλάση div="indent"> <κλάση div="txt"> The new table is added to the worksheet's Tables collection. Its StyleName defaults to 'TableStyleMedium2' and ShowRowStripes defaults to True, matching what Excel and the XLSX side produce. The id (1..N per sheet) is assigned at save time if you do not set it
<κλάση div="txt"> BIFF8 emits the FEATHEADR11 / FEAT11 / LIST12 record group only on SaveAs(xlExcel97). BIFF5 saves are unaffected (Tables are a BIFF8+ concept). The LIST12 record stores StyleName and the banded-row / banded-column flags using the MS-XLS table-style client layout. From v2.33.2 the sheet-level AUTOFILTERINFO / AUTOFILTER records are suppressed when a Table on the same sheet fully covers the autofilter range, because Excel embeds the autofilter inside the Table object itself; v2.87.4 also writes the corresponding table-level and field-level AutoFilter metadata into FEAT11

Παράδειγμα

<κλάση div="indent"> <κλάση div="txt"> This example writes a four-column sales region bound as a Table at A1:D10
<κλάση pre="code"> var cols: TStringList; begin cols := TStringList.Create; try cols.Add('Region'); cols.Add('Product'); cols.Add('Quarter'); cols.Add('Revenue'); Sheet.AddTable('SalesTable', 'A1:D10', cols); finally cols.Free; end;

Δείτε επίσης

<κλάση div="indent"> <κλάση div="txt"> Tablesιδιότητα
TXLSTable / TXLSTables classes <κλάση footer="reference-footer">Copyright © 2010-2026 losLab Software