Rich Text Box not appearing properly in pdf reports

I have been using Aspose.pdf Developer Enterprise Subscription for a while and my client likes it very much.

Now the client has asked me to add few rich text boxes in the form level and it is stored in the database as nvarchar(1000).

This new field is appearing properly in the form level, or when I export the data into a excel document from the datagrid.

But unfortunately, when I create the PDF document, these fields are printed with tags which is not accepatable by the client.

For eg. aspose.pdf is stored in the DB as aspose.pdf . Hence it is printed as aspose.pdf in the pdf report. Client expects it be as aspose.pdf.

Could you please suggest a way to overcome this problem?

Even writing it as "aspose.pdf" would be better than displaying with the tags.

Current project is for a small part of the business, but successfull implemental of it will really bring more gloabl customers to aspose.pdf

Thanks in Advance. I'm really seeking for help.

Please refer to [How to Display HTML in Text ](https://forum.aspose.com/Wiki/default.aspx/Aspose.Pdf/HowToDisplayHTML.html) and [Working with Text Containing HTML Tags ](https://forum.aspose.com/wiki/default.aspx/Aspose.Pdf/TextContainingHtmlTags.html).

thanks for the reply .But I cant find a propery ISHTMLTagSupported under TextInfo.

I'm using the following code (looping for all records ). Basically I am printing the header first (fixed columns) and looping through the records to print each row. You can suggest an alternat methade as well.

Private Sub AddRow(ByVal pdf As Pdf, ByVal tabel As Table, _

ByVal strRichTextBox As String , byval strIssue as string ......)

Dim section As Section = pdf.Sections(0)

Dim tf1 As Aspose.Pdf.TextInfo = New Aspose.Pdf.TextInfo

tf1.FontSize = 16

tf1.Alignment = AlignmentType.Center

Dim row1DetailTable As Row = tabel.Rows.Add()

tf1.Alignment = AlignmentType.Left

row1DetailTable.Cells.Add(strRichTextBox, tf1)

End Sub

I guess you are using an old version in which the IsHtmlTagSupported property is not included. If so please update to the latest version.

Thanks for the immediate reply.

I have downloaded the latest aspose.pdf.dll from

and replaced the reference to it.

Dim section As Section = pdf.Sections(0)

Dim tf1 As Aspose.Pdf.TextInfo = New Aspose.Pdf.TextInfo

I expect IsHtml property to be apperated under tf1 (which is pdf.textinfo) but is not coming out.

could you please help? Is this propery only available with aspose.text class?

If so, could you help convert code mentioned above to work the same way using Text class.

thanks in advance.

Please refer to the example at Add Text to PDF using C#|Aspose.PDF for .NET.

The HtmlFragment is a Class of Aspose.Pdf.Text that can be used to add HTML String inside a Table Cell.

I have tried your work aound. But I'm unable to add a text to row. See the underlined part.

Could you please help.

Private Sub AddRow(ByVal pdf As Pdf, ByVal tabel As Table, _

ByVal strRichTextBox As String , byval strIssue as string ......)

Dim section As Section = pdf.Sections(0)

Dim tf1 As Aspose.Pdf.TextInfo = New Aspose.Pdf.TextInfo

tf1.FontSize = 16

tf1.Alignment = AlignmentType.Center

Dim row1DetailTable As Row = tabel.Rows.Add()

Dim text As Aspose.Pdf.Text = New Aspose.Pdf.Text

text.IsHtmlTagSupported = True

row1DetailTable.Cells.Add(strRichTextBox,text )

End Sub

Thanks for considering Aspose.

I found the content you want to add into table is stored in strRichTextBox, so you codes should be like this:

Private Sub AddRow(ByVal pdf As Pdf, ByVal tabel As Table, _

ByVal strRichTextBox As String , byval strIssue as string ......)

Dim section As Section = pdf.Sections(0)

Dim row1DetailTable As Row = tabel.Rows.Add()

'Following codes are modified by Kevin.Zuo

Dim cell As Cell = row1DetailTable .Cells.Add()

Dim text As Aspose.Pdf.Text = New Aspose.Pdf.Text (strRichTextBox)

text.IsHtmlTagSupported = True

text.TextInfo.FontSize = 16

text.TextInfo.Alignment = AlignmentType.Center

cell.Paragraphs.Add(text)

End Sub

Thanks for the reply. I have tried the modified code.

But the statement row1DetailTable.Cells.Add(text )

is not working becasues aspose.pdf.text is not a parameter for row1DetailTable.Cells.Add

Please help

thanks in advance

Dear bobby

Sorry for the mistake made before.

I just adjusted the codes above and added new two lines which are in bold.

Regards,