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.

Tue Nov 22, 2016 8:19 am

How do I use the Excel print range setting when converting to PDF?

ystkueda
 
Posts: 7
Joined: Mon Nov 21, 2016 5:58 am

Tue Nov 22, 2016 8:42 am

Dear ystkueda,

Thanks for your inquiry.
Here is sample code for your kind reference.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\..\sample document\PrintAre.xlsx");
            Worksheet sheet = workbook.Worksheets[0];
           //set print area from cell "A1" to cell "C1"
            sheet.PageSetup.PrintArea = "A1:C1";
            workbook.SaveToFile("9150.pdf",FileFormat.PDF);

If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Nov 22, 2016 9:08 am

Thank you for your reply

Can I output from excel setting without specifying printarea?

ystkueda
 
Posts: 7
Joined: Mon Nov 21, 2016 5:58 am

Tue Nov 22, 2016 9:19 am

Dear ystkueda,

Thanks for your response.
Sorry that I didn't understand your requirement clearly, could you please describe it in detail ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Nov 24, 2016 12:06 am

Thank you for your reply.

Sorry about my poor English.

"Print sheets on one page"
I want to use this setting.

ystkueda
 
Posts: 7
Joined: Mon Nov 21, 2016 5:58 am

Thu Nov 24, 2016 2:05 am

Dear ystkueda,

Thanks for your information.
Here is sample code for your kind reference.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"..\..\sample document\sample.xlsx");
            //set the content on one page
            workbook.ConverterSetting.SheetFitToPage = true;
            workbook.SaveToFile("9068.pdf", FileFormat.PDF);

If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Nov 24, 2016 4:19 am

Thank you for your reply.

I tried but it was no good.

Code: Select all
Dim memStream1 As New System.IO.MemoryStream

    .
    .
    .


Dim Workbook As New Workbook()

Workbook.LoadFromStream(memStream1)
Workbook.ConverterSetting.SheetFitToPage = True

    .
    .
    .


Dim memStream2 As New System.IO.MemoryStream

Workbook.SaveToPdf(memStream2)


I set it up, but it prints on the second page.

ystkueda
 
Posts: 7
Joined: Mon Nov 21, 2016 5:58 am

Thu Nov 24, 2016 6:05 am

Dear ystkueda,

Thanks for the feedback.
Did you try the latest Spire.XLS Pack Hotfix Version:7.11.13 ? If the issue still exists with the version, please provide us following information for investigation.
1)sample file
2)entire code you were using

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Nov 24, 2016 7:06 am

Thank you for your reply.

Is there no application of the free version?

ystkueda
 
Posts: 7
Joined: Mon Nov 21, 2016 5:58 am

Thu Nov 24, 2016 7:26 am

Dear ystkueda,

Thanks for the reply.
So sorry that at present we don't have any plan to maintain/update free version.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Nov 29, 2016 12:05 am

Thank you for your reply

That's unfortunate

ystkueda
 
Posts: 7
Joined: Mon Nov 21, 2016 5:58 am

Tue Nov 29, 2016 1:48 am

Dear ystkueda,

So sorry for this.
Please feel free to contact us if there are other questions.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS