We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

REfresh pivot problems


I create pivot table y worksheet 1
I have the data for this pivot in worksheet 2

Wih Aspose I want to select the data from database, paste in worksheet 2 and update de pivot table

But the line ’ pivotTable.CalculateData();’ throws this error: 'Index was outside the bounds of the array’

Without pivotTable.CalculateData(); the daat doesn’t show when open Excel file

The code:
  Aspose.Cells.Workbook _AsposeWorkbook = new Aspose.Cells.Workbook(“Excelpath”);

	DataTable _Dt = UtilesSql.GetDatatable(“SELECT * FROM table”);
            _AsposeWorkbook.Worksheets[2].Cells.ImportDataTable(_Dt, true, “A1”);
        <span style="color:blue;">foreach</span> (Aspose.Cells.<span style="color:#2b91af;">Worksheet</span> worksheet <span style="color:blue;">in</span> _AsposeWorkbook.Worksheets)

            <span style="color:blue;">foreach</span> (Aspose.Cells.Pivot.<span style="color:#2b91af;">PivotTable</span> pivotTable <span style="color:blue;">in</span> worksheet.PivotTables)

                pivotTable.RefreshDataFlag = <span style="color:blue;">true</span>;
                pivotTable.CalculateData(); //Error
                pivotTable.RefreshDataFlag = <span style="color:blue;">false</span>;

               <span style="font-family:Lucida Sans;font-size:12;font-style:italic;color:green;">         </span>
        }</pre><pre style="font-family: Consolas; font-size: 13px; background: white;">I attach the Exceñ file</pre><pre style="font-family: Consolas; font-size: 13px; background: white;">Can you help me? Thanks</pre></div>


Please followup on your other thread with same concerns.