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:
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
I can read items from fields:
RegionThese fields I see as empty:
Product
Mar
Apr
May
Jun
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