Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Jan 09, 2023 8:50 am

I have an Excel file with PivotTables and Charts and I want them to be refreshed automatically!
My program takes an Excel with 5 sheets and returns a pdf file (i use Spire.Pdf to convert/print the file). I have 2 sheets X and Y: X contains Data, Y: contains PivotTables and Charts to be refreshed with the data of sheet X and I couldn't any solution to refresh those charts but it works fine with PivotTables. Any solution, please? Or maybe refresh all the sheet?

oumaima111
 
Posts: 2
Joined: Thu Jun 23, 2022 4:12 pm

Mon Jan 09, 2023 10:00 am

Hi,

Thanks for your inquiry.
To help us work out a solution for you, could you please provide us with the following messages? You can send them to us via email (support@e-iceblue.com) or attach them here. Thanks for your assistance in advance.
1) your full code and sample file.
2) the version of Spire.Xls in your project.

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Mon Jan 09, 2023 11:22 am

I sent the email !

oumaima111
 
Posts: 2
Joined: Thu Jun 23, 2022 4:12 pm

Tue Jan 10, 2023 7:22 am

Hi,

Thanks for your feedback.
I tested your xlsx file with Spire.XLS(12.12.3), using the following code,

Code: Select all
 
            Workbook workbook = new Workbook();
            workbook.ConverterSetting.ClearCacheOnConverted= true;
            workbook.LoadFromFile("TEST tcd & charts MODELARIO2.xlsx");
            var pt = workbook.Worksheets["TEST TCD"].PivotTables;
            foreach (Spire.Xls.Core.Spreadsheet.PivotTables.XlsPivotTable item in pt)
            {
                item.Cache.IsRefreshOnLoad = true;
                item.CalculateData();
            }

            var tables = workbook.Worksheets["TEST TCD"].Charts;
            foreach (Chart chart in tables)
            {
                chart.RefreshChart();
            }
            workbook.SaveToFile("output.pdf", FileFormat.PDF);

the PivotTables and charts are refreshed, but I found a mistake, the labels and shapes are not aligned, see attached.
Picture1.png
Picture1.png (19.97 KiB) Viewed 2504 times

I have logged this issue into our bug tracking system with the ticket number SPIREXLS-4402, Our developers will investigate and fix it, sorry for the inconvenience caused. Once the issue is fixed, I will inform you in time.

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Fri Feb 17, 2023 4:42 am

Hi,

Thanks for your patience!
Glad to inform you that we just released Spire.XLS 13.2.4 which fixes the issue with SPIREXLS-4402.
Please download the new version from the following links to test.
Website download link: https://www.e-iceblue.com/Download/download-excel-for-net-now.html
Nuget download link: https://www.nuget.org/packages/Spire.XLS/13.2.4

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.XLS