officefileapi-devexpress-dot-spreadsheet-dot-pivotitem-630ddcf6.md
Gets or sets a value indicating whether the item should be displayed in the report.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
bool Visible { get; set; }
Property Visible As Boolean
| Type | Description |
|---|---|
| Boolean |
true , if the item is visible; otherwise, false.
|
Use the Visible property to control the visibility of items in a PivotTable field. The following example demonstrates how to hide the first item in the “Product” row field.
Dim worksheet As Worksheet = workbook.Worksheets("Report4")
workbook.Worksheets.ActiveWorksheet = worksheet
' Access the pivot table by its name in the collection.
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")
' Access items of the "Product" field.
Dim pivotFieldItems As PivotItemCollection = pivotTable.Fields(1).Items
' Hide the first item in the "Product" field.
pivotFieldItems(0).Visible = False
Worksheet worksheet = workbook.Worksheets["Report4"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Access items of the "Product" field.
PivotItemCollection pivotFieldItems = pivotTable.Fields[1].Items;
// Hide the first item in the "Product" field.
pivotFieldItems[0].Visible = false;
To hide all items in a PivotTable field except one, use the PivotField.ShowSingleItem method.
To restore the display of all hidden items in a pivot field, call the PivotField.ShowAllItems method.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Visible property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
// Hide the first item in the "Product" field.
pivotFieldItems[0].Visible = false;
#endregion #ItemVisibility
// Hide the first item in the "Product" field.
pivotFieldItems[0].Visible = false;
#endregion #ItemVisibility
// Hide the first item in the "Product" field.
pivotFieldItems[0].Visible = false;
#endregion #ItemVisibility
' Hide the first item in the "Product" field.
pivotFieldItems(0).Visible = False
' #End Region ' #ItemVisibility
' Hide the first item in the "Product" field.
pivotFieldItems(0).Visible = False
' #End Region ' #ItemVisibility
' Hide the first item in the "Product" field.
pivotFieldItems(0).Visible = False
#End Region ' #ItemVisibility
See Also