工作簿视图、连接和 XML 映射
本参考涵盖位于单元格网格之外的可编辑工作簿元数据,当工作表、区域、筛选和包部件发生变化时,这些元数据必须保持一致
经典自定义视图
TXLSWorksheet.CustomViews 返回 TXLSCustomViews,其 Count、 Items、 Invalidate和 SyncToRaw 成员保留类型化和未知的自定义视图记录
TXLSCustomView 暴露 ViewId、 Zoom、 GridColorIndex、 ActivePane、 ShowPageBreaks、 ShowFormulas、 ShowGridLines、 ShowHeadings、 ShowOutlineSymbols、 ShowZeroValues、 CenterHorizontally、 CenterVertically、 PrintHeadings、 PrintGridLines、 FitToPage、 FilterMode、 AutoFilterVisible、 FrozenPanes、 FrozenNoSplit、 SplitVertically、 SplitHorizontally、 TopLeftRow、 TopLeftColumn、 SplitX、 SplitY、 RightPaneColumn、 BottomPaneRow、 SelectionCount、 Selections、 HorizontalPageBreaks、 VerticalPageBreaks、 HasPageSetup、 PaperSize、 PrintScale、 FirstPageNumber、 FitToPagesWide、 FitToPagesTall、 PageSetupFlags和 HorizontalResolution, VerticalResolution, HeaderMargin, FooterMargin, Copies, FilterFieldCount, FilterActive, FilterCriteria1, FilterCriteria2, FilterOperators, ClearFilterCriteria, RawRecordCount, RawRecordIds, and RawRecordData
TXLSCustomViewCellRange、 TXLSCustomViewCellRanges、 TXLSCustomViewSelectionInfo、 TXLSCustomViewPageBreak和 TXLSCustomViewPageBreaks 承载由视图拥有的选择和分页符负载
XLSX 工作簿窗口
TXLSXWorkbook.WorkbookViews 拥有由 TXLSXWorkbookView 配置的有序 TXLSXWorkbookViewVisibility
| TXLSXWorkbookView | Assign, ActiveTab、 FirstSheet、 Visibility、 Minimized、 ShowHorizontalScroll、 ShowVerticalScroll、 ShowSheetTabs、 XWindow、 YWindow、 WindowWidth、 WindowHeight、 TabRatio、 AutoFilterDateGrouping、 UnknownAttributes和 Extensions |
| TXLSXWorkbookViews | Add、 Insert、 Delete、 Move、 Clear、 Count和 Items |
工作表插入、删除和移动会重新映射每个窗口的活动和首个可见标签页,同时保留独立的几何结构和显示设置
按窗格选择
TXLSXWorksheet.Selections 返回 TXLSXSelections; TXLSXSelectionPane 标识目标窗格,每个 TXLSXSelection 存储 Pane、 ActiveCell、 ActiveCellId和多区域 Sqref
TXLSXSelection.Assign 复制一个选择,而 TXLSXSelections.Add、 AddSelection、 Assign、 Clear、 Delete、 IndexOfPane、 Count和 Items 维护有序的工作表视图集合
连接子模型
TXLSConnection 保留数据库、Web、文本和 OLAP 元数据。其 Web 模型使用 WebParsePre、 WebHtmlTables和 WebTables;其固定文本模型使用 TextSourceFile 和 TextFields;其 OLAP 模型使用 HasOlapProperties、 OlapLocal、 OlapLocalConnection、 OlapLocalRefresh、 OlapSendLocale、 OlapRowDrillCount、 OlapServerFill、 OlapServerNumberFormat、 OlapServerFont、 OlapServerFontColor、 OlapExtraAttributesXml和 OlapChildrenXml
SourceFile 存储顶层连接源,而 TextSourceFile 存储独立的 textPr 导入源;空的 TextSourceFile 出于兼容性回退到 SourceFile for compatibility
TXLSWebTableSelectorKind 配置 TXLSWebTableSelector,其 Kind、 Name、 Index、 ExtraAttributesXml、 ChildrenXml、 Assign和 Validate 成员保留命名、索引和完整表格选择器
TXLSWebTableSelectors 提供 Add、 AddExisting、 Assign、 Validate、 Delete、 Clear、 Count、 Items、 ExtraAttributesXml和 UnknownChildrenXml
TXLSTextImportFieldType configures TXLSTextImportField配置 FieldType,其 Position、 ExtraAttributesXml、 ChildrenXml、 Assign和 Validate 成员定义一个固定文本字段
TXLSTextImportFields 提供 Add、 AddExisting、 Assign、 Validate、 Delete、 Clear、 Count、 Items、 ExtraAttributesXml和 UnknownChildrenXml
完整的连接成员
TXLSConnection 的公共属性是 Id、 TypeCode、 SourceFile、 OdcFile、 SingleSignOnId、 KeepAlive、 Interval、 BackgroundRefresh、 RefreshOnLoad、 SaveData、 SavePassword、 NewConnection、 Deleted、 OnlyUseConnectionFile、 ReconnectionMethod、 RefreshedVersion、 MinRefreshableVersion、 ConnectionString、 CommandText、 ServerCommandText、 CommandType、 Parameters和 ExtensionXml
Web 属性是 WebUrl、 WebPost、 WebEditPage、 WebHtmlFormat、 WebXml、 WebSourceData、 WebConsecutive、 WebFirstRow、 WebXl97、 WebTextDates、 WebXl2000、 WebExtraAttributesXml和 WebChildrenXml
文本属性是 TextSourceFile、 TextPrompt、 TextDelimited、 TextCodePage、 TextFirstRow、 TextCharacterSet、 TextQualifier、 TextFileType、 TextDecimal、 TextThousands、 TextTab、 TextSpace、 TextComma、 TextSemicolon、 TextConsecutive、 TextDelimiter、 TextExtraAttributesXml和 TextChildrenXml;数据库保留使用 DbExtraAttributesXml 和 DbChildrenXml
TXLSConnections.Assign 复制一个集合, IndexOfId 查找稳定的连接标识符, RootAttributesXml 加上 UnknownChildrenXml 保留不支持的根内容
连接参数
TXLSConnectionParameter 使用 Name、 ParameterType、 SqlType、 RefreshOnChange、 Prompt、 CellReference、 IntegerValue、 DoubleValue、 BooleanValue、 StringValue、 ValueKind、 ExtraAttributesXml和 Assign
TXLSConnectionParameters 提供 Add、 AddExisting、 Assign、 Delete、 Clear、 Count和 Items
查询表和字段
TXLSQueryTable 使用 Assign、 ConnectionId、 ResultTableName、 ResultRange、 RowNumbers、 DisableRefresh、 BackgroundRefresh、 FirstBackgroundRefresh、 RefreshOnLoad、 GrowShrinkType、 FillFormulas、 RemoveDataOnSave、 DisableEdit、 PreserveFormatting、 Intermediate、 AutoFormatId、 ApplyNumberFormats、 ApplyBorderFormats、 ApplyFontFormats、 ApplyPatternFormats、 ApplyAlignmentFormats、 ApplyWidthHeightFormats、 PreserveSortFilterLayout、 FieldIdWrapped、 AdjustColumnWidth、 HeadersInLastRefresh、 MinimumVersion、 UnboundColumnsLeft、 UnboundColumnsRight、 DeletedFields、 SortStateXml、 ExtensionXml、 RefreshExtensionXml和 UnknownChildrenXml, ExtraAttributesXml, RefreshExtraAttributesXml, and RefreshUnknownChildrenXml
TXLSQueryTableField uses Id使用 Name、 TableColumnId、 DataBound、 RowNumbers、 FillFormulas、 Clipped、 ExtraAttributesXml、 Assign和 Validate
TXLSQueryTableFields 提供 Add、 AddExisting、 Assign、 FindById、 FindByTableColumnId、 NextId、 Validate、 Delete和 Clear; Count复制工作表的查询表集合 Items; TXLSQueryTables.Assign 复制工作表的查询表集合
显式的查询表刷新
无需调用方提供程序、注册、原生绑定和外部操作限制的显式刷新,参见 自动查询提供程序
TXLSXWorksheet.RefreshQueryTable 按名称或从零开始的集合索引选择一个既有查询表,接受调用方拥有的 TXLSQueryTableProvider、默认为 1,000,000 数据行的正数 AMaxRows 限制,以及可选的 TXLSQueryRefreshProgress 回调
实现 TXLSQueryTableProvider.Fetch(Connection, Query, MaxRows, out Data, var Abort) 返回一个 TXLSQueryResultData 记录,包含 ColumnCount 和由标量 Variant 值组成的矩形 Rows; TXLSQueryResultRow 是 variant 数组, TXLSQueryResultRows 是这些行的数组;行不含既有标题,必须与目标宽度匹配,数值、日期、布尔、字符串、错误、空值和 null 保留其类型,以 = 开头的字符串仍是字面值
提供程序接收仅在调用期间有效的分离连接与查询元数据快照,并必须遵守行限制;库会拒绝超量的行、参差不齐的矩阵、不受支持的值类型、无效宽度以及 1,048,576 行 × 16,384 列工作表网格之外的结果,不做截断
刷新保留既有标题和单元格格式,清除收缩结果的旧数据尾部,调整附加 Excel 表和受支持的筛选或排序区域的大小,更新查询表元数据,并使依赖计算失效;结果区域之外的公式和样式保持不变
被禁用的查询、已删除的连接、重叠的合并单元格或数组公式、另一个表格或查询结果、被占用的扩展单元格、计算列、汇总行、行号列、填充公式行为或未绑定的列,都会在结果单元格变更之前阻止刷新
进度在取数前、应用结果前以及每行应用或清除后报告;在提供程序或进度回调中设置 Abort 即可取消,返回值 1 表示成功、0 表示取消、-1 表示失败,诊断代码 1401和 1400 在 xlsOperationRefresh 下分别标识取消和失败
取消或提供程序、验证、回调异常会恢复结果单元格和查询或表元数据,包括既有单元格句柄;显式的调用方提供程序拥有其外部访问;受支持的 Windows Text、ADO、ODBC 和 Web 查询的自动选择可通过工作簿分发器获得,而打开工作簿或保留 RefreshOnLoad 元数据不会调用任何一条提供程序路径
XML 映射与自定义 XML
TXLSXWorkbook.XmlMaps 返回 TXLSXXmlMaps, TXLSXWorksheet.XmlCellBindings 返回工作表绑定集合
| TXLSXXmlDataBinding | 存储将映射连接到自定义 XML 部件的关系标识符和刷新元数据 Enabled, DataBindingName, FileBinding, FileBindingName, ConnectionId, DataBindingLoadMode, and ExtensionXml mirror the OOXML dataBinding attributes |
| TXLSXXmlSchema | 存储一个架构标识符、命名空间和保留的架构 XML Id, SchemaRef, NamespaceUri, Language, and Xml round-trip the schema part |
| TXLSXXmlMap | 存储映射标识、根元素和命名空间,以及其 DataBinding; import behaviour is configured by RootElement, SchemaId, ShowImportExportValidationErrors, AutoFit, Append, PreserveSortAFLayout存储映射标识、根元素和命名空间以及其 PreserveFormat |
| TXLSXXmlMaps | AddSchema、 AddMap、 FindSchema、 FindMap、 DeleteSchema、 DeleteMap、 Clear、 Validate、 SelectionNamespaces和 SchemaCount, Schemas, and MapCount |
| TXLSXXmlCellBinding | 把一个工作表区域映射到 XPath 和 XML 映射标识; CellReference, XPath, XmlDataType, MapId, XmlCellPropertyId, ConnectionId, and UniqueName 将一个工作表区域映射到 XPath 和 XML 映射标识符 |
| TXLSXXmlCellBindings | Add 重载、 Delete、 Clear、 Validate、 Count和 Items |
| TXLSXCustomXmlPart | AddSchemaRef 把自定义 XML 项与模式引用关联; Xml holds the item payload, ItemId the data-store item identifier, and SchemaRefs 将自定义 XML 项与架构引用关联 |
高级克隆、HTML 和图像成员
TXLSXRangeClonePart、 TXLSXRangeCloneParts和 TXLSXRangeCloneSourceCounts 定义依赖感知的区域克隆。 TXLSXWorksheet.CaptureRangeCloneSourceCounts、 AuthorizeRepeatedDisjointRangeClones、 ResizeTableRows和 TileRangeAxisMetadata 是编译式报表展开和自定义参与者使用的高级结构编辑挂钩
TXLSXHtmlExportSessionState 描述 TXLSXHtmlExportSession;使用 BeginExport、 ExportNextSheet和 Reset,然后检查 State、 Active、 ExportedSheetCount和 TotalSheetCount。设置 TXLSXHtmlExportOptions.IncludeDrawings 以将受支持的工作表对象渲染到 HTML 会话中
TXLSXImage 为共享的 PDF、SVG、HTML、位图和图元文件渲染暴露 Gamma、 ShadowColor、 ShadowOpacity、 ShadowBlur、 ShadowOffsetX和 ShadowOffsetY ,供共享的 PDF、SVG、HTML、位图和图元文件渲染