Problems converting cells with multiple options

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

Problems converting cells with multiple options

Postby npeshman » Fri Jan 04, 2013 3:40 pm

I am trying to convert an excel file that has a drop down of multiple options per cell to a pdf. In general the generation is ok however an extra page appears at the end of the pdf document that contains all the options in each of these cells. How do I prevent this? See attachments to see what I mean
excel options.PNG
Note other cells have similar drop downs
excel options.PNG (12.38 KiB) Viewed 2929 times

PDFLastSheet.PNG
The Last sheet of the pdf that is generated (any cell that has a drop down has the data listed.)
PDFLastSheet.PNG (21.75 KiB) Viewed 2929 times

As a immediate fix I tried to remove the last page of the document but am confronted with the below error. What am I doing wrong here?

Code:

Dim pgcount = MyPdfDocument.Pages.Count
Dim pg As Spire.Pdf.PdfPageBase = MyPdfDocument.Pages.Item(pgcount - 1)
'' These two lines appear to work correctly but the below one throws the error
MyPdfDocument.Pages.Remove(pg)


Error:
===EXCEPTION===Export excel to pdf format error. System.NullReferenceException: Object reference not set to an instance of an object.
at Spire.Pdf.Widget.PdfPageCollection.Remove(PdfPageBase page)
npeshman
 
Posts: 2
Joined: Thu Dec 13, 2012 7:15 pm

Re: Problems converting cells with multiple options

Postby amy.zhao » Sat Jan 05, 2013 9:01 am

Hello npeshman,

Thanks for your inquiry.
We have reproduced your problem. We are sorry for the inconvenience. We have posted it to our dev team. They will do some researches and fix it soon. Once it has been fixed, we will inform you immediately.

Best regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am

Re: Problems converting cells with multiple options

Postby amy.zhao » Sat Jan 05, 2013 9:41 am

Hello npeshman,

Now we provide you a solution and hope it can resolve your current problem. We use spire.xls_6.9.13 to test it, it works well on our side. Please try the steps below and tell us your test result. Thank you!
1. save the converted PdfDocument to a pdf file, as MyPdfDocument.SaveToFile( "sample.pdf");
2. creat a new PdfDocument to load sample.pdf, as
Dim newDoc As New PdfDocument(); newDoc.LoadFromFile("sample.pdf");
3. remove the last page of sample.pdf,as newDoc.Pages.RemoveAt(newDoc.Pages.Count-1);

Best regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am

Re: Problems converting cells with multiple options

Postby npeshman » Mon Jan 07, 2013 4:24 pm

Thank you for your response. The suggested fix works with removing a page from the pdf
npeshman
 
Posts: 2
Joined: Thu Dec 13, 2012 7:15 pm

Re: Problems converting cells with multiple options

Postby amy.zhao » Tue Jan 08, 2013 2:48 am

Hello,

Thanks for your feedback.
For the previous bug, we will inform you immediately as soon as it has been fixed.
Also if you encounter other problems, please feel free to contact us.
Have a great day!

Best regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am

Re: Problems converting cells with multiple options

Postby amy.zhao » Wed Jan 09, 2013 8:09 am

Hello,

Thank you for waiting.
We have fixed the bug. Please download Spire.XLS Pack Hotfix Version:6.9.15 from the link http://www.e-iceblue.com/Download/download-excel-for-net-now.html. We use the code below to do some tests, and the hotfix works well on our side. Please test the hotfix on your side. If you still have the problem or we miss something, please tell us.
Code: Select all
        Dim workbook As New Workbook()
        workbook.LoadFromFile(excelPath)
        Dim converter As New PdfConverter(workbook)
        Dim MyPdfDocument As New PdfDocument()
        MyPdfDocument = converter.Convert()
        MyPdfDocument.Pages.RemoveAt(MyPdfDocument.Pages.Count - 1)
        MyPdfDocument.SaveToFile("result.pdf")


Best regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am

Re: Problems converting cells with multiple options

Postby zecyAledlyLer » Sat Jan 19, 2013 11:52 pm

This very valuable message
zecyAledlyLer
 
Posts: 2
Joined: Wed Jan 09, 2013 4:56 am


Return to Spire.XLS

Who is online

Users browsing this forum: Betsy.jiang and 0 guests