HotXLS 문서

추가 XLSX 파사드 API 멤버

이 페이지는 HTML 내보내기 옵션과 XLSX 셀 참조 또는 XML 페이로드 텍스트로 직접 작업하는 호출자를 위한 도우미 함수를 포함하여 lxHandleX에서 선언한 작은 공개 API 멤버를 다룹니다

수식 배열 메모리 한도

property FormulaArrayMemoryLimit: Int64;
      
다음과 같이 생성된 수식 배열이 할당하는 페이로드를 제한합니다 MUNIT같은 생성된 수식 배열이 할당하는 페이로드를 제한합니다. 기본값은 64 MiB이고, 병렬 재계산 워커에도 적용되며, Double 요소 하나보다 작은 값은 클램프됩니다

HTML 내보내기 옵션

type
  TXLSXHtmlExportOptions = class
    constructor Create;
    property Title: WideString;
    property WriteDocument: Boolean;
    property IncludeStyles: Boolean;
    property IncludeBOM: Boolean;
    property TableClass: WideString;
  end;
      
TitleSets the document title when WriteDocument WriteDocument가 True일 때 문서 제목을 설정합니다
WriteDocumentTrue일 때 전체 HTML 문서를 기록합니다 False일 때는 테이블 조각만 기록합니다
IncludeStyles내보낸 HTML에 생성된 CSS와 inline style 정보가 포함되는지 제어합니다
IncludeBOM파일 및 스트림 출력이 UTF-8 BOM으로 시작할지 제어합니다
TableClass생성되는 <table> 요소에 CSS 클래스 이름을 추가합니다

XLSX 참조 도우미 함수

function XlsxColumnLabel(Col: Integer): WideString;
function XlsxCellRef(Row, Col: Integer): WideString;
function XlsxColumnIndex(const ColumnLabel: WideString): Integer;
function XlsxParseCellRef(const Ref: WideString; out Row, Col: Integer): Boolean;
function XlsxParseRangeRef(const Ref: WideString; out Row1, Col1, Row2, Col2: Integer): Boolean;
      
XlsxColumnLabel1 기반 열 인덱스를 A, Z, AA
XlsxCellRef1 기반 행·열 번호로 A1 스타일 셀 참조를 만듭니다
XlsxColumnIndexA1 스타일 열 레이블을 1 기반 열 인덱스로 변환합니다
XlsxParseCellRef단일 A1 스타일 셀 참조를 구문 분석하고 행 및 열 좌표를 반환합니다
XlsxParseRangeRef사각형 A1 스타일 범위를 파싱하고 양단을 포함하는 1 기반 경계를 반환합니다

XLSX XML 이스케이프 도우미 함수

function XlsxEscapeText(const Value: WideString): WideString;
function XlsxEscapeAttr(const Value: WideString): WideString;
      
XlsxEscapeText 는 XML 텍스트 노드 콘텐츠를 이스케이프하고, XlsxEscapeAttr 은 XML 속성 값을 이스케이프하며 Excel이 정확히 읽어야 하는 속성 공백을 보존합니다

고급 XLSX 멤버의 보조 타입

이 도움말 파일에서 다루는 고급 XLSX 멤버는 lxHandleX

{ Find and replace }
TXLSXFindFlag = (lxfMatchCase, lxfWholeCell, lxfSearchFormulas,
  lxfUseWildcards, lxfBackward, lxfByColumns);
TXLSXFindOptions = set of TXLSXFindFlag;
TXLSXReplaceAction = (raReplace, raSkip, raAbort);
TXLSXReplaceEvent = function(ARow, ACol: Integer;
  const ACurrentText: WideString; var ANewText: WideString):
  TXLSXReplaceAction of object;

{ Progress and recalculation policy }
TXLSXProgressPhase = (xlsxProgressReading, xlsxProgressWriting,
  xlsxProgressCalculating, xlsxProgressExporting);
TXLSXProgressState = (ppsBegin, ppsWork, ppsEnd);
TXLSXRecalcMode = (xrmManual, xrmIfDirty, xrmAlways);
TXLSXPasswordEvent = procedure(Sender: TObject;
  var PassWord: WideString) of object;

