HotXLS Docs

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设置并暴露 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 按行/列顺序遍历已填充单元格,交付应用数字格式后的显示文本,返回访问计数并支持回调取消。 ForEachRow 按行顺序遍历已有行,报告每行第一个和最后一个已加载列。 FindText 和 ReplaceText 按行顺序扫描已加载的文本单元格,跳过公式和非文本值,可区分大小写;带选项的重载加入 Excel 查找对话框语义(通配符、全单元格匹配、大小写敏感、搜索公式文本、反向扫描、按列优先扫描), FindTextIn / ReplaceTextIn 把扫描限制在矩形窗口内,并可为每次匹配提供可选的替换回调。 WriteCells 为数字或 A1 风格区域逐个请求值,支持逐单元格跳过和取消。 WriteRows 为每行请求一个 Variant 数组,支持整行跳过和取消
MergedCells合并区域集合。参见 TXLSXMergedCells
Hyperlinks超链接集合。参见 TXLSXHyperlinks
Comments单元格批注集合。参见 TXLSXComments
Tables / AddTable工作表上的 Excel 风格表格带区。参见 TXLSXTable / TXLSXTables
Charts / AddChart锚定的图表集合。参见 TXLSXChart / TXLSXCharts 。图表类型枚举支持柱形图、条形图、折线图、饼图、面积图、圆环图、散点图、气泡图和雷达图。整页图表请使用 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] 这些行并把剩余行上移。两者都会级联影响单元格、合并区域、行高、大纲级别、隐藏标志、超链接、批注、冻结窗格、自动筛选/条件格式/数据有效性引用、表格、单元格公式、条件格式/数据有效性公式、内部超链接目标、打印设置引用、手动分页符、自动筛选列条件、图表系列区域,以及指向被编辑工作表的已定义名称、图像锚点和图表锚点
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返回把给定索引之后的行(或列)与上方(或左侧)块连在一起的最强 keep-together 级别;位置不在 keep-together 块内时返回 0 ;当位置不在 keep-together 块内时则为
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附加到自动筛选区域上的逐列筛选条件。 AddAutoFilterColumn(ColId, Op, Criteria) 添加单条件筛选;双条件重载添加 AND/OR 条件对。 AutoFilterColumns.FindByColId(ColId) 返回已有的条件对象, AutoFilterColumns.DeleteByColId(ColId) 无需手动扫描 Items 即可删除一个, AutoFilterColumns.ClearCriteria 清空所有列条件但保留筛选区域。 ColId 是自动筛选区域内的 0 起始偏移(不是工作表列号)。SaveAs 在 <filterColumn> 内写出 <autoFilter>
AutoFilterRowVisible / PreviewAutoFilterRows / ApplyAutoFilterAutoFilterRowVisible(Row) 对一行数据求值已存储的 XLSX 自动筛选条件。 PreviewAutoFilterRows 遍历 AutoFilterRange中的数据行,通过回调报告每行的可见状态,返回访问到的可见行数,并且不改变行隐藏标志。 ApplyAutoFilter 应用自动筛选条件,隐藏不匹配的行,并返回是否成功
Protect / UnProtect / IsProtected工作表级保护开关,可带 16 位传统密码哈希。反映为 <sheetProtection>
AllowOption / SheetProtectionOptions15 项细粒度保护许可选项(例如设置单元格格式、插入行/列、排序、自动筛选、选定锁定/未锁定单元格等),对应 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 复制整个工作表的内容和设置(包括合并单元格、页面设置、视图状态、自动筛选等); 这三个只复制单元格内容,批注会留在原地,而 CloneRangeTo 或 Sheets.AddCopy 会把批注连同其富文本 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 与标准的求值、日期、数字存储、公式、解锁公式、空引用、数据有效性和计算列标志组合在一起。条目在工作表复制和打开/保存 Roundtrip 之后仍然保留,其区域会跟随行/列的插入或删除
AddImage / AddImageFromFile添加锚定到单元格的图像。AddImage 接收原始字节加 TXLSXImageFormat;AddImageFromFile 读取文件并按扩展名推断格式。等价于集合上的 Images.Add on the collection
AddConditionalFormat overloads添加 cellIs 条件格式规则。等价于 ConditionalFormats.Add(...)
AddCondFormatExpression / text / rank / average / duplicate / blank / error helpers添加专用的条件格式规则:公式、文本匹配、前 N/后 N 排名、高于/低于平均值、重复值/唯一值、空值、非空值、错误和非错误。返回的索引可配合 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 注音的对齐方式、字体索引和注音类型
PrintErrors单元格错误的打印行为
ScaleWithDoc页眉/页脚随文档缩放
Scenarios类型化的 What-If 方案管理器集合。每个方案拥有 1 到 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> 块(Roundtrip 时原样保留),并返回新的 TXLSXDrawingObject
BringToFront / SendToBack / BringForward / SendBackward在工作表的 z-order 中重排绘图对象: BringToFront 移到所有其他绘图之上, SendToBack 移到所有其他绘图之下, Forward / Backward 变体每次移动一个位置
SaveAsPDF把工作表导出为 PDF 文件或流
TryGetOutlineNode / SetOutlineNodeCollapsed / SetOutlineDisplayLevel通过共享的稀疏大纲模型查询或幂等地修改方向感知的行/列汇总节点;参见 Sparse outline geometry
ToggleColGrouped / ToggleRowGrouped兼容包装,接受第一个明细列或行并切换其解析出的汇总节点

整轴规则编辑与区域复制

自 2.384.77 起,条件格式和数据验证目标区域在结构性编辑和依赖克隆期间接受整行和整列;编辑会规范化有效区域,保留完整的网格范围,并丢弃其行或列被移除的目标
整行、整列和整表单元格复制只访问已存储的单元格,保留稀疏的目标清理方式,并在清除重叠目标前先捕获源内容;复制空白的整轴区域不会把其空坐标实体化
跨工作簿复制仍按值重新映射格式和富文本,完整与部分 CSE 数组复制保留其既有的公式约定
自 2.384.78 起,单元格区域复制还会在变更前捕获相交的虚拟样式叠加,把显式的目标叠加裁剪到被复制的矩形内,并把每个被复制的格式部分跨工作簿重新映射,包括到索引零的显式重置
整轴目标默认值保持紧凑,并在应用源层之前在被复制的矩形内被遮蔽;复制空白源会清除该矩形内先前的显式叠加格式,保留矩形外的格式,且不会为每个覆盖到的坐标创建单元格
克隆条件格式和数据验证规则要求所有目标区域都包含在源矩形内;仅与之相交的规则会被跳过,超出工作表网格的目标在复制前即被拒绝
从 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;
    

请参阅