v10.0.0.0
when i save the attached as a pdf i get
“Unexpected underline type.”
thanks,
Hi Tom,
Thanks for your inquiry.
I cannot reproduce the issue using the latest verison of Aspose.Words (10.1.0). You can download it from here.
Thanks,
i upgraded to 10.1.0 and still get this when saving as .pdf AND as .tif. it works saving as doc.
Unexpected underline type.
if i save the doc as a .doc then reopen and save it as .pdf or .tif the doc will save but the underline is gone.
Hi Tom,
Thank you for additional information. I also tried converting your document to PDF using Aspose.Words for .NET (10.1.0), and still no problems on my side.
I use this code for testing:
Document doc = new Document("a1.pdf.doc");
doc.Save("out.pdf");
Best regards,
if i save it 1st (which i have to, to send it to you) then reopen it it works. except at my end the underline is gone.
here is my code so you can see that i’m using builder in cloned table cells.
Private Sub FillPTable(ByVal dict As FillItems, ByVal rvs As PReview.PReviewItemCollection, ByVal bookmark As Aspose.Words.Bookmark, ByVal doc As Aspose.Words.Document)
rvs.SortByDOS()
Dim tbl As Aspose.Words.Tables.Table = getTable(bookmark.Name, doc)
'todo this assume a 1 row header
Dim templRowsAt As New List(Of Integer)
Dim templRows As New List(Of Aspose.Words.Tables.Row)
For i As Integer = 1 To tbl.Rows.Count - 1
Dim r As Aspose.Words.Tables.Row = tbl.Rows(i)
templRowsAt.Add(i)
templRows.Add(CType(r.Clone(True), Aspose.Words.Tables.Row))
Next
For Each rv As PReview.PReviewItem In rvs
For Each rr As Aspose.Words.Tables.Row In templRows
Dim newRow As Aspose.Words.Tables.Row = CType(rr.Clone(False), Aspose.Words.Tables.Row)
For Each c As Aspose.Words.Tables.Cell In rr
Dim newCell As Aspose.Words.Tables.Cell = CType(c.Clone(False), Aspose.Words.Tables.Cell)
Dim para As New Aspose.Words.Paragraph(doc)
newCell.AppendChild(para)
newRow.AppendChild(newCell)
Dim txtCmd As String = c.ToTxt
Dim txt As String = FillValues(txtCmd, dict, rv)
Dim txts() As String = System.Text.RegularExpressions.Regex.Split(txt, "(?=\<)|(?<=\>)")
Dim b As New Aspose.Words.DocumentBuilder(doc)
b.MoveTo(para)
Dim curFont As Aspose.Words.Font = Nothing
For Each t As String In txts
Select Case t.ToUpper
Case "<br />".ToUpper
b.Writeln()
Case "<b>".ToUpper
b.Font.Bold = True
Case "</b>".ToUpper
b.Font.Bold = False
Case "<u>".ToUpper
b.Font.Underline = True
Case "</u>".ToUpper
b.Font.Underline = False
Case "<font color='white'>".ToUpper
curFont = b.Font
b.Font.Color = Drawing.Color.White
Case "<font color='blue'>".ToUpper
curFont = b.Font
b.Font.Color = Drawing.Color.Blue
Case "</font>".ToUpper
b.Font.Color = curFont.Color
Case Else
b.Write(t)
End Select
Next
Next
tbl.Rows.Add(newRow)
Next
Next
For Each at As Integer In templRowsAt
tbl.Rows.RemoveAt(at)
Next
End Sub
if was
b.Font.Underline = True
instead of
b.Font.Underline = single
Hi
Thank you for additional information. Please try using the following line of code:
builder.Font.Underline = Underline.Single
https://reference.aspose.com/words/net/aspose.words/font/underline/
Best regards,
Hi there,
Also note you maybe able to simplify your code by using the DocumentBuilder.InsertHtml method if you have not already tried using this.
Thanks,
perfect, i didn’t see that method. Thanks