Font background problem when using HTML import


#1

hi,

I am not able to render the background for font in Pdf with DocumentBuilder.InsertHTML() function.But i am able to render the background in word with DocumentBuilder.InsertHTML() function using tag instead of tag.

could u please help me to get the problem solved in pdf. i want the pdf output file to be like word file.

here with i am forwarding the code for your reference and attaching the screen shots for word and pdf.

Private Sub BindHTML(ByVal builder As Aspose.Words.DocumentBuilder, ByVal Content As String)

Dim intCount As Integer

Dim strValue As String

Dim flag As Integer

Dim strB As New StringBuilder

Dim count As Integer = 0

Content = Content.Replace(" ", "  ")

Dim _CurrentNode As Aspose.Words.Node = builder.CurrentParagraph

If Content.IndexOf("<") > -1 And Content.IndexOf(">") > -1 Then

If Content.IndexOf("FONT color=#") > -1 Or Content.IndexOf("font color=#") > -1 Then

Content = Content

End If

If Content.IndexOf("font color=") > -1 Or Content.IndexOf("FONT color=") > -1 Or Content.IndexOf("color=") > -1 Then

Content = Content.Replace("color=", "color=#")

End If

Dim arr() As String = Content.Split(">")

Dim intCheck(arr.Length) As Integer

For intCount = 0 To arr.Length - 1

arr(intCount) = arr(intCount) + ">"

If arr(intCount).IndexOf("FONT") > -1 And arr(intCount).IndexOf("color") > -1 Then

count = count + 1

intCheck(count) = 0

End If

If arr(intCount).IndexOf("FONT") > -1 And arr(intCount).IndexOf("style") > -1 Then

strValue = arr(intCount)

strValue = Replace(strValue, "FONT", "SPAN")

arr(intCount) = strValue

count = count + 1

intCheck(count) = 1

End If

If arr(intCount).IndexOf("") > -1 Then

If intCheck(count) = 1 Then

strValue = arr(intCount)

strValue = Replace(strValue, "", "")

arr(intCount) = strValue

End If

If (count <= 0) Then

count = 0

Else

count = count - 1

End If

End If

Next

For intCount = 0 To arr.Length - 2

strB.Append(arr(intCount))

Next

Content = strB.ToString()

Content = Content.Replace("=##", "=#")

Try

If (Content.IndexOf("= 0) Then

Content = Content.Replace("

", block)

Content = Content.Replace("

", "")

Content = Content.Replace("

", "")

Content = Content.Replace("

", "
")

Content = Content.Replace("

", "")

End If

builder.InsertHtml(Content)

Catch ex As System.FormatException

Content = Content.Replace("0in", "0pt")

builder.InsertHtml(Content)

End Try

Else

builder.Write(System.Web.HttpUtility.HtmlDecode(Content))

End If

Do While (Not _CurrentNode Is Nothing)

If _CurrentNode.NodeType = NodeType.Paragraph Then

With CType(_CurrentNode, Aspose.Words.Paragraph)

.ParagraphFormat.SpaceAfterAuto = False

.ParagraphFormat.SpaceAfter = 0

Call ChangeFont(.Runs)

End With

End If

_CurrentNode = _CurrentNode.NextSibling

Loop

End Sub

Pls Send me the reply as early as possible.

Thanks and Regards,

I Prabhaharan


#2

Font highlighting is not supported during PDF export. See

http://www.aspose.com/Products/Aspose.Words/Aspose.Words.Converters.xls

for full list of conversion capabilities and limitations.

Best regards,


#3

Background color is supported at Text level in Aspose.Pdf. We will support it at segment level next month.


#4

We will probably add support for it in Aspose.Words too by the time of our next release in a few weeks. I have logged this feature request to our defect base as issue #1248.

Best regards,