Reading all data from the Base fields of Pivot Table. Reopen

Hi,

I read item data from Base fields of my pivot table. All fields have data (in Excel), but I can read only some fields.


I created simple Excel file with pivot table.
I can read items from fields:
Region
Product
Mar
Apr
May
Jun
These fields I see as empty:
Jan
Feb
Jul
Aug
Sep
Oct
Nov
Dec

Code snippet:

PivotFieldCollection pfc = pt.BaseFields;
bool tryReloadItems = true;

for (int i = 0; i < pfc.Count; i++)
{
PivotField pf = pfc[i];

printLine(“ItemCount”, pf.ItemCount.ToString(), SPACE4); // my inner printing method
for (int j = 0; j < pf.ItemCount; j++)
{
int cntTry = 0;
while (true)
try
{
string str = “Item”;
if (cntTry > 0) str = “[” + cntTry.ToString() + "] " + str;
printLine(str, pf.Items[j], SPACE4);
break;
}
catch
{
if ((cntTry > 1000) || (!tryReloadItems))
{
printLine(“Item”, " ============== ERROR ============== ", SPACE4);
break;
}
cntTry++;
}
}
}

I’ve attached sample document. I use Aspose.Cell version 7.0.4.0

Thank you,
Alex Shloma

Hi Alex,


I have logged a ticket for your mentioned issue with an id: CELLSNET-40205. We need to thoroughly investigate if this is an issue or something else. We will do it soon. Once we have any update for it, we will share it here.

Thank you.
Hi,

Please use this sample code to initialize items:
e.g
wb.Worksheets[1].PivotTables[0].RefreshData();
wb.Worksheets[1].PivotTables[0].BaseFields[2].InitPivotItems();

Also, we recommend you to try the latest fix: Aspose.Cells for .NET v7.0.4.1

Thank you.
Hi,

Works fine!

Thank you!
Alex Shloma

The issues you have found earlier (filed as CELLSNET-40205) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.