{ Custom document properties (docProps/custom.xml) }
TXLSXCustomPropType = (xcptText, xcptNumber, xcptDate, xcptBoolean);
TXLSXCustomProperty = class
  Name: WideString;
  PropType: TXLSXCustomPropType;
{ + TextValue, NumberValue, DateValue, BoolValue accessors }
end;

{ Table styles, fills, sorts, external links, controls, sparklines }
TXLSXTableStyleSectionKind = (xltssWholeTable, xltssHeaderRow,
  xltssTotalRow, xltssFirstColumn, xltssLastColumn, xltssFirstRowStripe,
  xltssSecondRowStripe, xltssFirstColumnStripe, xltssSecondColumnStripe,
  xltssFirstHeaderCell, xltssLastHeaderCell, xltssFirstTotalCell,
  xltssLastTotalCell { + subtotal and subheading slots });
TXLSXFillPattern = (xlsxFillNone, xlsxFillSolid, xlsxFillGray125
  { + the remaining ECMA-376 pattern values });
TXLSXGradientKind = (xlsxGradientNone, xlsxGradientLinear, xlsxGradientPath);
TXLSXSortBy = (xlsxBsValue, xlsxBsCellColor, xlsxBsFontColor, xlsxBsIcon);
TXLSXSortMethod = (xlsxSmNone, xlsxSmStroke, xlsxSmPinYin);
TXLSXExternalLinkKind = (xlsxExternalLinkUnknown, xlsxExternalLinkWorkbook,
  xlsxExternalLinkDde { + the remaining link kinds });
TXLSXFormControlType = (xfcButton, xfcCheckBox, xfcRadioButton, xfcComboBox,
  xfcListBox);
TXLSXSparklineAxisType = (xlsxSparklineAxisIndividual,
  xlsxSparklineAxisGroup, xlsxSparklineAxisCustom);
TXLSXSparklineEmptyCells = (xlsxSparklineEmptyGap, xlsxSparklineEmptyZero,
  xlsxSparklineEmptySpan);

{ Chart authoring and layout }
TXLSXChartBarGrouping = (xlsxBarGroupClustered, xlsxBarGroupStacked,
  xlsxBarGroupPercentStacked);
TXLSXChartMarkerSymbol = (xlsxMarkerAuto, xlsxMarkerCircle, xlsxMarkerDash,
  xlsxMarkerDiamond, xlsxMarkerDot, xlsxMarkerPlus, xlsxMarkerSquare,
  xlsxMarkerStar, xlsxMarkerTriangle, xlsxMarkerX, xlsxMarkerNone);
TXLSXChartDataLabelPos = (xlsxDlblPosDefault, xlsxDlblPosCenter,
  xlsxDlblPosInEnd, xlsxDlblPosOutEnd, xlsxDlblPosBestFit, xlsxDlblPosLeft,
  xlsxDlblPosRight, xlsxDlblPosTop, xlsxDlblPosBottom);
TXLSXChartMutable = class;     { mutable base of the chart model nodes }
TXLSXChartLayoutRect = record
  Left, Top, Right, Bottom: Double;
end;
TXLSXChartResolvedLayout = record
  ChartRect: TXLSXChartLayoutRect;
  TitleRect: TXLSXChartLayoutRect;
  LegendRect: TXLSXChartLayoutRect;
  PlotOuterRect: TXLSXChartLayoutRect;
  PlotInnerRect: TXLSXChartLayoutRect;
  { + per-axis title rectangles and visibility flags }
end;

{ Pagination keep-together blocks }
TXLSXKeepTogetherRange = record
  Row1, Row2: Integer;
  Level: Integer;
  ReplaceBiggerLevels: Boolean;
end;
TXLSXKeepTogetherCols = record
  Col1, Col2: Integer;
  Level: Integer;
  ReplaceBiggerLevels: Boolean;
end;

{ Diagnostics records }
TXLSXValidationIssue = record
  Row, Col: Integer;
  ValidationIndex: Integer;
  Reason: WideString;
