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