Hi,
Hello and thank you for your support,
I have an existing .xls spreadsheet which contains a sheet named data.
I use an sql query to pull the latest data into this spreadsheet..
private void LoadDataWorkSheet1(Aspose.Cells.Worksheet dataWorkSheet)
{
// Retrieve Report1 Data
//DataTable reportDataTable = RetrieveTestData1();
System.Data.DataTable reportDataTable = RetrieveDataReport("ODS_DB.dbo.MYSTOREDPROCEDURE");
ImportDataColumn(dataWorkSheet, reportDataTable);
}
Once I have "reloaded" the data into the spreedsheet.. I attempt to refresh the pivot tables that are dependent upon the "reloaded" data.. The following code..
private void RefreshAllData(Workbook workbook)
{
foreach (Aspose.Cells.Worksheet activeWorkSheet in workbook.Worksheets)
{
if (activeWorkSheet.PivotTables.Count > 0)
{
foreach (Aspose.Cells.Pivot.PivotTable pivotTable in activeWorkSheet.PivotTables)
{
pivotTable.RefreshData();
pivotTable.CalculateData();
}
}
}
}
Finally I save the updated file.
workbook.Save(saveFileName);
Everything appears to work as expected.. Great.. But when I go try to open the generated file.. The file now appears corupt and Excel repairs the pivot tables saying that they contain errors.
The only detailed message I get is the following.
Microsoft Office Excel File Repair Log
Errors were detected in file 'C:\Documents and Settings\o919265\Desktop\test.xls'
The following is a list of repairs:
Repairs were made to PivotTable report 'PivotTable1' on '[test.xls]Firm_Location_Pivot'.
Repairs were made to PivotTable report 'PivotTable2' on '[test.xls]Firm_Agent_Pivot'.
Repairs were made to PivotTable report 'PivotTable4' on '[test.xls]DQ_FirmLead_Pivot'.
I am using the latest version of aspose downloaded off the site this morning.
Please let me know if you need to examine the orignial spreadsheet but no errors exist before running the refresh / calculate methods. So I have to believe this is not working as expected.
Thanks for your support!! Benjamin Pirih
Also!! I can do the pivot refresh using the micrsoft.interop.execel without issue. using the following code..
This would indicate that an issue exists with the current aspose method and not the underlying spreadsheet pivot table formulas..
I cannot use this on our production server and is one of reason we purchased Aspose..
Thanks Again for your support!! Benjamin Pirih
public void RefreshAllData(string saveFileName)
{
Microsoft.Office.Interop.Excel.Application ObjExcel = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook ObjWorkBook;
ObjWorkBook = ObjExcel.Workbooks.Open(saveFileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
ObjWorkBook.RefreshAll();
ObjWorkBook.Save();
ObjWorkBook.Close(false, saveFileName, null);
}
Hi,
I sent you an email with our template… Thanks!
Hi Benjamin,
Thank you for your support. Do you have a timeline on when this issue will be corrected? We have a project that is pending this? Thanks Again!!
Hi,
The issues you have found earlier (filed as 28751) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.