end;
TXLSXUnknownFunctionInfo = record
  Sheet: Integer;
  Row, Col: Integer;
  Name: WideString;
  LocationKind: TXLSFormulaSymbolLocationKind;
  DefinedNameIndex: Integer;
  DefinedName: WideString;
end;
TXLSXRowMajorOrder = record
  CellOrder: array of Integer;
  RowStarts: array of Integer;
  MaxRow: Integer;
end;
      
Find and replaceTXLSXWorksheet.FindText / FindTextIn 은 TXLSXFindOptions (대소문자 구분, 전체 셀, 수식 검색, 와일드카드, 역방향, 열 단위)를 받고, ReplaceText 는 매치마다 TXLSXReplaceEvent , raReplace, raSkip를 선택하는 raAbort 를 받으며 셀별 치환을 위한 쓰기 가능한 ANewText 를 제공합니다
Progress and savingTXLSXWorkbook.OnProgress / OnProgressEx 는 TXLSXProgressPhase 와 (확장형) TXLSXProgressState 플래그가 있는 Abort 를 전달합니다. RecalcBeforeSave 는 직렬화 전 수식 재계산을 manual, dirty-only, always 중에서 선택하는 TXLSXRecalcMode 이고, OnPassword 는 열기·쓰기 암호를 공급하는 TXLSXPasswordEvent 입니다
Custom propertiesTXLSXWorkbook.CustomProperties 는 형식화된 TXLSXCustomProperties / AddText / AddNumber / AddDate 생성기, AddBoolean , FindByName, Delete와 Clear, Count 열거를 갖춘 Items 컬렉션입니다. 각 TXLSXCustomProperty 는 ECMA-376 변형 매핑에 맞는 TXLSXCustomPropType 으로 값을 태그합니다
Style overlaysTXLSXStyleOverlays 는 저장된 스타일 위의 범위별 재정의를 관리합니다. Add 는 하나를 만들고, ApplyToCell 은 단일 셀의 스타일을 다시 지정하며, Resolve, ResolveRowDefault, ResolveColumnDefault 는 로드 중 스타일 조회에 응답하고, HasVirtualStyle 은 생성된 스타일을 보고하고, MaxVirtualRow 은 가상 행을 제한하며, ApplyStructuralEdit 은 행·열 편집 후 오버레이를 이동시키고, Clear, Count, Items 가 컬렉션을 관리합니다
Styles, fills, and overlaysTXLSXFill 은 Pattern, GradientKind, GradientStops 을 통해 TXLSXFillPattern, TXLSXGradientKind, TXLSXGradientStop를 노출합니다. TXLSXWorksheet.StyleOverlays 는 TXLSXStyleOverlays 컬렉션이며 그 TXLSXStyleOverlay 항목은 사각형, 영향받는 서식 부분, 재정의하는 셀 스타일을 전달합니다
Tables, sorts, and links사용자 지정 표 스타일(TXLSXWorkbook.CustomTableStyles)은 TXLSXTableStyleSectionKind 슬롯으로 섹션 서식을 만듭니다. 컬렉션은 Add, FindByName, Delete, Clear, Count, Items를 제공하고, 각 TXLSXCustomTableStyle 은 Name, SectionSize, PivotStyle, TableStyleFlag 를 노출하며 HasSection / ResolveSection 조회에 응답합니다. 정렬 조건은 키를 TXLSXSortBy 로, 텍스트 순서를 TXLSXSortMethod로 분류합니다. TXLSXExternalLink.Kind 는 TXLSXExternalLinkKind 이고 각 링크는 TXLSXExternalDefinedName 과 Name 를 가진 RefersTo
Custom XML partsTXLSXWorkbook.CustomXmlParts 는 항목별 사용자 지정 XML을 보존합니다. Add, Delete, Clear 가 파트를 관리하고, 각 TXLSXCustomXmlPart 는 Xml 에 페이로드를 담으며 ItemId 와 스키마 관계의 SchemaRefs 문자열 목록(AddSchemaRef 로 추가)을 갖습니다. 보존된 파트는 저장 왕복에서 그대로 유지됩니다
Cell style payloadsTXLSXCellStylePayload 는 개별 셀에 붙는 공유 가능한 불변 스타일 번들입니다. Acquire / Release 가 참조 횟수를 관리하고, Clone 이 복사하며, IsDefault 가 기본 스타일인지 검사하고, InternKey 가 동일한 페이로드를 식별해 저장소가 중복을 제거할 수 있게 합니다
Controls, drawings, and sparklinesTXLSXWorksheet.FormControls 는 TXLSXFormControls 개체들의 TXLSXFormControl 컬렉션이며, 각 개체는 ControlType, Caption, MacroName, LinkedCell, Items 목록을 노출하고 TXLSXFormControlType으로 형식화되며 TXLSXFormControlItems 가 컨트롤별 항목 텍스트를 담습니다. 그리기 개체는 TXLSDrawingObjectKind로 종류를 보고하고, 스파크라인 그룹은 TXLSXSparklineAxisType 과 TXLSXSparklineEmptyCells
Charts플롯 그룹과 시리즈는 TXLSXChartBarGrouping, TXLSXChartMarkerSymbol, TXLSXChartDataLabelPos 열거형으로 막대 그룹화, 마커 기호, 데이터 레이블 위치를 분류합니다. 차트 모델 노드는 TXLSXChartMutable 기반 클래스를 공유하고, TXLSXChartLayoutResolver.ResolveChart 는 차트, 제목, 범례, 플롯, 축 제목을 위한 TXLSXChartResolvedLayout 사각형들의 TXLSXChartLayoutRect 을 채웁니다
Pagination keep blocksKeepRowsTogether / KeepColumnsTogether 는 TXLSXKeepTogetherRange 와 TXLSXKeepTogetherCols 레코드를 유지해 페이지 나누기 계획이 블록을 한 페이지에 유지하게 합니다
DiagnosticsTXLSXWorksheet.CheckDataValidations 는 TXLSXValidationIssue 레코드(셀, 유효성 검사 인덱스, 원인)를 반환합니다. TXLSXWorkbook.ScanUnknownFunctions 는 셀과 정의된 이름에서 구현되지 않은 호출의 위치를 찾는 TXLSXUnknownFunctionInfo 레코드를 반환합니다. TXLSXCells.GetStorageStatistics 는 셀, 행 블록, 페이로드별 바이트, 스타일 빈 셀 회계를 TXLSXCellStorageStatistics 레코드에 채웁니다. TXLSXWorksheet.BuildRowMajorCellOrder 는 채워진 셀의 메모리 내 순회 순서를 기술하는 TXLSXRowMajorOrder 를 반환합니다
TXLSXWorkbook.FormulaLocale 는 수식을 파싱하고 직렬화할 때 사용하는 로캘 태그를 읽고 쓰며, 클래식 통합 문서의 수식 로캘 처리와 같은 역할을 합니다

