We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ConvertToPdf an xls document with a pivot table fail

Thread ID:

Created:

Updated:

Platform:

Replies:

143467 Mar 20,2019 08:54 PM UTC Mar 27,2019 01:16 PM UTC ASP.NET Core 4
loading
Tags: XlsIO
JeanR
Asked On March 20, 2019 08:56 PM UTC

Hello, i face an exception with the pdf convertor, and no way to get rid of it.

Find below the code, simply loading the file and attempting to convert it and enclosed the sample file.

System.ArgumentNullException: 'Value cannot be null.
Parameter name: PivotTable cannot be created for table with Named Range'

            using (ExcelEngine excelEngine = new ExcelEngine())
            {
                IApplication application = excelEngine.Excel;
                FileStream excelStream = new FileStream(@"master.xlsx", FileMode.Open, FileAccess.Read);
                IWorkbook workbook = application.Workbooks.Open(excelStream);               
              
                XlsIORenderer renderer = new XlsIORenderer();
                PdfDocument pdfDocument = renderer.ConvertToPDF(workbook); // fail here
                Stream stream = new FileStream(@"output.pdf", FileMode.Create, FileAccess.ReadWrite);
                pdfDocument.Save(stream);

                excelStream.Dispose();
                stream.Dispose();
            }

Thanks for your help.

Reproduced using nugetversion 16.4.0.54 using a dot net core 2.2 console app.

Attachment: master_746288b8.zip

Dilli Babu Nandha Gopal [Syncfusion]
Replied On March 21, 2019 09:43 AM UTC

Hi Jean, 

Thank you for contacting Syncfusion support. 

We can reproduce the reported issue with “Exception occurs while converting a Workbook to PDF” and suspect it as a defect. We are analyzing on this and will update the further details by 25 March 2019. 

Regards, 
Dilli babu. 


Dilli Babu Nandha Gopal [Syncfusion]
Replied On March 25, 2019 04:01 PM UTC

Hi Jean, 
 
On the analysis, we found that the pivot table in the Excel document is created using external range. Currently, XlsIO does not have support for creating pivot table from external source.  However, we may able to skip the exception while conversion to show only the data. The pivot table styles will not be preserved in the output PDF document.  We have logged a defect report for this and we will skip the exception issue in our future release 2019 Volume 1 Service Pack 1 which will be rolled out by the end of April 2019. 
 
You can track the creation of pivot table from external range feature using feedback report which is available in the following link. 

Regards, 
Dilli babu. 


JeanR
Replied On March 26, 2019 08:54 AM UTC

Thanks, so a different worksheet in the same document is considered as an external source ?
I was aware about the fact that external (odbc, other document on the filesystem etc..) was not supported, however a simple table/range in the same file should be supported.
Looking forward for a fix :)


Dilli Babu Nandha Gopal [Syncfusion]
Replied On March 27, 2019 01:16 PM UTC

Hi Jean, 
 
In the given input document, the data source for the pivot table is set as external named range. But, the name of the input document and the external workbook name are same. So, Microsoft Excel refers the data from the same input document. However, we have considered this scenario as an issue from our side and it will be fixed in our future release 2019 Volume 1 SP1. After this fix, the output document will contain styles for the pivot table. 

Regards, 
Dilli babu. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;