LayoutForm 属性 (Excel) CubeFieldCubeField.LayoutForm property (Excel)

返回或设置指定的数据透视表项出现的方式,即以表格格式还是以分级显示格式显示。Returns or sets the way the specified PivotTable items appear—in table format or in outline format. 读/写**XlLayoutFormType**。Read/write XlLayoutFormType.

语法Syntax

表达式LayoutFormexpression.LayoutForm

_表达式_一个代表**CubeField** 对象的变量。expression A variable that represents a CubeField object.

说明Remarks

您可以为任何数据透视表字段设置该属性;但是, 仅当指定字段是除最内层 (最低级别) 行字段之外的其他行字段时, 才会显示格式设置。You can set this property for any PivotTable field; however, the formatting appears only if the specified field is a row field other than the innermost (lowest-level) row field.

对于非 OLAP 数据源, 当重新排列该字段或在数据透视表中添加或删除该字段时, 该属性的值不会更改。For non-OLAP data sources, the value of this property doesn't change when the field is rearranged or when it is added to or removed from the PivotTable report.

示例Example

本示例以分级显示格式显示当前活动工作表上第一个数据透视表中的状态字段,然后在该字段顶部显示分类汇总。This example displays the state field in the first PivotTable report on the active worksheet in outline format, and it displays the subtotals at the top of the field.

With ActiveSheet.PivotTables("PivotTable1") _ 
 .PivotFields("state") 
 .LayoutForm = xlOutline 
 .LayoutSubtotalLocation = xlTop 
End With

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.