테이블 슬라이서

테이블 슬라이서(Excel 2013+)는 두 컬렉션으로 기록하고 검사합니다. TXLSXWorksheet.Slicers 는 시트별 슬라이서 뷰(TXLSXSlicer)를 담고, TXLSXWorkbook.SlicerCaches 는 공유 데이터 소스(TXLSXSlicerCache)를 담습니다

property TXLSXWorksheet.Slicers: TXLSXSlicers;
property TXLSXWorkbook.SlicerCaches: TXLSXSlicerCaches;

{ TXLSXSlicers }
function Add(ATable: TXLSXTable; const AColumnName: WideString): TXLSXSlicer; overload;
function Add(ATable: TXLSXTable; const AColumnName: WideString;
  ARow1, ACol1, ARow2, ACol2: Integer): TXLSXSlicer; overload;
function IndexByName(const AName: WideString): Integer;
function FindByName(const AName: WideString): TXLSXSlicer;
procedure Delete(Index: Integer);
procedure Clear;
property Count: Integer;
property Items[Index: Integer]: TXLSXSlicer;

{ TXLSXSlicer view }
property Name: WideString;          { workbook-unique }
property CacheName: WideString;
property Cache: TXLSXSlicerCache;
property Caption: WideString;
property StartItem: Integer;
property ColumnCount: Integer;
property ColumnWidth: WideString;
property ShowCaption: Integer;
property StyleName: WideString;
property LockedPosition: Integer;
property RowHeight: WideString;
property RowHeightEmu: Integer;
procedure SetBounds(ARow1, ACol1, ARow2, ACol2: Integer);
property FromRow, FromCol, ToRow, ToCol: Integer;   { anchor cell corners }
property FromRowOff, FromColOff, ToRowOff, ToColOff: Integer; { EMU offsets }
property AnchorType: TXLSXAnchorEditAs;
property HasAnchor: Boolean;

