Hello,
I am trying to use the Aspose.Words_17_1_0 version to have the RTF data coming into my report convert to HTML (making the textbox placeholder HTML), and certain things will not render in the report viewer.
Converting RTF to an HTML “file” works just fine and display great in a browser, but the HTML tags it creates does not work for reporting services.
Two main things that do not work in SSRS are italics are underlines. Instead of and tags, your conversion is instead producing span tags, like this:
This sentence should be italic.
Am I using the wrong product?
Here is the code I am using to convert the RTF to HTML.
SSRS Textbox Expression:
=code.AsposeConvertRTFtoHTML(Fields!rtf_data.Value)
Report Code Behind
Public Function AsposeConvertRTFtoHTML(ByVal mRTFData as String) As String
Dim mHTML As Byte() = Convert.FromBase64String(MyDLL.MyClass.AsposeConvertRTFtoHTMLBase64String(mRTFData))
AsposeConvertRTFtoHTML = System.Text.Encoding.UTF8.GetString(mHTML, 0, mHTML.Length)
Dim mFixHTML as string = AsposeConvertRTFtoHTML.Replace(" ", " ")
AsposeConvertRTFtoHTML = mFixHTML
Return AsposeConvertRTFtoHTML
End Function
The Function that I call in my signed DLL that calls Aspose.Words
Public Class MyClass
Public Shared Function AsposeConvertRTFtoHTMLBase64String(ByVal rtfString As String) As String
AsposeConvertRTFtoHTMLBase64String = Nothing
Try
Dim mMS As New System.IO.MemoryStream
Dim mMS2 As New System.IO.MemoryStream
Dim enc As New System.Text.UTF8Encoding
Dim arByteData() As Byte = enc.GetBytes(rtfString)
mMS.Write(arByteData, 0, arByteData.Length)
Dim doc As New Aspose.Words.Document(mMS)
doc.Save(mMS2, Aspose.Words.SaveFormat.Html)
Dim result As String = Convert.ToBase64String(mMS2.ToArray())
AsposeConvertRTFtoHTMLBase64String = result
Return AsposeConvertRTFtoHTMLBase64String
Catch ex As Exception
End Try
End Function
End Class
I have attached 3 files. The 1st is a test of my Function that displays the results in a web browser control, which looks fine. The 2nd is what it looks like in my reporting services. The 3rd is the entire rendered HTML file.
webbrowser.jpg
ssrs.jpg
FromDatabaseToFile.txt
Thank you in advance!
James Moore