Excel to PDF - Aspose.Cells and Aspose.PDF - Cell(block) alignment issues

I use Aspose.Cells to generate a spreadsheet. As an additional feature users want to download the spreadsheet as a PDF and so chose to use Aspose.PDF to convert the generated excel to PDF. I decided on this after tryiong out Aspose.Cells PDF feature which didn't supported many of our needs and also had some formatting issues.

I have 2 issues when converting using Aspose.PDF and Aspose.Cells( 4.7.1.0).

1) All the Vertical Alignment properties from Excel is converted to "Bottom" in PDF. It just didn't preserved the vertical alignment of the spreadsheet. One point to note here is, I hand edited the intermediate XML to change all vertical alignments to Top and PDF generated perfect when using this XML.

2) The page layout of the excel is not converted to PDF properly. All my page margin settings were lost and the grid in PDF always align to left margin.

I cannot attach a sample spreadheet. But please find the code used below. It's nothing but plain conversion.

fileName = "fileName_" & System.DateTime.Now.Ticks().ToString() & ".xls"

serverpath = System.Configuration.ConfigurationSettings.AppSettings.Get("ReportOutput") & fileName

xlBook.Save(serverpath, FileFormatType.Default)

If PrintType = "PDF" Then

fileName = "fileName_" & System.DateTime.Now.Ticks().ToString() & ".xml"

serverpath = System.Configuration.ConfigurationSettings.AppSettings.Get("ReportOutput") & fileName

xlBook.Save(serverpath, FileFormatType.AsposePdf)

Dim licensePDF As Aspose.Pdf.License

licensePDF = New Aspose.Pdf.License()

licensePDF.SetLicense("Aspose.Pdf.lic")

Dim pdf As Aspose.Pdf.Pdf = Nothing

pdf = New Aspose.Pdf.Pdf

pdf.BindXML(serverpath , Nothing)

fileName = "fileName_" & System.DateTime.Now.Ticks().ToString() & ".pdf"

serverpath = System.Configuration.ConfigurationSettings.AppSettings.Get("ReportOutput") & fileName

pdf.Save(serverpath)

End If

Hi,

Please try the attached version v4.8.0.10. And, you may also use our direct conversion(excel to pdf) method without involving Aspose.Pdf, see the document for reference: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/converting-to-pdf-files.html Please let us know if it works fine.

If you still find the issue, I am afraid, we need your template file. I think you may post us via email (you can use some dummy data if you want). Please see the following steps to post us the template file via mail. See the steps mentioned below to send us the template file and we take your file with ultimate care(don’t worry about it):

1: click the Contact button in the Post.

2: In the drop down list options click "Send Amjad Sahi an Email”.

3: Attach the sample project and send it (you may zip the file prior attaching it).

4: Once you have done it, kindly confirm us on this thread.


Thank you.