Open ajaygupta2000 opened 6 years ago
i have the same problem !
i tried this code , but i don't find the function to refresh the ### pivot
foreach (ExcelWorksheet wsl in p.Workbook.Worksheets) { wsl.Workbook.Calculate(); foreach (OfficeOpenXml.Table.PivotTable.ExcelPivotTable pivotTable in wsl.PivotTables) {
}
}
@JanKallman @gcoh @ajaygupta2000 I have same problem. How to to fix this problem?
https://stackoverflow.com/a/39294261/61525
I couldn't find a way to achieve this using EPPlus.
However, you can enable the "Refresh the data when opening the file" property on the PivotTable manually before modifying the file, so that when you open the file using Excel, the content of the PivotTable will be calculated based on the modified data. You can find this property under the Data tab in the PivotTable options.
Or Add this to ExcelPivotCacheDefinition.cs
public bool RefreshOnLoad
{
get
{
return GetXmlNodeString("@refreshOnLoad") == "1";
}
set
{
SetXmlNodeString("@refreshOnLoad", value?"1":"0");
}
}
My workbook is having a pivot table which computes summary from one of my worksheets. I am adding new rows to this worksheet through EPPLUS and want to refresh the pivot table after that. But I could not find any way to refresh the pivot table through EPPlus. Is this feature existing in 4.5.0, if not do you have any plans to implement it.
Thanks, AG