hi,
i am not able to render the table using DocumentBuilder.InsertHTML() in word file as well as pdf file. i am using the latest dll (Word- Version 4.0.2.0 and PDF – Version 3.2.2.0). But stil my table rendering problem is not Solved. i have sent so many mails regarding this issue. And i got the reply from u saying that it is fixed in latest dll. But when i use latest dll, there is no change in word file as well as pdf file. There are other issues related to table
-
Table is shrinking in word file.
-
Table border color is not rendered in both word as well as pdf.
So pls give me a solution ASAP because i have to answer to the client regarding this issue.I am also sending the code and screenshots of word and pdf file which should match according to the HTML view.
With the following function i am trying to render the HTML using InsertHTML() for word.
Private Sub BindHTML(ByVal builder As Aspose.Words.DocumentBuilder, ByVal Content As String)
Content = Content.Replace(" ", " ")
Dim \_CurrentNode As Aspose.Words.Node = builder.CurrentParagraph
If Content.IndexOf("<") > -1 And Content.IndexOf(">") > -1 Then
builder.InsertHtml(Content)
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
------------------------------------------------------
Following is the HTML code used for both word as well as pdf .
Lakshmi |
Chaya |
SharadaChaya |
---|---|---|
Chaya |
Sharada |
LakshmiChayaChaya |
Sharada |
Lakshmi | Chaya |
____________________________________________________
With the following function i am trying to render the HTML using InsertHTML() for pdf.
Private Sub BindHTML(ByVal Content As String, ByVal currentNode As Aspose.Pdf.Cell)
Dim text As Aspose.Pdf.Text
If currentNode.Paragraphs.Count > 0 Then
text = currentNode.Paragraphs(0)
Else
Exit Sub
End If
Content = Content.Replace(" ", " ")
If Content.IndexOf("<") > -1 And Content.IndexOf(">") > -1 Then
If text.Segments.Count = 1 Then
If text.Segments(0).Content Is Nothing Then
text.Segments.RemoveAt(0)
End If
End If
Dim doc As New Aspose.Words.Document
Dim builder As New Aspose.Words.DocumentBuilder(doc)
builder.InsertHtml(Content)
builder.CurrentParagraph.ParagraphFormat.SpaceAfterAuto = False
builder.CurrentParagraph.ParagraphFormat.SpaceAfter = 0
Dim ObjMemoryStream As New System.IO.MemoryStream
doc.Save(ObjMemoryStream, Aspose.Words.SaveFormat.FormatAsposePdf)
Dim tmpPDF As New Aspose.Pdf.Pdf
tmpPDF.BindXML(ObjMemoryStream, Nothing)
ObjMemoryStream.Close()
Dim intSection, intParagraph As Int16
Dim _Paragraph As Aspose.Pdf.Paragraph
For intSection = 0 To tmpPDF.Sections.Count - 1
For intParagraph = 0 To tmpPDF.Sections(intSection).Paragraphs.Count - 1
_Paragraph = tmpPDF.Sections(intSection).Paragraphs(intParagraph)
If TypeOf \_Paragraph Is Aspose.Pdf.Text Then
Call ChangeFont(CType(\_Paragraph, Aspose.Pdf.Text).Segments, text.TextInfo.IsTrueTypeFontBold)
End If
currentNode.Paragraphs.Add(\_Paragraph)
Next intParagraph
Next intSection
Else
Dim _Segment As Aspose.Pdf.Segment = GetSegment(HttpUtility.HtmlDecode(Content))
If text.TextInfo.IsTrueTypeFontBold Then
_Segment.TextInfo.IsTrueTypeFontBold = True
End If
text.Segments.Add(\_Segment)
End If
End Sub
With regards,
I Prabhaharan