HotXLS 文件

TXLSXWorksheet 類別

Single worksheet inside a TXLSXWorkbook 裡的單一工作表 持有儲存格集合,以及合併儲存格、超連結與註解 集合。宣告於 lxHandleX

宣告

type
  TXLSXTextBox = class
    constructor Create(const AText: WideString; AFromRow, AFromCol, AToRow, AToCol: Integer);
    property Text: WideString;
    property FromRow, FromCol, ToRow, ToCol: Integer;
  end;

  TXLSXIgnoredError = class
    constructor Create(const ASqRef: WideString);
    procedure Assign(Source: TXLSXIgnoredError);
    property SqRef: WideString;
    property EvalError: Boolean;
    property TwoDigitTextYear: Boolean;
    property NumberStoredAsText: Boolean;
    property Formula: Boolean;
    property FormulaRange: Boolean;
    property UnlockedFormula: Boolean;
    property EmptyCellReference: Boolean;
    property ListDataValidation: Boolean;
    property CalculatedColumn: Boolean;
  end;

  TXLSXIgnoredErrors = class
    function Add(const ASqRef: WideString): TXLSXIgnoredError;
    function AddExisting(Source: TXLSXIgnoredError): TXLSXIgnoredError;
    procedure Delete(Index: Integer);
    procedure Clear;
    property Count: Integer;
    property Items[Index: Integer]: TXLSXIgnoredError; default;
  end;

  TXLSXScenarioInputCell = class
    property Ref: WideString;
    property Value: WideString;
    property NumberFormatId: Integer;
    property Deleted: Boolean;
    property Undone: Boolean;
  end;

  TXLSXScenarioInputCells = class
    function Add(const ARef, AValue: WideString): TXLSXScenarioInputCell;
    procedure Delete(Index: Integer);
    procedure Clear;
    property Count: Integer;
    property Items[Index: Integer]: TXLSXScenarioInputCell; default;
  end;

  TXLSXScenario = class
    property Name: WideString;
    property Locked: Boolean;
    property Hidden: Boolean;
    property User: WideString;
    property Comment: WideString;
    property InputCells: TXLSXScenarioInputCells;
  end;

  TXLSXScenarios = class
    function Add(const AName: WideString): TXLSXScenario;
    function FindByName(const AName: WideString): TXLSXScenario;
    procedure Delete(Index: Integer);
    procedure Clear;
    property Count: Integer;
    property Items[Index: Integer]: TXLSXScenario; default;
    property CurrentIndex: Integer;
    property ShownIndex: Integer;
    property SqRef: WideString;
  end;

  TXLSXWorksheet = class
    constructor Create(const AName: WideString);
    destructor Destroy; override;
    procedure SetWorkbook(AWorkbook: TXLSXWorkbook);
    function MergeCells(ARow1, ACol1, ARow2, ACol2: Integer): Integer;
    function FillMergedCellValues: Integer;
    property FormControls: TXLSXFormControls;
    function AddHyperlink(ARow, ACol: Integer; const AUrl: WideString): Integer; overload;
    function AddHyperlink(ARow, ACol: Integer; const AUrl, ADisplay: WideString): Integer; overload;
    function AddHyperlink(ARow, ACol: Integer; const AUrl, ADisplay, ATooltip: WideString): Integer; overload;
    function AddComment(ARow, ACol: Integer; const AText: WideString): Integer; overload;
    function AddComment(ARow, ACol: Integer; const AText, AAuthor: WideString): Integer; overload;
    function AddImage(ARow, ACol: Integer; const AData: AnsiString; AFormat: TXLSXImageFormat): Integer;
    function AddImageFromFile(ARow, ACol: Integer; const AFileName: WideString): Integer;
    function AddConditionalFormat(const ARange: WideString; AOp: TXLSXCfOperator; const AFormula1: WideString): Integer; overload;
    function AddConditionalFormat(const ARange: WideString; AOp: TXLSXCfOperator; const AFormula1, AFormula2: WideString): Integer; overload;
    // Excel 2007+ extension rules (v2.36.0+) — mirror the BIFF8 TXLSWorksheet API.
    // Their colors are BGR ($00BBGGRR, like a VCL TColor), not the ARGB used by fonts and fills
    function AddCondFormatDataBar(const ARange: WideString; AColor: LongWord;
      AMinKind: TXLSCfValueKind = cfvMinOfRange; const AMinValue: WideString = '';
      AMaxKind: TXLSCfValueKind = cfvMaxOfRange; const AMaxValue: WideString = ''): Integer;
    function AddCondFormatColorScale2(const ARange: WideString;
      AMinColor, AMaxColor: LongWord;
      AMinKind: TXLSCfValueKind = cfvMinOfRange; const AMinValue: WideString = '';
      AMaxKind: TXLSCfValueKind = cfvMaxOfRange; const AMaxValue: WideString = ''): Integer;
    function AddCondFormatColorScale3(const ARange: WideString;
      AMinColor, AMidColor, AMaxColor: LongWord;
      AMinKind: TXLSCfValueKind = cfvMinOfRange; const AMinValue: WideString = '';
      AMidKind: TXLSCfValueKind = cfvPercentile; const AMidValue: WideString = '50';
      AMaxKind: TXLSCfValueKind = cfvMaxOfRange; const AMaxValue: WideString = ''): Integer;
    function AddCondFormatIconSet(const ARange: WideString;
      ASetType: TXLSIconSetType): Integer;
    function AddCondFormatExpression(const ARange: WideString;
      const AFormula: WideString): Integer;
    function AddCondFormatContainsText(const ARange, AText: WideString): Integer;
    function AddCondFormatNotContainsText(const ARange, AText: WideString): Integer;
    function AddCondFormatBeginsWith(const ARange, AText: WideString): Integer;
    function AddCondFormatEndsWith(const ARange, AText: WideString): Integer;
    function AddCondFormatTop10(const ARange: WideString; ARank: Integer;
      ABottom: Boolean = False; APercent: Boolean = False): Integer;
    function AddCondFormatAboveAverage(const ARange: WideString;
      AAbove: Boolean = True): Integer;
    function AddCondFormatDuplicateValues(const ARange: WideString): Integer;
    function AddCondFormatUniqueValues(const ARange: WideString): Integer;
    function AddCondFormatContainsBlanks(const ARange: WideString): Integer;
    function AddCondFormatNotContainsBlanks(const ARange: WideString): Integer;
    function AddCondFormatContainsErrors(const ARange: WideString): Integer;
    function AddCondFormatNotContainsErrors(const ARange: WideString): Integer;
    function AddDataValidation(const ARange: WideString; AType: TXLSXDataValidationType; AOp: TXLSXDvOperator; const AFormula1: WideString): Integer; overload;
    function AddDataValidation(const ARange: WideString; AType: TXLSXDataValidationType; AOp: TXLSXDvOperator; const AFormula1, AFormula2: WideString): Integer; overload;
    function AddListValidation(const ARange, AItems: WideString): Integer;
    function AddWholeNumberValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1: WideString): Integer; overload;
    function AddWholeNumberValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1, AFormula2: WideString): Integer; overload;
    function AddDecimalValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1: WideString): Integer; overload;
    function AddDecimalValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1, AFormula2: WideString): Integer; overload;
    function AddDateValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1: WideString): Integer; overload;
    function AddDateValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1, AFormula2: WideString): Integer; overload;
    function AddTimeValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1: WideString): Integer; overload;
    function AddTimeValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1, AFormula2: WideString): Integer; overload;
    function AddTextLengthValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1: WideString): Integer; overload;
    function AddTextLengthValidation(const ARange: WideString; AOp: TXLSXDvOperator; const AFormula1, AFormula2: WideString): Integer; overload;
    function AddCustomValidation(const ARange, AFormula: WideString): Integer;
    function CheckDataValidation(ARow, ACol: Integer; const AValue: Variant;
      SetIfValid: Boolean = False): Integer;
    // Excel-style table (insert table) — see TXLSXTable.
    function AddTable(const AName, ARange: WideString; AColumns: TStrings): Integer;
    // Chart helpers — anchored or full-page (via AddChartSheet on workbook).
    function AddChart(AChartType: TXLSXChartType; const ATitle: WideString;
      AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXChart;
    // Standalone drawing text boxes.
    function AddTextBox(const AText: WideString;
      AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXTextBox;
    function TextBoxCount: Integer;
    function TextBox(Index: Integer): TXLSXTextBox;
    function IndexOfTextBoxAt(ARow, ACol: Integer): Integer;
    function FindTextBoxAt(ARow, ACol: Integer): TXLSXTextBox;
    procedure DeleteTextBox(Index: Integer);
    function DeleteTextBoxAt(ARow, ACol: Integer): Boolean;
    function DeleteTextBoxesInRange(ARow1, ACol1, ARow2, ACol2: Integer): Integer;
    procedure ClearTextBoxes;
    // Internal Sheet!Cell hyperlink (no rels relationship needed).
    function AddHyperlinkToCell(ARow, ACol: Integer; const ALocation: WideString): Integer; overload;
    function AddHyperlinkToCell(ARow, ACol: Integer; const ALocation, ADisplay: WideString): Integer; overload;
    function AddHyperlinkToCell(ARow, ACol: Integer; const ALocation, ADisplay, ATooltip: WideString): Integer; overload;
    // Sheet visibility and selection state.
    property Visibility: TXLSXSheetVisibility;
    property Visible: Boolean;
    property IsSelected: Boolean;
    procedure SetIsSelected(Value: Boolean);
    // Auto-fit column width / row height from cell content.
    procedure AutoFitColumn(ACol: Integer; AMinWidth: Double = 0; AMaxWidth: Double = 0);
    procedure AutoFitColumns(AColMin, AColMax: Integer; AMinWidth: Double = 0; AMaxWidth: Double = 0);
    procedure AutoFitRow(ARow: Integer; AMinHeight: Double = 0; AMaxHeight: Double = 0);
    procedure AutoFitRows(ARowMin, ARowMax: Integer; AMinHeight: Double = 0; AMaxHeight: Double = 0);
    // Row / column insert and delete with cascade shift.
    procedure InsertRows(BeforeRow, Count: Integer);
    procedure DeleteRows(StartRow, Count: Integer);
    procedure InsertCols(BeforeCol, Count: Integer);
    procedure DeleteCols(StartCol, Count: Integer);
    // Manual page breaks.
    procedure AddRowBreak(BeforeRow: Integer);
    procedure AddColBreak(BeforeCol: Integer);
    function  HasRowBreak(BeforeRow: Integer): Boolean;
    function  HasColBreak(BeforeCol: Integer): Boolean;
    function  IndexOfRowBreak(BeforeRow: Integer): Integer;
    function  IndexOfColBreak(BeforeCol: Integer): Integer;
    procedure RemoveRowBreak(BeforeRow: Integer);
    procedure RemoveColBreak(BeforeCol: Integer);
    function  RemoveRowBreaksInRange(FirstRow, LastRow: Integer): Integer;
    function  RemoveColBreaksInRange(FirstCol, LastCol: Integer): Integer;
    procedure ClearRowBreaks;
    procedure ClearColBreaks;
    procedure ClearAllPageBreaks;
    function  RowBreakCount: Integer;
    function  ColBreakCount: Integer;
    function  RowBreaks(Index: Integer): Integer;
    function  ColBreaks(Index: Integer): Integer;
    function  KeepRowLinkLevel(AfterRow: Integer): Integer;
    function  KeepColLinkLevel(AfterCol: Integer): Integer;
    function Calculate(const Formula: WideString): Variant;
    function ForEachCell(Callback: TXLSXCellReadEvent): Integer;
    function ForEachFormattedCell(Callback: TXLSXCellTextEvent): Integer;
    function ForEachRow(Callback: TXLSXRowReadEvent): Integer;
    function FindText(const SearchText: WideString; out Row, Col: Integer): Boolean; overload;
    function FindText(const SearchText: WideString; out Row, Col: Integer; MatchCase: Boolean): Boolean; overload;
    function ReplaceText(const SearchText, ReplacementText: WideString): Integer; overload;
    function ReplaceText(const SearchText, ReplacementText: WideString; MatchCase: Boolean): Integer; overload;
    function FindText(const SearchText: WideString; out Row, Col: Integer; Options: TXLSXFindOptions; StartRow, StartCol: Integer): Boolean; overload;
    function FindTextIn(const SearchText: WideString; out Row, Col: Integer; Options: TXLSXFindOptions; FirstRow, FirstCol, LastRow, LastCol, StartRow, StartCol: Integer): Boolean;
    function ReplaceText(const SearchText, ReplacementText: WideString; Options: TXLSXFindOptions): Integer; overload;
    function ReplaceText(const SearchText, ReplacementText: WideString; Options: TXLSXFindOptions; Callback: TXLSXReplaceEvent): Integer; overload;
    function ReplaceTextIn(const SearchText, ReplacementText: WideString; Options: TXLSXFindOptions; FirstRow, FirstCol, LastRow, LastCol: Integer; Callback: TXLSXReplaceEvent): Integer;
    function WriteCells(const ARange: WideString; Callback: TXLSXCellWriteEvent): Integer; overload;
    function WriteCells(ARow1, ACol1, ARow2, ACol2: Integer; Callback: TXLSXCellWriteEvent): Integer; overload;
    function WriteRows(const ARange: WideString; Callback: TXLSXRowWriteEvent): Integer; overload;
    function WriteRows(ARow1, ACol1, ARow2, ACol2: Integer; Callback: TXLSXRowWriteEvent): Integer; overload;
    function WriteFloatRowValues(ARow, ACol: Integer; const AValues: array of Double): Integer;
    function WriteStringRowValues(ARow, ACol: Integer; const AValues: array of WideString): Integer;
    function WriteRowValues(ARow, ACol: Integer; const AValues: array of Variant): Integer;
    function WriteFloatColumnValues(ARow, ACol: Integer; const AValues: array of Double): Integer;
    function WriteStringColumnValues(ARow, ACol: Integer; const AValues: array of WideString): Integer;
    function WriteColumnValues(ARow, ACol: Integer; const AValues: array of Variant): Integer;
    // Column / row metadata.
    procedure SetColWidth(ACol: Integer; AWidth: Double);
    function HasColWidth(ACol: Integer): Boolean;
    procedure ClearColWidths;
    procedure SetRowHeight(ARow: Integer; AHeight: Double);
    function HasRowHeight(ARow: Integer): Boolean;
    procedure ClearRowHeights;
    procedure SetRowOutlineLevel(ARow, ALevel: Integer);
    function HasRowOutlineLevel(ARow: Integer): Boolean;
    procedure ClearRowOutlineLevels;
    procedure SetColOutlineLevel(ACol, ALevel: Integer);
    function HasColOutlineLevel(ACol: Integer): Boolean;
    procedure ClearColOutlineLevels;
    procedure SetRowHidden(ARow: Integer; AHidden: Boolean);
    procedure SetColHidden(ACol: Integer; AHidden: Boolean);
    procedure ClearRowHidden;
    procedure ClearColHidden;
    procedure SetRowCollapsed(ARow: Integer; ACollapsed: Boolean);
    procedure SetColCollapsed(ACol: Integer; ACollapsed: Boolean);
    procedure ClearRowCollapsed;
    procedure ClearColCollapsed;
    function TryGetOutlineNode(AAxis: TXLSOutlineAxis; ANodeIndex: Integer; out ANode: TXLSOutlineNode): Boolean;
    function SetOutlineNodeCollapsed(AAxis: TXLSOutlineAxis; ANodeIndex: Integer; ACollapsed: Boolean; AChildMode: TXLSOutlineChildMode = xocPreserve): Boolean;
    procedure SetOutlineDisplayLevel(AAxis: TXLSOutlineAxis; ADisplayLevel: Integer; AChildMode: TXLSOutlineChildMode = xocPreserve);
    // Range copy / move / clear API.
    procedure ClearRangeValues(const ARange: WideString); overload;
    procedure ClearRangeValues(ARow1, ACol1, ARow2, ACol2: Integer); overload;
    procedure ClearRange(ARow1, ACol1, ARow2, ACol2: Integer);
    procedure CopyRange(ASrcRow1, ASrcCol1, ASrcRow2, ASrcCol2, ADstRow, ADstCol: Integer);
    procedure CopyRangeTo(ASrcRow1, ASrcCol1, ASrcRow2, ASrcCol2: Integer;
      ATargetSheet: TXLSXWorksheet; ADstRow, ADstCol: Integer);
    procedure CopyFrom(ASource: TXLSXWorksheet);
    procedure MoveRange(ASrcRow1, ASrcCol1, ASrcRow2, ASrcCol2, ADstRow, ADstCol: Integer);
    procedure SortRange(ARow1, ACol1, ARow2, ACol2: Integer;
      const AKeyCols: array of Integer; const ADescending: array of Boolean);
    function GetCellVisibleFormat(ARow, ACol: Integer): TXLSXCellStyleState;
    function Subtotal(ARow1, ACol1, ARow2, ACol2, AChangeColumn,
      AFunction: Integer; const ASubtotalColumns: array of Integer): Integer; overload;
    function Subtotal(ARow1, ACol1, ARow2, ACol2, AChangeColumn,
      AFunction: Integer; const ASubtotalColumns: array of Integer;
      const AGrandTotalText: WideString): Integer; overload;
    function SubtotalDefaultEnglishString(AFunction: Integer): WideString;
    // Frozen panes (top rows / left columns).
    procedure FreezePanes(ARow, ACol: Integer);
    procedure UnfreezePane;
    property FreezeCol, FreezeRow: Integer;
    // Page setup.
    procedure SetPageMargins(ALeft, ARight, ATop, ABottom: Double); overload;
    procedure SetPageMargins(ALeft, ARight, ATop, ABottom, AHeader, AFooter: Double); overload;
    property MarginLeft, MarginRight, MarginTop, MarginBottom,
             MarginHeader, MarginFooter: Double;
    property MarginLeftCM, MarginRightCM, MarginTopCM, MarginBottomCM,
             MarginHeaderCM, MarginFooterCM: Double;
    property PageLandscape: Boolean;
    property PaperSize, PageScale, FitToWidth, FitToHeight: Integer;
    property HeaderText, FooterText: WideString;
    property LeftHeader, CenterHeader, RightHeader: WideString;
    property LeftFooter, CenterFooter, RightFooter: WideString;
    property CenterHorizontally, CenterVertically: Boolean;
    property PrintGridlines: Boolean;
    property PrintHeadings: Boolean;
    property BlackAndWhite: Boolean;
    property Draft: Boolean;
    property PrintNotes: Boolean;
    property PrintOverThenDown: Boolean;
    property PrintArea: WideString;
    property PrintTitleRows: WideString;
    property PrintTitleCols: WideString;
    // Auto-filter range (e.g. "A1:C100"). Empty = no filter.
    procedure SetAutoFilter(ARow1, ACol1, ARow2, ACol2: Integer); overload;
    procedure SetAutoFilter(const ARange: WideString); overload;
    procedure ClearAutoFilter;
    property AutoFilterRange: WideString;
    property AutoFilterColumns: TXLSXAutoFilterColumns;
    function AddAutoFilterColumn(AColId: Integer; AOp1: TXLSXAutoFilterOp; const ACriteria1: WideString): TXLSXAutoFilterColumn; overload;
    function AddAutoFilterColumn(AColId: Integer; AOp1: TXLSXAutoFilterOp; const ACriteria1: WideString; AOp2: TXLSXAutoFilterOp; const ACriteria2: WideString; AAndConnector: Boolean): TXLSXAutoFilterColumn; overload;
    procedure ClearAutoFilterColumns;
    function AutoFilterRowVisible(ARow: Integer): Boolean;
    function PreviewAutoFilterRows(Callback: TXLSXAutoFilterRowEvent): Integer;
    function ApplyAutoFilter(const ARange: WideString): Boolean;
    // Sheet protection (16-bit legacy hash).
    procedure Protect; overload;
    procedure Protect(const APassword: WideString); overload;
    procedure UnProtect;
    property IsProtected: Boolean;
    property AllowOption[Option: TXLSXSheetProtectionOption]: Boolean;
    property SheetProtectionOptions: TXLSXSheetProtectionOptions;
    property PageSetupTouched: Boolean;
    property SheetProtectHash: WideString;
    // Sheet tab color + chart-sheet flag.
    property TabColor: LongWord;
    property TabColorIsAuto: Boolean;
    property IsChartSheet: Boolean;
    property Name: WideString;
    property Workbook: TXLSXWorkbook;
    property AlignWithMargins: Boolean;
    property CodeName: WideString;
    property ConsolidateXml: WideString;
    property DifferentFirst: Boolean;
    property DifferentOddEven: Boolean;
    property EvenFooterText: WideString;
    property EvenHeaderText: WideString;
    property FirstFooterText: WideString;
    property FirstHeaderText: WideString;
    property FirstPageNumber: Integer;
    property GridColor: LongWord;
    property HorizontalDpi: Integer;
    property OutlineLevelCol: Integer;
    property OutlineLevelRow: Integer;
    property PaneState: WideString;
    property PhoneticAlignment: WideString;
    property PhoneticFontId: Integer;
    property PhoneticType: WideString;
    property PrintErrors: Integer;
    property ScaleWithDoc: Boolean;
    property ScenariosXml: WideString;
    property SheetProtectAlgorithmName: WideString;
    property SheetProtectHashValue: WideString;
    property SheetProtectSaltValue: WideString;
    property SheetProtectSpinCount: Integer;
    property ShowFormulas: Boolean;
    property ShowOutlineSymbols: Boolean;
    property SortState: TXLSXSortState;
    property SortStateXml: WideString;
    property SummaryBelow: Boolean;
    property SummaryRight: Boolean;
    property UseFirstPageNumber: Boolean;
    property UsePrinterDefaults: Boolean;
    property VerticalDpi: Integer;
    property ZeroHeight: Boolean;
    property ZoomNormal: Integer;
    property ZoomPageLayout: Integer;
    property ZoomSheetLayout: Integer;
    // Sheet view display options.
    property View: TXLSXWindowView;
    property Zoom: Integer;
    property DisplayGridLines: Boolean;
    property DisplayZeros: Boolean;
    property DisplayRightToLeft: Boolean;
    property StandardWidth: Double;
    property StandardHeight: Double;
    // Collections owned by the worksheet.
    property Cells: TXLSXCells;
    property MergedCells: TXLSXMergedCells;
    property Hyperlinks: TXLSXHyperlinks;
    property Comments: TXLSXComments;
    property Images: TXLSXImages;
    property ConditionalFormats: TXLSXConditionalFormats;
    property DataValidations: TXLSXDataValidations;
    property IgnoredErrors: TXLSXIgnoredErrors;
    property Scenarios: TXLSXScenarios;
    property Tables: TXLSXTables;
    property Charts: TXLSXCharts;
    property PivotTables: TXLSPivotTables;
    function AddPivotTable(const SourceRangeA1: WideString; DestRow, DestCol: Integer; const Name: WideString): TXLSPivotTable;
    function AddPivotTableCopy(SourcePivot: TXLSPivotTable; DestRow, DestCol: Integer; const NewName: WideString): TXLSPivotTable;
    function PivotSetDataFieldFormat(DataField: TXLSPivotDataField; const FormatStr: WideString): Word;
    property ColWidth[ACol: Integer]: Double;
    property RowHeight[ARow: Integer]: Double;
    property RowOutlineLevel[ARow: Integer]: Integer;
    property ColOutlineLevel[ACol: Integer]: Integer;
    property RowHidden[ARow: Integer]: Boolean;
    property ColHidden[ACol: Integer]: Boolean;
    property RowCollapsed[ARow: Integer]: Boolean;
    property ColCollapsed[ACol: Integer]: Boolean;
    property Range[const Ref: WideString]: TXLSXRange;
    property RCRange[R1, C1, R2, C2: Integer]: TXLSXRange;
    property UsedRange: TXLSXRange;
    function EntireRow(ARow: Integer): TXLSXRange;
    function EntireColumn(ACol: Integer): TXLSXRange;
    property ProtectedRanges: TXLSXProtectedRanges;
    property RawWorksheetExts: TXLSXRawWorksheetExts;
    property SparklineGroups: TXLSXSparklineGroups;
    property ThreadedComments: TXLSXThreadedComments;
    function AddAreaChart(AChartType: TXLSXChartType; const ATitle: WideString; AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXChart;
    function AddBarChart(AChartType: TXLSXChartType; const ATitle: WideString; AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXChart;
    function AddChartFromRange(const ARange: WideString; AChartType: TXLSXChartType): TXLSXChart;
    function AddColumnChart(AChartType: TXLSXChartType; const ATitle: WideString; AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXChart;
    function AddLineChart(AChartType: TXLSXChartType; const ATitle: WideString; AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXChart;
    function AddPieChart(AChartType: TXLSXChartType; const ATitle: WideString; AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXChart;
    function AddSparklineGroup(const ARange, ALocation: WideString; AType: TXLSXSparklineType): TXLSXSparklineGroup;
    function AddThreadedComment(ARow, ACol: Integer; const AText, AAuthor: WideString): TXLSXThreadedComment;
    function AddThreadedReply(AParentComment: TXLSXThreadedComment; const AText, AAuthor: WideString): TXLSXThreadedComment;
    function GetSheetProtectOption(Option: TXLSXSheetProtectionOption): Boolean;
    procedure SetSheetProtectOption(Option: TXLSXSheetProtectionOption; Value: Boolean);
    procedure PasteFromClipboard(StartRow, StartCol: Integer);
    function AddWordArt(const AText, APreset: WideString; AFromRow, AFromCol, AToRow, AToCol: Integer): TXLSXTextBox;
    procedure BuildRowMajorCellOrder;
    procedure ClearRawDrawingAnchors;
    function CreateConditionalFormatEvaluator: TXLSXConditionalFormatEvaluator;
    function RawDrawingAnchor(Index: Integer): WideString;
    function RawDrawingAnchorCount: Integer;
    function AddRawDrawingAnchor(const AXml: WideString): TXLSXDrawingObject;
    procedure BringToFront(AObject: TXLSXDrawingObject);
    procedure SendToBack(AObject: TXLSXDrawingObject);
    procedure BringForward(AObject: TXLSXDrawingObject);
    procedure SendBackward(AObject: TXLSXDrawingObject);
    function SaveAsPDF(const FileName: WideString): Integer; overload;
    function SaveAsPDF(Stream: TStream): Integer; overload;
    procedure ToggleColGrouped(ACol: Integer);
    procedure ToggleRowGrouped(ARow: Integer);
  end;

  TXLSXBuiltinCellStyle = (
    xbsNormal, xbsGood, xbsBad, xbsNeutral,
    xbsCalculation, xbsCheckCell, xbsExplanatoryText, xbsInput,
    xbsLinkedCell, xbsNote, xbsOutput, xbsWarningText,
    xbsHeading1, xbsHeading2, xbsHeading3, xbsHeading4, xbsTitle, xbsTotal,
    xbsAccent1, xbsAccent2, xbsAccent3, xbsAccent4, xbsAccent5, xbsAccent6);

  TXLSXRange = class
    function RefA1: WideString;
    function SaveAsHTML(const FileName: WideString): Integer; overload;
    function SaveAsHTML(const FileName: WideString; Options: TXLSXHtmlExportOptions): Integer; overload;
    function SaveAsHTML(Stream: TStream): Integer; overload;
    function SaveAsHTML(Stream: TStream; Options: TXLSXHtmlExportOptions): Integer; overload;
    procedure SetValue(const V: Variant);
    procedure SetFormula(const F: WideString);
    procedure ClearValues;
    procedure Clear;
    procedure ClearAll;
    procedure SetFontIndex(AIdx: Integer);
    procedure SetFillIndex(AIdx: Integer);
    procedure SetBorderIndex(AIdx: Integer);
    procedure SetNumberFormatIndex(AIdx: Integer);
    procedure SetAlignmentIndex(AIdx: Integer);
    procedure SetNumberFormat(const Fmt: WideString);
    procedure SetBorders(Kind: TXLSXBorderEdgeKind; Style: TXLSXBorderStyle); overload;
    procedure SetBorders(Kind: TXLSXBorderEdgeKind; Style: TXLSXBorderStyle; Color: LongWord); overload;
    procedure SetLocked(ALocked: Boolean);
    procedure SetFormulaHidden(AHidden: Boolean);
    procedure AutoFitColumns(AMinWidth: Double = 0; AMaxWidth: Double = 0);
    procedure AutoFitRows(AMinHeight: Double = 0; AMaxHeight: Double = 0);
    procedure Merge; overload;
    procedure Merge(Across: OleVariant); overload;
    procedure Unmerge;
    function Offset(DRow, DCol: Integer): TXLSXRange;
    function Resize(NewRowCount, NewColCount: Integer): TXLSXRange;
    procedure Sort(AKeyColumn: Integer; ADescending: Boolean = False); overload;
    procedure Sort(const AKeyColumns: array of Integer; const ADescending: array of Boolean); overload;
    procedure ApplyBuiltinStyle(AStyle: TXLSXBuiltinCellStyle);
    procedure CopyTo(ADestRow, ADestCol: Integer);
    procedure MoveTo(ADestRow, ADestCol: Integer);
    procedure InsertRows;
    procedure DeleteRows;
    procedure InsertCols;
    procedure DeleteCols;
  end;
      

成員

NameExcel 顯示的工作表索引標籤名稱
SetWorkbook / Workbook設定並暴露儲存格與活頁簿共用輔助功能(共用數值格式、填滿、框線、共用字串查閱)所需的活頁簿反向參照
Cells儲存格集合。使用 Cells.Item[Row, Col].Value 。請參閱 TXLSXCells / TXLSXCell
Calculate在這個工作表的情境下編譯並求值 Excel 公式字串。接受前導 = ,工作表本機參照、被參照的公式儲存格、跨工作表參照、定義名稱範圍,以及支援的文字、日期、工作日、工程/進位制轉換、位元運算、統計、聚合與數學函式,都由活頁簿共用的公式求值器解析
GetCellVisibleFormat / Subtotal / SubtotalDefaultEnglishString / CheckDataValidationGetCellVisibleFormat 在不建立空儲存格的前提下解析座標上的有效樣式。 Subtotal 依絕對工作表欄的變化把已排序矩形分組,接受 Excel SUBTOTAL 函式編號 1 到 11 或 101 到 111,插入公式列與大綱列,回傳插入的列數。 SubtotalDefaultEnglishString 把 SUBTOTAL 函式編號映射到英文名稱(例如 1 對 Average 、 9 對 Total)。 CheckDataValidation 對合法候選值回傳 -1 ,否則回傳第一個失敗規則的 1 起始索引;只有 SetIfValid 為 true 且所有適用規則都通過時才會寫入
ForEachCell / ForEachFormattedCell / ForEachRow / FindText / ReplaceText / WriteCells / WriteRows已載入儲存格與已載入列的走訪、文字搜尋、文字取代與範圍填值輔助方法。 ForEachCell 按列序走訪既有儲存格,提供值與公式文字。 ForEachFormattedCell 按列欄序走訪已填內容的儲存格,送出套用數值格式後的顯示文字,回傳走訪數並支援 callback 中止。 ForEachRow 按列序走訪既有資料列,回報每列第一個與最後一個已載入欄。 FindText 與 ReplaceText 按列序掃描已載入的文字儲存格,略過公式與非文字值,可區分大小寫;選項多載加入 Excel 尋找對話框語意(萬用字元、整格比對、大小寫、搜尋公式文字、反向掃描、以欄為主掃描), FindTextIn / ReplaceTextIn 則把掃描限縮在矩形視窗內,並可選擇每筆命中的取代 callback。 WriteCells 對數字或 A1 樣式範圍逐格請求值,支援逐格略過與中止。 WriteRows 對每一列請求一個 Variant 陣列,支援整列略過與中止
MergedCells合併範圍集合。請參閱 TXLSXMergedCells
Hyperlinks超連結集合。請參閱 TXLSXHyperlinks
Comments儲存格註解集合。請參閱 TXLSXComments
Tables / AddTable工作表上的 Excel 樣式表格帶。請參閱 TXLSXTable / TXLSXTables
Charts / AddChart錨定圖表集合。請參閱 TXLSXChart / TXLSXCharts 。圖表型別列舉支援直條圖、橫條圖、折線圖、圓形圖、面積圖、環圈圖、XY 散佈圖、泡泡圖與雷達圖。整頁圖表請改用 Workbook.AddChartSheet(...)
AddTextBox / TextBoxCount / TextBox / FindTextBoxAt建立、列舉、定位、刪除與清空錨定在儲存格矩形上的獨立繪圖文字方塊。 IndexOfTextBoxAt 與 FindTextBoxAt 找出第一個包含某儲存格的文字方塊; DeleteTextBoxAt、 DeleteTextBoxesInRange、 DeleteTextBox與 ClearTextBoxes 移除單個或成組的文字方塊,不會動到儲存格註解
AddHyperlinkToCell overloads內部錨點超連結 —— 跳到活頁簿其他位置的 Sheet!Cell 。不會產生 rels 關聯。請參閱 TXLSXHyperlink.Location
RowOutlineLevel / ColOutlineLevel對應列或欄的群組巢狀層級(0..7)。SaveAs 會在列 / 欄條目上輸出 outlineLevel="N" on the row / col entry
RowHidden / ColHiddenBoolean —— 把該列或欄從畫面上隱藏(hidden="1")
RowCollapsed / ColCollapsedBoolean —— 標記某列 / 欄的群組父層已摺疊(collapsed="1")
FreezePanes(Row, Col) / UnfreezePane設定凍結分割 —— 上方 Row 列與左側 Col 欄固定可見,其餘部分捲動。 FreezeCol 與 FreezeRow 是唯讀屬性,暴露目前的分割
SetPageMargins / Page setup properties全部六個邊界,加上 PageLandscape、 PaperSize、 PageScale、 FitToWidth、 FitToHeight、 HeaderText、 FooterText、 LeftHeader、 CenterHeader、 RightHeader、 LeftFooter、 CenterFooter、 RightFooter、 CenterHorizontally與 CenterVertically。設定任何一項都會在 SaveAs 時觸發對應的 <pageMargins>、 <pageSetup>與 <headerFooter> 區塊。盡量用具名的 xlsxPaper* 常數(例如 xlsxPaperLetter、 xlsxPaperA4、 xlsxPaperA3、 xlsxPaperLegal ),別直接用 Excel 紙張代碼
Visibility工作表可見性: xlsxSheetVisible (預設)、 xlsxSheetHidden (隱藏,但可在 Excel UI 取消隱藏)或 xlsxSheetVeryHidden (需要 VBA 或程式碼才取消得到)。SaveAs 會在 state 的 <sheet> 元素上輸出 xl/workbook.xmlVisible 是 Boolean 便利別名,對應常用的顯示 / 隱藏操作
SetIsSelected / IsSelected設為 True時,工作表索引標籤呈現選取(高亮)狀態。可以同時選取多張工作表。SaveAs 會在對應的 tabSelected="1" 上輸出 <sheetView>
AutoFitColumn / AutoFitColumnsAutoFitColumn(Col, MinWidth, MaxWidth) 量測欄內每個儲存格,把 ColWidth[Col] 設成最寬內容(ASCII 算 1 字元、CJK 算 2 字元,Calibri 11pt 尺度),再套用選用的最小與最大寬度限制。 AutoFitColumns(Min, Max, MinWidth, MaxWidth) 迭代欄位範圍,上限到最後一個有儲存格的欄
AutoFitRow / AutoFitRowsAutoFitRow(Row, MinHeight, MaxHeight) 把 RowHeight[Row] 設成該列最高的儲存格內容(以點為單位),再套用選用的最小與最大高度限制。 AutoFitRows(Min, Max, MinHeight, MaxHeight) 迭代列範圍,上限到最後一個有儲存格的列
InsertRows / DeleteRowsInsertRows(BeforeRow, Count) 把 BeforeRow 及其下方的所有列往下移 Count列。 DeleteRows(StartRow, Count) 移除 [StartRow, StartRow+Count-1] 之間的列,其餘上移。兩者都會級聯更新儲存格、合併範圍、列高、大綱層級、隱藏旗標、超連結、註解、凍結窗格、auto-filter / 條件格式 / 資料驗證參照、表格、儲存格公式、條件格式 / 資料驗證公式、內部超連結目標、列印設定參照、手動分頁、auto-filter 欄條件、圖表數列範圍,以及指向這張工作表的定義名稱,還有圖片錨點與圖表錨點
InsertCols / DeleteCols同 InsertRows / DeleteRows ,但作用在欄上。欄寬、大綱層級與隱藏旗標也會一併更新
AddRowBreak / AddColBreakAddRowBreak(N) 在第 N 列之前插入手動分頁(也就是第 N 列從新的列印頁開始)。 AddColBreak(N) 在第 N欄之前分頁。SaveAs 在工作表 XML 寫入 <rowBreaks> / <colBreaks> in the sheet XML
HasRowBreak / HasColBreak / IndexOfRowBreak / IndexOfColBreak以「before」索引查詢或定位單一手動分頁
RemoveRowBreak / RemoveColBreak / RemoveRowBreaksInRange / RemoveColBreaksInRange移除單一手動分頁,或移除閉區間列 / 欄範圍內的所有分頁;範圍輔助方法接受顛倒的座標,回傳移除的分頁數
ClearRowBreaks / ClearColBreaks / ClearAllPageBreaks移除所有列分頁、所有欄分頁,或兩者一起清
RowBreakCount / ColBreakCount / RowBreaks[i] / ColBreaks[i]迭代已儲存的分頁索引(1 起始的「before」值)
KeepRowLinkLevel / KeepColLinkLevel回傳把給定索引之後的列(或欄)與上方(或左側)區塊連在一起的「保持同頁」最強層級;位置不在任何保持同頁區塊內時回傳 0 when the position is not inside a keep-together block
PrintGridlines / PrintHeadings設為 True時,SaveAs 會在 printGridLines="1" 內輸出 printRowColHeadings="1" / <printOptions> ,讓列欄格線或標題出現在列印頁面上
BlackAndWhite / Draft / PrintNotes / PrintOverThenDownPrint options in <pageSetup>裡的列印選項: BlackAndWhite 以黑白呈現; Draft 關掉圖形以加快預覽; PrintNotes 依顯示原樣列印儲存格註解; PrintOverThenDown 把頁面順序從先上後下改成先左後右
PrintAreaExcel 列印的矩形區域(例如 "$A$1:$D$10")。以活頁簿層級的 <definedName name="_xlnm.Print_Area"> 寫入,範圍限定在這張工作表。空字串 = 未設定
PrintTitleRows / PrintTitleCols每頁重複的列或欄範圍(例如 "$1:$3" 或 "$A:$B")。以 <definedName name="_xlnm.Print_Titles">
SetAutoFilter / AutoFilterRange設定篩選範圍(例如 "A1:C100");SaveAs 寫出 <autoFilter ref="..."/>
AutoFilterColumns / AddAutoFilterColumn / ClearAutoFilterColumns附加在 auto-filter 範圍上的逐欄篩選條件。 AddAutoFilterColumn(ColId, Op, Criteria) 加入單一條件的篩選;雙條件多載加入一組 AND/OR。 AutoFilterColumns.FindByColId(ColId) 回傳既有的條件物件, AutoFilterColumns.DeleteByColId(ColId) 直接移除一個、不必手動掃 Items , AutoFilterColumns.ClearCriteria 清掉所有欄條件但保留篩選範圍。 ColId 是 auto-filter 範圍內的 0 起始位移(不是工作表欄號)。SaveAs 在 <filterColumn> 內寫出 <autoFilter>
AutoFilterRowVisible / PreviewAutoFilterRows / ApplyAutoFilterAutoFilterRowVisible(Row) 對單一資料列求值已儲存的 XLSX AutoFilter 條件。 PreviewAutoFilterRows 走訪 AutoFilterRange內的資料列,透過 callback 回報每列的可見狀態,回傳走訪到的可見列數,且不變更列隱藏旗標。 ApplyAutoFilter 套用 auto-filter 條件、隱藏不符合的列,回傳是否成功
Protect / UnProtect / IsProtected工作表層級保護開關,可帶選用的 16 位元舊式密碼雜湊。反映為 <sheetProtection>
AllowOption / SheetProtectionOptions15 個細粒度的保護權限選項(例如格式化儲存格、插入列/欄、排序、auto-filter、選取鎖定/未鎖定儲存格等),對應 Excel「保護工作表」的權限清單
PageSetupTouched / SheetProtectHash用 PageSetupTouched 檢查版面設定值是否被明確改過; SheetProtectHash 則讀寫舊式 XLS 檔案格式使用的 16 位元工作表保護雜湊文字
AddPivotTable / AddPivotTableCopy / PivotSetDataFieldFormat建立、複製與格式化樞紐分析表的方法。 AddPivotTable 從 'Data!A1:C9' 這類 A1 來源範圍建立樞紐分析表,並錨定在 1 起始儲存格 DestRow, DestCol;來源範圍不合法或錨點落在工作表之外時傳回 nil。 AddPivotTableCopy 把既有樞紐分析表(可來自這本或其他活頁簿)深複製到這張工作表的新 1 起始錨點(NewName 留空會得到 '<source> (2)')。 PivotSetDataFieldFormat 為資料欄位註冊一個數字格式並傳回其數字格式索引
PivotTables這張工作表上定義的樞紐分析表集合
MarginLeftCM / MarginRightCM / MarginTopCM / MarginBottomCM / MarginHeaderCM / MarginFooterCM以公分表示的版面設定邊界
TabColor / TabColorIsAutoExcel 中工作表索引標籤的 ARGB 色彩; 指派 TabColor 會把 TabColorIsAuto 設為 False TabColorIsAuto = True(預設)時不輸出 <sheetPr> 的 <tabColor> 子節點
IsChartSheet設為 True 時,SaveAs 把這張工作表寫到 xl/chartsheets/sheetN.xml 而不是 xl/worksheets/sheetN.xml ,並讓 Charts[0] 佔滿整頁。一般情境請用 Workbook.AddChartSheet(...) 輔助方法
View工作表檢視模式。值為 xlsxNormalView、 xlsxPageBreakPreview與 xlsxPageLayoutView。SaveAs 在 view 上寫出對應的 <sheetView>屬性;Open 會讀回
Zoom工作表檢視縮放百分比(10–400;預設 100,指派時限縮)。在 zoomScale="N" 內輸出 <sheetView>;預設值不輸出,沒動過的工作表保持乾淨
DisplayGridLines設為 False時,隱藏工作表檢視中的儲存格格線。預設 True。 showGridLines="0" 時輸出 False
DisplayZeros設為 False時,零值儲存格顯示為空白而不是「0」。預設 True。 showZeros="0" 時輸出 False
DisplayRightToLeft設為 True時,工作表以由右至左版面顯示(A 欄在右),適合阿拉伯文或希伯來文。輸出 rightToLeft="1"
StandardWidth預設欄寬,單位是 Excel 字元(例如 8.43 = 內建預設)。設 > 0 會輸出 <sheetFormatPr defaultColWidth="..."/>0 = 未設定(不輸出元素)
StandardHeight預設列高,單位是點(例如 15 = 內建預設)。設 > 0 會在 defaultRowHeight="..." 上輸出 <sheetFormatPr>0 = 未設定
ClearRangeValues / CopyRange / CopyRangeTo / CopyFrom / MoveRange / SortRange / ClearRange儲存格範圍操作。 CopyRange 與 CopyRangeTo 複製值、公式、樣式索引與富文字承載; CopyFrom 複製整張工作表的內容與設定(含合併儲存格、版面設定、檢視狀態、auto-filter 等); 這三個只複製儲存格內容,註解會留在原地,而 CloneRangeTo 或 Sheets.AddCopy 會把註解連同其 Rich Text run 一併帶走; MoveRange 跳過與目的地重疊的部分; SortRange 依一或多個絕對關鍵欄對矩形內的整列排序; ClearRange 移除儲存格; ClearRangeValues 清掉值與公式,但保留樣式索引
Range / RCRange / UsedRange針對 A1 參照、1 起始數字座標或已填內容的工作表閉包,回傳工作表持有的 TXLSXRange 包裝物件。 TXLSXRange.SaveAsHTML(FileName) 與 TXLSXRange.SaveAsHTML(Stream) 只把所選範圍匯出成 UTF-8 HTML 表格。範圍包裝另提供批次值、公式、樣式索引、數值格式、框線、保護旗標、自動調整、合併、位移、縮放、多關鍵排序、內建儲存格樣式、複製/移動,以及整列或整欄插入/刪除輔助方法
EntireRow / EntireColumn針對指定索引回傳整列或整欄範圍,適合結構性操作或樣式傳播
MergeCells(R1, C1, R2, C2)加入一個合併矩形並回傳新條目索引。座標 1 起始、兩端皆含。等價於 MergedCells.Add(R1, C1, R2, C2)。想寫得像範圍操作, Range['A1:C3'].Merge(True) 會每列寫一個合併範圍,等同 Excel 的跨欄合併
FillMergedCellValues把每個合併範圍的錨點值複製到所有被涵蓋的成員儲存格,報表式工作表之後讀起來就像攤平的網格。空值或 null 錨點會跳過,預先填過內容的合併保留原樣,回傳填入的儲存格數
FormControls工作表表單控制項(按鈕、核取方塊、選項按鈕、下拉方塊、清單方塊)的集合,由 AddFormButton / AddFormCheckBox / AddFormRadioButton / AddFormComboBox / AddFormListBox 輔助方法家族建立。每個條目暴露錨定矩形、連結儲存格與控制項類型
AddHyperlink overloads對單一儲存格加入外部 URL 超連結。 Display 與 Tooltip 為選用。等價於 Hyperlinks.Add(...)
AddComment overloads對單一儲存格加入註解。 Author 為選用。等價於 Comments.Add(...)
ColWidth[Col]欄寬,單位是 Excel 欄寬單位(與 Excel 欄寬對話框同一尺度)。讀取未設定的欄回傳 0;指派值即設定該 1 起始欄的寬度。SaveAs 為每個自訂欄輸出一個 <col> 條目;Open 把 <cols> 區塊回放到對應表裡
RowHeight[Row]列高,單位是點(與 Excel 列高對話框同一尺度)。讀取未設定的列回傳 0;指派值即設定該 1 起始列的高度。SaveAs 為每個有自訂高度的 ht 寫出 customHeight="1" 與 <row> 屬性,即使該列只有高度、沒有儲存格資料也一樣
SetColWidth / SetRowHeight上述索引屬性背後的直接 setter。提供具名方法是給不喜歡屬性語法的呼叫端
HasColWidth / HasRowHeight工作表對給定索引有自訂寬度或高度時回傳 True 。用它區分「未設定」與刻意的 0 value
ClearColWidths / ClearRowHeights把所有自訂寬度或高度丟回 Excel 預設
ClearRowHidden / ClearColHidden / ClearRowCollapsed / ClearColCollapsed把所有列/欄的隱藏/摺疊覆寫還原成預設的可見與展開狀態
Images圖片集合。日常入口請用 AddImage / AddImageFromFile 。請參閱 TXLSXImage / TXLSXImages
HeaderFooterImages具型別的奇數頁、偶數頁與首頁頁首/頁尾圖片槽位,各自擁有獨立的位置、大小、邊界、格式、資料與標題屬性。請參閱 TXLSXHeaderFooterImage / TXLSXHeaderFooterImages
ConditionalFormats這張工作表的條件格式規則。便利入口是 AddConditionalFormat 。請參閱 TXLSXConditionalFormat / TXLSXConditionalFormats
DataValidations這張工作表的資料驗證規則。便利入口是 AddDataValidation / AddListValidation 。請參閱 TXLSXDataValidation / TXLSXDataValidations
IgnoredErrors具型別的工作表錯誤抑制中繼資料。每個 TXLSXIgnoredError 把以空白分隔的多區域 SqRef ,和標準的求值、日期、儲存數字、公式、未鎖定公式、空參照、資料驗證與計算欄旗標組合在一起。條目會在工作表複製與開啟/儲存往返中保留,範圍也會跟著列欄插入或刪除調整
AddImage / AddImageFromFile加入錨定到儲存格的圖片。AddImage 接收原始位元組加 TXLSXImageFormat;AddImageFromFile 讀檔並從副檔名推斷格式。等價於集合上的 Images.Add on the collection
AddConditionalFormat overloads加入 cellIs 條件格式規則。等價於 ConditionalFormats.Add(...)
AddCondFormatExpression / text / rank / average / duplicate / blank / error helpers加入特殊化的條件格式規則,涵蓋公式、文字比對、前/後段排名、高於/低於平均值、重複或唯一值、空白、非空白、錯誤與非錯誤。回傳的索引可搭配 ConditionalFormats[Index].Style 掛上格式
AddWholeNumberValidation / AddWholeNumberValidation overloads / Whole whole-number validations加入整數驗證規則,支援範圍或條件
ProtectedRanges工作表中需要密碼驗證的受保護儲存格範圍集合
RawWorksheetExts暴露原始的工作表擴充清單資料,可直接注入 XML
SparklineGroups / AddSparklineGroup管理儲存格內的走勢圖(sparkline)迷你圖表。 AddSparklineGroup 建立一個參照資料範圍的群組
ThreadedComments / AddThreadedComment / AddThreadedReply支援現代的討論串式註解對話(回覆)。 AddThreadedComment 建立頂層討論串, AddThreadedReply 附加回覆
AddAreaChart / AddBarChart / AddChartFromRange / AddColumnChart / AddLineChart / AddPieChartExcel 圖表捷徑。 AddChartFromRange 直接從儲存格資料建立錨定圖表
GetSheetProtectOption / SetSheetProtectOption以程式方式取得或設定特定的工作表保護權限旗標
PasteFromClipboard從指定座標開始,直接貼上剪貼簿內容
AlignWithMargins指定頁面邊界是否與工作表內容對齊
CodeName指定 VBA 工作表的程式碼名稱
ConsolidateXml暴露原始的合併彙算 XML 資料
DifferentFirst啟用獨立的首頁頁首/頁尾
DifferentOddEven啟用奇偶頁不同的頁首/頁尾
EvenFooterText / EvenHeaderText偶數頁頁首與頁尾的文字字串
FirstFooterText / FirstHeaderText首頁頁首與頁尾的文字字串
FirstPageNumber首頁的列印頁碼
GridColor工作表格線色彩
HorizontalDpi / VerticalDpi水平與垂直方向的列印 DPI 解析度
OutlineLevelCol / OutlineLevelRow欄與列的預設大綱層級
PaneState窗格凍結捲動狀態
PhoneticAlignment / PhoneticFontId / PhoneticTypeCJK 注音標示(ruby)文字的對齊、字型索引與注音類型
PrintErrors儲存格錯誤的列印行為
ScaleWithDoc頁首/頁尾隨文件縮放比例一起縮放
Scenarios具型別的 What-If 分析藍本管理員集合。每個分析藍本擁有一到 32 個輸入儲存格,支援名稱、鎖定與隱藏狀態、使用者與註解中繼資料、儲存值、數值格式,以及已刪除/已復原旗標 CurrentIndex、 ShownIndex與 SqRef 暴露工作表層級的分析藍本管理員狀態
ScenariosXml舊式的原始內部 XML 後備路徑,只在具型別的 Scenarios 集合為空時使用
SheetProtectAlgorithmName / SheetProtectHashValue / SheetProtectSaltValue / SheetProtectSpinCount現代工作表保護密碼雜湊的密碼學屬性
ShowFormulas顯示公式而不是值
ShowOutlineSymbols顯示大綱群組符號
SortState / SortStateXml具型別的排序條件,以及原樣保留的排序 XML 內容
SummaryBelow / SummaryRight大綱摘要列與摘要欄的位置
UseFirstPageNumber使用明確指定的起始頁碼
UsePrinterDefaults使用印表機預設的 DEVMODE 設定
ZeroHeight新插入的列預設隱藏
ZoomNormal / ZoomPageLayout / ZoomSheetLayout標準檢視、頁面配置檢視與分頁預覽的縮放值
AddWordArt在工作表上加入 WordArt 文字圖形控制項
BuildRowMajorCellOrder為以列為主的迭代,把儲存格儲存循序最佳化
ClearRawDrawingAnchors清除所有原始未映射的繪圖圖形 XML 錨點
CreateConditionalFormatEvaluator建立條件格式求值工具引擎的執行個體
RawDrawingAnchor / RawDrawingAnchorCount / AddRawDrawingAnchor管理原始未映射的繪圖圖形 XML 錨點 AddRawDrawingAnchor 附加一段完整的 <xdr:...Anchor> 區塊,往返保留時原樣保留,並回傳新的 TXLSXDrawingObject
BringToFront / SendToBack / BringForward / SendBackward調整繪圖物件在工作表 z 順序中的位置: BringToFront 移到所有繪圖之上, SendToBack 移到所有繪圖之下, Forward / Backward 變體則逐層移動一個位置
SaveAsPDF把工作表匯出成 PDF 檔案或串流
TryGetOutlineNode / SetOutlineNodeCollapsed / SetOutlineDisplayLevel透過共用的稀疏大綱模型,查詢或以等冪方式變更方向感知的列與欄摘要節點;請參閱 稀疏大綱幾何
ToggleColGrouped / ToggleRowGrouped相容性包裝:接受第一個明細欄或列,並切換其解析後的摘要節點

整軸規則編輯與範圍複製

自 2.384.77 起,條件式格式與資料驗證的目標區域在結構編輯與相依複製時也接受整列與整欄;編輯會正規化有效區域、保留完整的格線跨度,並捨棄列或欄已被移除的目標
整列、整欄與整張工作表的儲存格複製只走訪已儲存的儲存格,保留稀疏的目的地清除,並在清除重疊的目的地之前先擷取來源內容;複製空白的整軸範圍不會把它的空白座標具體化
跨活頁簿複製仍依值重新對應格式與富文字,完整與部分的 CSE 陣列複製也保留既有的公式契約
自 2.384.78 起,儲存格範圍複製還會在變更前擷取相交的虛擬樣式覆蓋,把明確的目的地覆蓋裁切到複製的矩形內,並跨活頁簿重新對應每個被複製的格式部分,包括重設為索引 0 的明確重設
整軸的目的地預設值保持緊湊,並在套用來源圖層之前於複製矩形內被遮罩;複製空白來源會清除該矩形內先前的明確覆蓋格式、保留矩形外的格式,且不會為每個涵蓋的座標建立儲存格
複製的條件式格式與驗證規則要求所有目標區域都落在來源矩形內;只與來源相交的規則會被跳過,目的地超出工作表格線時會在複製前被拒絕
從 ODS 匯入的有限重複空白樣式會對使用範圍貢獻兩個端點;整列、整欄與整張工作表的預設樣式覆蓋不會只因為涵蓋空白座標就擴大使用範圍

範例

var
  ws: TXLSXWorksheet;
  scenario: TXLSXScenario;
begin
  ws := Workbook.Sheets.Add('Demo');

  ws.Cells.Item[1, 1].Value := 'Title';
  ws.MergeCells(1, 1, 1, 3);

  ws.ColWidth[1] := 24;          // widen column A
  ws.RowHeight[1] := 28;         // taller title row

  ws.Cells.Item[3, 1].Value := 'Visit losLab';
  ws.AddHyperlink(3, 1, 'https://www.loslab.com', 'losLab');

  ws.AddComment(3, 1, 'Vendor home page', 'Kevin');
  ws.AddTextBox('Standalone note', 2, 5, 5, 9);
  if ws.FindTextBoxAt(3, 6) <> nil then
    ws.DeleteTextBoxesInRange(2, 5, 5, 9);

  scenario := ws.Scenarios.Add('Baseline');
  scenario.User := 'Analyst';
  scenario.Comment := 'Approved assumptions';
  scenario.InputCells.Add('B2', '1250').NumberFormatId := 4;
  scenario.InputCells.Add('B3', '0.18');
  ws.Scenarios.SqRef := 'B2:B3';
end;
    

另請參閱