Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Dec 17, 2020 8:19 pm

Hi, I'm new here.
I loved so much your products.
please I have a small problem I created an .Xlsx file, and I converted it to PDF using
Code: Select all
workbook.SaveToFile( Environment.GetFolderPath( Environment.SpecialFolder.Desktop ) + "\\MyFile.pdf" , Spire.Xls.FileFormat.PDF );

everything is great, but the content not centered Horizontally, please how can I set the content in centered alignment ?
massive thanks

MbarkT3sto
 
Posts: 9
Joined: Thu Dec 17, 2020 8:13 pm

Fri Dec 18, 2020 2:12 am

Hello,

Thanks for your inquiry!

Please refer to the following code to set the content in centered alignment.

Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile("newWork.xlsx");
           
            foreach(Worksheet sheet in workbook.Worksheets)
            {
                //set centered alignment
                sheet.PageSetup.CenterHorizontally = true;
                sheet.PageSetup.CenterVertically = true;
            }

            workbook.SaveToFile("newWork.pdf", FileFormat.PDF);


If you have any other questions, please feel free to contact us.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Fri Dec 18, 2020 6:02 am

Really I appreciate this, It works.
Massive thanks

MbarkT3sto
 
Posts: 9
Joined: Thu Dec 17, 2020 8:13 pm

Fri Dec 18, 2020 8:49 am

Hello,

Thanks for your prompt reply!

Glad to hear that the issue has been solved.

If you encounter any issues related to our product in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF