How/Can i insert a hyperlink to web page within table cell?


#1

Tried various ways in vb.net but can work it out.

Any help appreciated !

I have been trying a long these lines but wont work, just the last line that doesnt work when im trying to insert it into the cell

myPDF.Sections.Add()

Dim section2 As Section = myPDF.Sections(1)

Dim text2 As Text = New Text(section2)

section2.Paragraphs.Add(text2)

Dim segment2 As Segment = text2.Segments.Add("this is a web link")

segment2.Hyperlink = New Hyperlink

segment2.Hyperlink.Url = "http://localhost/popup.htm"

segment2.Hyperlink.LinkType = HyperlinkType.Web

Dim cell3Row2SummaryTable As Cell

cell3Row2SummaryTable.Paragraphs.Add(section2.Paragraphs(0))


#2

Hi,

Thank you for considering Aspose.

You have added the text object into the section and then added it into cell again which is not allowed. Please look at the following code:

Dim myPDF As Pdf = New Pdf
myPDF.Sections.Add()
Dim section2 As Section = myPDF.Sections(0)
Dim text2 As Text = New Text(section2)
'section2.Paragraphs.Add(text2)

Dim segment2 As Segment = text2.Segments.Add("this is a web link")
segment2.Hyperlink = New Hyperlink
segment2.Hyperlink.Url = "http://localhost/popup.htm"
segment2.Hyperlink.LinkType = HyperlinkType.Web

Dim summaryTable As Table = New Table
section2.Paragraphs.Add(summaryTable)
summaryTable.ColumnWidths = "120"
summaryTable.DefaultCellBorder = New BorderInfo(BorderSide.All)
Dim row1SummaryTable As Row = summaryTable.Rows.Add
Dim cell3Row2SummaryTable As Cell = row1SummaryTable.Cells.Add
cell3Row2SummaryTable.Paragraphs.Add(text2)

myPDF.Save("d:/test/test.pdf")