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.

Thu Oct 27, 2016 8:40 am

Hi,

I use Spire.xls to generate XLSX files and then convert them to PDF.
The produced XLSX is exactly like I want it to be and it includes cells with borders.
When converting to PDF, the borders are gone.

I'm using version v 7.11.1.7040 of Spire.XLS and v 3.8.27.7040 of Spire.PDF

My code :

Code: Select all
PdfConverterSettings PDFSettings = new PdfConverterSettings();
PDFSettings.EnableExcelPageBreak = true;
PDFSettings.DisplayGridLines = PdfConverterSettings.GridLinesDisplayStyle.Visible;

workbook.SaveToFile("xxx", PDFSettings);
workbook.Dispose();


Do I miss something ?

elm_77
 
Posts: 10
Joined: Mon Jun 20, 2016 10:15 am

Thu Oct 27, 2016 9:23 am

Hi elm_77,

Thanks for your inquiry.
The method you used to convert to PDF is old method, we suggest you try to use new method to convert to PDF.
http://www.e-iceblue.com/Tutorials/Spir ... o-PDF.html
If the issue still persists after trying new method, please provide us the sample document which you want to convert to PDF, and then we will look into it and update to you.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Thu Oct 27, 2016 2:21 pm

Hi Betsy,

With the method :
Code: Select all
workbook.SaveToFile("", Spire.Xls.FileFormat.PDF);


I now get the cells border
but I lose the Excel page break so part of my table is not visible.

elm_77
 
Posts: 10
Joined: Mon Jun 20, 2016 10:15 am

Fri Oct 28, 2016 2:36 am

Hi elm_77,

Thanks for your prompt response.
Sorry that I didn't reproduce the issues on my side, did you use following code to add page break ?
Code: Select all
workbook.Worksheets[0].HPageBreaks.Add(sheet.Range["A13"]);

Could you please provide us your sample code and sample file to help us reproduce your two issues( page break issue and border issue) ? And then we will investigate it and update to you.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Fri Oct 28, 2016 7:38 am

Hi Betsy,

I did not use
Code: Select all
workbook.Worksheets[0].HPageBreaks.Add(sheet.Range["A13"]);

for 2 reason :
- before using Spire, I was doing Excel Interop and the transformation to PDF was working as is
- I do not know in advance the size of my table so, except by counting lines, I wouldn't know where to put the page breaks.

Attached is a sample file (data has been replaced for confidentiality)

You will see that :
Code: Select all
PdfConverterSettings PDFSettings = new PdfConverterSettings();
PDFSettings.EnableExcelPageBreak = true;
PDFSettings.DisplayGridLines = PdfConverterSettings.GridLinesDisplayStyle.Visible;

workbook.SaveToFile("xxx", PDFSettings);
workbook.Dispose();
produces a PDF with correct page splitting but no cell borders

while
Code: Select all
workbook.SaveToFile("", Spire.Xls.FileFormat.PDF);
produces a PDF with cell borders but not splitted
Attachments
da4a5e7f-dcc0-4aab-bfee-93b879645f06.zip
(18.96 KiB) Downloaded 313 times

elm_77
 
Posts: 10
Joined: Mon Jun 20, 2016 10:15 am

Fri Oct 28, 2016 7:59 am

Hi elm_77,

Thanks for your detailed information.
I have tested the file you provided with new method and Spire.XLS Pack Hotfix Version:7.11.1. The result document doesn't have the issue you mentioned, please try to use the new method SaveToFile() and the version I mentioned. Also, I have attachment for your reference.

Sincerely,
Betsy
E-iceblue support team
Attachments
8942.zip
(94.89 KiB) Downloaded 299 times
User avatar

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

Fri Oct 28, 2016 1:08 pm

With this code :
Code: Select all
using Spire.Xls;
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String SourceFile = @"D:\Temp\da4a5e7f-dcc0-4aab-bfee-93b879645f06.xlsx";
            String OutputFile = @"D:\Temp\output.pdf";

            Workbook workbook = new Workbook();
            workbook.LoadFromFile(SourceFile, ExcelVersion.Version2013);
            workbook.SaveToFile(OutputFile, Spire.Xls.FileFormat.PDF);
        }
    }
}



and the file I sent you earlier, I get this wrong PDF.
I use the latest version available on Nuget (7.11.1)
Attachments
output.zip
(72.6 KiB) Downloaded 312 times

elm_77
 
Posts: 10
Joined: Mon Jun 20, 2016 10:15 am

Mon Oct 31, 2016 2:26 am

Hi elm_77,

Thanks for your detailed information and sorry for late reply as weekend.
By investigation, I have noticed the issue and posted it to our Dev team. We will inform you when it is fixed.
We apologize for the inconvenience.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Mon Oct 31, 2016 7:10 am

Thanks Betsy,
I'll continue without borders in the meantime

elm_77
 
Posts: 10
Joined: Mon Jun 20, 2016 10:15 am

Wed Nov 09, 2016 7:48 am

Hi elm_77,

Thanks for your waiting.
Now the page break issue has been resolved in Spire.XLS Pack Hotfix Version:7.11.13, welcome to test it.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Thu Nov 17, 2016 9:36 am

Thanks Betsy

I try ASAP.

Edit : Problem is solved. Thanks for the support

elm_77
 
Posts: 10
Joined: Mon Jun 20, 2016 10:15 am

Fri Nov 18, 2016 1:19 am

Hi elm_77,

Thanks for the feedback.
Welcome to write to us for further question. We are here for help.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Return to Spire.XLS