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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Converting Excel to PDF erases some fields

Thread ID:

Created:

Updated:

Platform:

Replies:

148194 Oct 9,2019 06:12 PM UTC Oct 14,2019 08:57 AM UTC WinForms 3
loading
Tags: XlsIO
Simon
Asked On October 9, 2019 06:12 PM UTC

Hello All,

Recently stumbled accross Syncfucion and so far it's been working pretty nice.
For a small personal project I need to edit an Excel file, and save it as PDF.
The editing part works flawlessly, however when I save it as a PDF, 2 cells don't show in the PDF.

I've attached the Excel in question.
My C# code is as follows.

                            //Open the Excel document to Convert
                            ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);

                            ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings();
                            // Layout the page using FitAllColumnsOnOnePage options.
                            settings.LayoutOptions = LayoutOptions.FitAllColumnsOnOnePage;


                            //Initialize PDF document
                            PdfDocument pdfDocument = new PdfDocument();

                            //Convert Excel document into PDF document
                            pdfDocument = converter.Convert(settings);

PDF looks like the image below. The 2 cells in E39,E40 with 'Subtext1' and 'Subtext2' are missing.

Anyone has an idea as to why this happens?

-Simon

Attachment: Output_af8f67c9.rar

Konduru Keerthi Konduru Ravichandra Raju [Syncfusion]
Replied On October 11, 2019 12:49 AM UTC

Hi Simon, 
  
Greetings from Syncfusion. 
  
Print area is set in the Excel document which you have shared us and hence the content in the print area alone will converted to PDF. This is the behavior of Microsoft Excel. We suggest you to clear the print area before converting the Excel to PDF document to get all the fields. 
 
Please refer the below code snippet to clear the Excel print area in XlsIO. 
  
Code Snippet:  
  
//Clear the print area 
workbook.Worksheets[0].PageSetup.PrintArea = string.Empty; 
  
Regards, 
Keerthi.

Simon
Replied On October 11, 2019 06:06 AM UTC

Hello Keerthi,

I can't believed i've missed something as simple as that!
It works, thanks a million!

Kind regards,

Simon

Konduru Keerthi Konduru Ravichandra Raju [Syncfusion]
Replied On October 14, 2019 08:57 AM UTC

Hi Simon, 

We are glad that the issue is resolved at your end. 

Regards, 
Keerthi. 


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

Live Chat Icon For mobile
Live Chat Icon