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.

Fri Feb 01, 2019 10:32 pm

I am currently testing the free version of the Spire.XLS for .NET to see if it suits my companies needs.

I have noticed that if the source XLS file has many columns, the .PDF file that gets created isn't laid out the same way. The first few columns show up in one page, and then further down, the next X # of columns will appear (column wrapping?).

JBLExcelScreenSHOt.JPG
JBLExcelScreenSHOt.JPG (134.39 KiB) Viewed 4962 times

JBLPDFlScreenShot.JPG
JBLPDFlScreenShot.JPG (50.89 KiB) Viewed 4962 times


Is this a limitation of the free version or is this how your products deals with Excel documents that have many columns ?

l.levine@qsource.com
 
Posts: 6
Joined: Fri Feb 01, 2019 4:40 pm

Sat Feb 02, 2019 5:48 am

Hello,

Thanks for your interests in our product.
This is not a limitation of free version. Our free version is limited to 5 sheets per workbook and 150 rows per sheet while reading or writing Excel file, when converting an Excel file to a PDF file, you only can get the first 3 pages of PDF file, and printing doesn't be supported in our free version. Regarding your case, please try the following code. If there is still any issue after testing, please provide your Excel file to help us further investigate.
Code: Select all
 Workbook workbook = new Workbook();
 workbook.LoadFromFile(@"test.xlsx", ExcelVersion.Version2013);
 for (int i = 0; i < workbook.Worksheets.Count; i++)
 {
     workbook.Worksheets[i].PageSetup.IsFitToPage = true;
 }
 workbook.SaveToFile(@"result.pdf", Spire.Xls.FileFormat.PDF);

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Mon Feb 04, 2019 5:07 pm

Here is a Excel file, that once converted into a .pdf file , is "wrapped".

Is it possible to use your product to convert specific worksheets that make up a spreadsheet ?

Thanks !
Attachments
JBC Tools.zip
(69.68 KiB) Downloaded 232 times

l.levine@qsource.com
 
Posts: 6
Joined: Fri Feb 01, 2019 4:40 pm

Tue Feb 05, 2019 8:29 am

Hi,

Thanks for your file.
After testing your case with the latest Spire.XLS Pack(Hotfix) Version:9.1.22 and below code, everything worked find on my side. Attached are the result file. Please have a check.
Code: Select all
            Workbook workbook = new Workbook();
            workbook.LoadFromFile(@"E:\JBC Tools.xlsx");
            for (int i = 0; i < workbook.Worksheets.Count; i++)
            {
                //fit to one page width
                workbook.Worksheets[i].PageSetup.FitToPagesWide = 1;
                workbook.Worksheets[i].PageSetup.FitToPagesTall = 0;
               //this method would save the specific worksheet to pdf
                workbook.Worksheets[i].SaveToPdf("16376 page" + i.ToString() + ".pdf");
            }
Attachments
Result file.zip
(115.17 KiB) Downloaded 269 times
User avatar

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

Tue Feb 05, 2019 10:00 pm

This works nicely. I see that the patch is only provided for .NET up to 4.6.

I am using .NET 4.7. Does it matter if I use the 4.6 version of your patch ?

l.levine@qsource.com
 
Posts: 6
Joined: Fri Feb 01, 2019 4:40 pm

Wed Feb 06, 2019 2:36 am

Hi,

Thanks for your feedback.
Yes, there is no .NET 4.7 dlls. But it doesn't matter to use the Spire dlls in framework 4.7.
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

Wed Feb 06, 2019 6:18 pm

Thank you for this information.

I am trying to integrate your software into my project, but I am now getting an error when I try to convert a Word document to a .PDF formatted one.

The error I am receiving is this:

E_ICEBLUE Error message.JPG
E_ICEBLUE Error message.JPG (26.39 KiB) Viewed 4910 times

l.levine@qsource.com
 
Posts: 6
Joined: Fri Feb 01, 2019 4:40 pm

Wed Feb 06, 2019 7:04 pm

I've also noticed that if an Excel column isn't the correct width, Spire word wraps the contents of this column instead auto adjusting the width of the column.

I've attached a Excel document for you to test with. Please look at the Price By Part Number worksheet, columns B, rows 6-10.

If you look a the .pdf document after Spire converts it, you'll see the data is word wrapped.

Is it possible to have Spire auto adjust the column width so the data isn't wrapped ?

Thanks for all your help !
Attachments
Chemtronics.zip
(322.23 KiB) Downloaded 277 times

l.levine@qsource.com
 
Posts: 6
Joined: Fri Feb 01, 2019 4:40 pm

Thu Feb 07, 2019 6:48 am

Hello,

As for the error, please remove all old Spire dlls in your application and reference the ones from the latest Spire.Doc Pack(hot fix) Version:7.1.19 to convert a word document to a PDF file. And if you want to use Spire.Doc and Spire.XLS in the same project, you need to download Spire.Office Platinum (DLL Only) Version:4.1.4 and then reference corresponding dlls from it to avoid the incompatibility.
Besides, please add the following code snippet to adjust the width of the columns automatically. If there is any questions, just feel free to come back.
Code: Select all
......
     //adjust the width of column B automatically
     workbook.Worksheets[i].Columns[1].AutoFitColumns();
......


Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu Feb 07, 2019 2:50 pm

Thank you for your response.

Without knowing the layout of the source file, is it possible to use this line of code
workbook.Worksheets[i].Columns[1].AutoFitColumns();

Globally across all columns, and do you have this line of code before the .SaveToPdf call ?

l.levine@qsource.com
 
Posts: 6
Joined: Fri Feb 01, 2019 4:40 pm

Fri Feb 08, 2019 5:08 am

Hello,

This is Jane. Thank you for your post.
Plase refer to the code below.
Code: Select all
workbook.Worksheets[i].AllocatedRange.AutoFitColumns();


Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Feb 18, 2019 9:34 am

Hi,

Greetings from e-iceblue!
Has your issue been resolved?
Your feedback would be greatly appreciated!

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.XLS