Bug Report T933343
Visible to All Users

Spreadsheet Document API cannot print a pivot table with an empty cache if this table references a non-existing style

created 4 years ago (modified 4 years ago)

The Office File Api seems to have what I want, convert an xlsx to pdf. I have excel workbooks with 2 sheets, one with data, the other with a pivot from that data. Even from the demo apps, it can't seem to be able to export the associated pivot that is in the excel file. Can the office file api export the pivot to pdf?

Pic below is the pivot rendered in Excel.

Image Removed as it contained private information.

Exported pdf seems to ignore the pivot and only exports the data. See below

Show previous comments (2)
Maria Nikulina (DevExpress) 4 years ago

    Thank you for your document. I checked it and see that an exception is thrown internally when the workbook calculates the document layout. Because of this error, the worksheet with the pivot table isn't exported to PDF.

    I forwarded this issue to our developers. Please give us time for a thorough analysis. We'll get back to you once we make any progress.

      Ok thanks will wait for their feedback.

      Maria Nikulina (DevExpress) 4 years ago

        You are welcome, Ndehi.

        Answers approved by DevExpress Support

        created 4 years ago (modified 4 years ago)

        We have addressed the issue described in this ticket and will include a fix in our next maintenance update. To apply this solution before official release, request a hotfix by clicking the appropriate version link.

        Note: Hotfixes may be unavailable for betas/updates set for release within a week.

        Additional information:

        While researching this document, we found two issues - the document pivot table references a non-existing style and the pivot table's cache is empty. We corrected the issue with the pivot table style. However, since the pivot cache is empty, the pivot cannot be printed. Thus, you need to manually refresh the pivot cache before exporting this document to PDF. We've implemented the PivotCache.RefreshOnLoad option, which indicates whether it's necessary to refresh the pivot cache. You can check the property value and refresh the cache as shown below. After that, the document will be properly exported to PDF.

        C#
        using (Workbook workbook = new Workbook()) { workbook.LoadDocument("Measured Scores per Category per Day-22-Cadbury-22_09_2020 08_59-26.xlsx"); foreach (var cache in workbook.PivotCaches) if (cache.RefreshOnLoad) cache.Refresh(); workbook.ExportToPdf("output.pdf", new PdfExportOptions(), "Pivot-Sheet1"); }
        Visual Basic
        Using workbook As Workbook = New Workbook() workbook.LoadDocument("Measured Scores per Category per Day-22-Cadbury-22_09_2020 08_59-26.xlsx") For Each cache In workbook.PivotCaches If cache.RefreshOnLoad Then cache.Refresh() Next workbook.ExportToPdf("output.pdf", New PdfExportOptions(), "Pivot-Sheet1") End Using
          Show previous comments (7)
          Maria Nikulina (DevExpress) 4 years ago

            P.S.

            On a side note: We are constantly seeking ways to improve our products and prioritize our development objectives. Your feedback to this crucial survey will help us answer important questions and to construct the best possible 2021 Office-inspired product development roadmap.
             
            I promise, this survey will only take a few minutes to complete.

            Thanks in advance.

              I can confirm that exporting the pivot to pdf is now ok after installing the hotfix.

              Thank you

              Maria Nikulina (DevExpress) 4 years ago

                I'm happy to hear that! Please do not hesitate to contact us in the future.

                Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

                Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.