hi,
i load an xls file with a pivot table, then update datasource for the pivot table and at the end i want to refresh the data in pivot tabbe.
i try this:
Dim workbook As Workbook = New Workbook()
workbook.LoadFromFile("C:\00scambio\TemplateClientiProvinceSize.xlsx")
Dim sheetDati As Worksheet = workbook.Worksheets(1)
Dim sheetPivot As Worksheet = workbook.Worksheets(0)
sheetDati.Clear()
sheetDati.InsertDataTable(ExcelDt, True, 1, 1)
workbook.NameRanges("DataSource").RefersToRange = sheetDati.Range(1, 1, sheetDati.LastRow, sheetDati.LastColumn)
Dim pt As XlsPivotTable = sheetPivot.PivotTables(0)
pt.CalculateData()
workbook.SaveToFile("C:\00scambio\ClientiProvinceSize.xlsx", ExcelVersion.Version2007)
System.Diagnostics.Process.Start("C:\00scambio\ClientiProvinceSize.xlsx")
when excel ope the saved file it return an error as show in the image. Why? where i wrong?
best regards