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 Dec 14, 2015 12:11 pm

Hello

I'm generating an xls file, and at the end I'm converting this file to a pdf. In the xls file, on the first sheet I'm putting 2 images, but in the pdf file I have only one image, the first one. Do you know why it's happening?

This is how I convert xls to pdf:

Spire.Xls.Converter.PdfConverter pdfConverter = new Spire.Xls.Converter.PdfConverter(_workbook);
Spire.Pdf.PdfDocument pdfDocument = new Spire.Pdf.PdfDocument();
Spire.Xls.Converter.PdfConverterSettings settings
= new Spire.Xls.Converter.PdfConverterSettings();
settings.EmbedFonts = true;
settings.TemplateDocument = pdfDocument;
pdfDocument = pdfConverter.Convert(settings);

pdfDocument.Pages.RemoveAt(3);
//PdfAnnotationCollection widgetCollection = page.AnnotationsWidget;
pdfDocument.SaveToFile("XLS-to-PDF.pdf");
pdfDocument.Close();

Thank you

CARDSABIN@YAHOO.COM
 
Posts: 27
Joined: Fri Nov 20, 2015 11:24 am

Tue Dec 15, 2015 1:25 am

Hi,

Thanks for your inquiry.
Please try the following solution.
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile("sample.xls");
workbook.SaveToFile("result.pdf", Spire.Xls.FileFormat.PDF);

If the issue still exists, please share your excel file to help us do an investigation.
Thank you.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2774
Joined: Wed Jun 27, 2012 8:50 am

Tue Dec 15, 2015 7:12 am

Hello

Yes, this way is working.

Thank you

CARDSABIN@YAHOO.COM
 
Posts: 27
Joined: Fri Nov 20, 2015 11:24 am

Tue Dec 15, 2015 7:32 am

Hi,

Thanks for your feedback.
Welcome to write to us again if you have further problems.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2774
Joined: Wed Jun 27, 2012 8:50 am

Tue Jan 12, 2016 5:34 am

Hi,
I tried the given method, but while converting, I am unable to apply the Pdf Document page settings, like page orientation, page height, width, etc. In such a case, my intended excel conversion is not happening properly as the page breaks.

Below is the code I need to use while I want to convert excel to Pdf.
Code: Select all
PdfDocument pdfDocument = new PdfDocument();
pdfDocument.PageSettings.Orientation = PdfPageOrientation.Landscape;
pdfDocument.PageSettings.Width = 1000;
pdfDocument.PageSettings.Height = 1000;
 //Convert Excel to PDF using the template above 
PdfConverter pdfConverter = new PdfConverter(workbook);
PdfConverterSettings settings = new PdfConverterSettings();
settings.TemplateDocument = pdfDocument;
pdfDocument = pdfConverter.Convert(settings);
 pdfDocument.SaveToFile(Pdfpath);

If I use the above code, I am unable to add more than one image.

Also if i try adding the settings I have assigned above, in the SaveToFile method, even then it doesn't help(where the settings still contains the page settings)
Code: Select all
settings.TemplateDocument = pdfDocument;
workbook.SaveToFile(filePath, settings);

I am currently using version 7.3.5.55040. Should I update to the 7.8.0 version for this.

Secondly, When I try to convert an excel generated by OPEN XML, my pdf document is empty not getting converted. I only get a straight line in my PDF.
Can you please help me regarding this issue.
Thanks,
Ravi

ravishankark1992
 
Posts: 1
Joined: Tue Jan 12, 2016 5:25 am

Tue Jan 12, 2016 7:07 am

Hi,

Thanks for your posting.
At present the latest version is Spire.XLS Pack Hotfix Version:7.8.64. Please try the version.
If the issues still exists, to help us can recreate the issue on our end, please share your excel files.

Thank you.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2774
Joined: Wed Jun 27, 2012 8:50 am

Tue Sep 29, 2020 4:10 am

amy.zhao wrote:Hi,

Thanks for your inquiry.
Please try the following solution.
Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile("sample.xls");
workbook.SaveToFile("result.pdf", Spire.Xls.FileFormat.PDF);

If the issue still exists, please share your excel file to help us do an investigation.
Thank you.

Best Regards,
Amy
E-iceblue support team


Hi, i have troubles with converting pdf to excel.
Excel pages don't draw on each pdf page.
Exapmle:
1 have 2 pages in excel, after generating i have 3 pages on pdf, last row of excel page wrapping on next pdf page.
Attachments
spire_screen3.PNG
this affect also shows without my custom header too
spire_screen3.PNG (59.67 KiB) Viewed 4087 times

spqr911911
 
Posts: 2
Joined: Tue Aug 11, 2020 5:51 am

Tue Sep 29, 2020 7:30 am

Hi Andrey,

Thanks for your inquiry.
Could you please provide your source file and your output file to help us analyze further? You can upload your files here or send them us(support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Wed Sep 30, 2020 3:39 am

Elena.Zhang wrote:Hi Andrey,

Thanks for your inquiry.
Could you please provide your source file and your output file to help us analyze further? You can upload your files here or send them us(support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Elena
E-iceblue support team


Hi Elena
I sended letter yesterday.

Sicerely,
Andrey

spqr911911
 
Posts: 2
Joined: Tue Aug 11, 2020 5:51 am

Wed Sep 30, 2020 6:41 am

Hello,

Thank you for providing your file via email.
I did an initial test and did reproduce your issue. I have posted this issue to our Dev team with the ticket SPIREXLS-2820 for further investigation. If there is any update, we will inform you. Sorry for the inconvenience caused.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Thu Oct 31, 2024 9:20 am

Hello,

SPIREXLS-2820 has been fixed. Welcome to download and test [Spire.XLS Pack(Hotfix) Version:14.10.2]

Our website link: https://www.e-iceblue.com/Download/download-excel-for-net-now.html
NuGet link: https://www.nuget.org/packages/Spire.XLS/14.10.2

If you have any questions, please let us know.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2774
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.XLS