{ TXLSXSlicers, load-path entry }
function AddInternal: TXLSXSlicer;

{ TXLSXSlicerCache }
property Name: WideString;          { e.g. Slicer_Region }
property SourceName: WideString;    { source table column / pivot field }
property IsTableCache: Boolean;
property IsPivot: Boolean;
property IsNonOlapPivot: Boolean;
property ItemCount: Integer;
property ItemCacheIndex[Index: Integer]: Integer;
property ItemSelected[Index: Integer]: Boolean;
function SetSelectedItems(const CacheItemIndices: array of Integer): Integer;
function ClearSelection: Integer;
property TableId: Integer;
property TableColumnId: Integer;
property SortOrder: WideString;     { '' | ascending | descending }
property CrossFilter: WideString;   { '' | none | showItemsWithDataAtTop | showItemsWithNoData }
property CustomListSort: Integer;   { -1 absent, else 0/1 }

{ TXLSXSlicerCaches }
function Add: TXLSXSlicerCache;
function FindByName(const AName: WideString): TXLSXSlicerCache;
function IndexOfName(const AName: WideString): Integer;
function FindForTableColumn(ATableId, ATableColumnId: Integer): TXLSXSlicerCache;
procedure Delete(Index: Integer);
procedure Clear;
property Count: Integer;
property Items[Index: Integer]: TXLSXSlicerCache;
      

Slicers.Add(Table, ColumnName) 은 슬라이서를 처음부터 끝까지 만듭니다. Slicer_<column>이름의 백킹 캐시를 등록하거나 재사용하고, 일치하는 #N/A 정의 이름을 예약하고, 워크시트 slicerList 확장을 기록하고, 마크업 호환성 그리기 앵커로 뷰를 배치합니다. 이 앵커의 폴백 안내는 구버전 Excel을 커버합니다. 두 번째 오버로드는 뷰 사각형을 고정하고, 그렇지 않으면 표 오른쪽의 기본 앵커가 사용됩니다

로드된 뷰와 캐시는 열 때 다시 파싱되고, 공유 캐시는 여러 뷰에서 재사용되며, 캐시의 마지막 뷰를 삭제하면 캐시도 사라집니다. 인식하지 못한 속성과 확장은 원래 표현을 그대로 유지하고, 테이블 바인딩은 저장된 테이블 id를 따라가며, 지원되는 Pivot 연결은 저장된 시트 ID를 따라갑니다

지원되는 가져온 비-OLAP Pivot 캐시는 IsNonOlapPivot, ItemCount, ItemCacheIndex, ItemSelected, SetSelectedItems, ClearSelection을 통해 형식화된 멤버 검사와 보호된 선택 변경을 노출합니다. 공유 뷰 동작, 실패 원자성, 가져온 동일 필드 마스크 경계는 Pivot Slicer 선택을 참고하세요

지원되지 않는 Pivot 캐시는 원래 바이트를 유지합니다. 파일에서 로드한 슬라이서 뷰는 TXLSXDrawingObject.Slicer를 통해 드로잉 개체로도 접근할 수 있습니다

예제

var
  Ref: WideString;
  Row, Col: Integer;
begin
  Ref := XlsxCellRef(10, 5);
  if XlsxParseCellRef(Ref, Row, Col) then
    Worksheet.Cells.Item[Row, Col].Value := 'Checked';
end;
    

I/O 콜백, 직렬화 스타일 풀, 암호화 파일 검증, 워크스페이스 의존성 그래프 계약은 통합 문서 인프라 API를 참고하세요