Hello Dear Devs I have an issue while converting xlsx file to pdf; the hyperlinks are not preserved / do not exist on the pdf (ps: they exist in the xlsx file)
here is the conversion function =>
Private Function ExportExcelToPdf(localFile As String, convertToPDF As Boolean) As String
If convertToPDF Then
Try
Dim workbook As New Telerik.Windows.Documents.Spreadsheet.Model.Workbook()
Dim xlsxProvider As New Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider()
Using input As New FileStream(localFile, FileMode.Open, FileAccess.Read)
workbook = xlsxProvider.Import(input)
End Using
'Dim worksheet As Telerik.Windows.Documents.Spreadsheet.Model.Worksheet = workbook.ActiveWorksheet
Dim pdfProvider As New Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.PdfFormatProvider()
Dim pdfFilePath As String = System.IO.Path.GetTempPath() & Guid.NewGuid().ToString() & ".pdf"
Using output As New FileStream(pdfFilePath, FileMode.Create, FileAccess.Write)
pdfProvider.Export(Workbook, output)
End Using
localFile = pdfFilePath
Return localFile
Catch ex As Exception
Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(ex).Throw()
Finally
' Release resources if needed
End Try
Else
Return localFile
End If
End Function
any idea why or any open source alternative (the company has only the telerik license)
i tried NPOI to read xlsx file and convert using pdfSarp but it do not conserve the xlsx formating pageSetup …
I would really appriciate any help
Thank you
Telerik
NOIP/PdfSharp
Adonis Aflek is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.