Hi,
Using: Win XP, VS 2010, Office 2003, .NET FW 3.5
I have a .NET app that reads exported data and sets up a PT in Excel using the Interop interface.
One thing that I fail to solve is how I could make a possible item (from the RowFields) with no data (= all cells are empty in the complete row of that particular item) to still appear in my PT view?
Here's the part of the code where I filter what data should be visible or not:
Excel.PivotItems _PivotItems = (Excel.PivotItems)_PivotField.PivotItems(omv);
foreach (Excel.PivotItem _PivotItem in _PivotItems)
{
if (string.Compare(_PivotItem.Name, "(blank)") != 0)
{
ListViewItem lvit = new ListViewItem();
lvit.Text = _PivotItem.Caption;
if (FindListItem(_PivotItem.Caption, lvActiveFilter, 2))
_PivotItem.Visible = true;
else
_PivotItem.Visible = false;
}
Now setting a specific Item's Visible property to True doesn't seem to be enough in order to make that item to show up in the resulting PT, specially not if the item has no data.
Now there IS a flag within Excel PivotField that you can set to true (= check the corresponding checkbox "Show items with empty data") and that would affect the PT with desired result but, how could I accomplish this behaviour using either C# -> Interop or VBA?
BR,
perco754
Using: Win XP, VS 2010, Office 2003, .NET FW 3.5
I have a .NET app that reads exported data and sets up a PT in Excel using the Interop interface.
One thing that I fail to solve is how I could make a possible item (from the RowFields) with no data (= all cells are empty in the complete row of that particular item) to still appear in my PT view?
Here's the part of the code where I filter what data should be visible or not:
Excel.PivotItems _PivotItems = (Excel.PivotItems)_PivotField.PivotItems(omv);
foreach (Excel.PivotItem _PivotItem in _PivotItems)
{
if (string.Compare(_PivotItem.Name, "(blank)") != 0)
{
ListViewItem lvit = new ListViewItem();
lvit.Text = _PivotItem.Caption;
if (FindListItem(_PivotItem.Caption, lvActiveFilter, 2))
_PivotItem.Visible = true;
else
_PivotItem.Visible = false;
}
Now setting a specific Item's Visible property to True doesn't seem to be enough in order to make that item to show up in the resulting PT, specially not if the item has no data.
Now there IS a flag within Excel PivotField that you can set to true (= check the corresponding checkbox "Show items with empty data") and that would affect the PT with desired result but, how could I accomplish this behaviour using either C# -> Interop or VBA?
BR,
perco754