We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hyperlink in table cell

I have tried the suggestions on these two pages:

- https://forum.aspose.com/t/94985
- http://www.aspose.com/docs/display/pdfnet/Working+with+Hyperlinks+%28Generator%29

However, I am still having problems generating hyperlinks. The text is displayed as expected.

Code as follows (where row is an instance of Aspose.Pdf.Generator.Row):

Aspose.Pdf.Generator.Cell cell = row.Cells.Add();
Aspose.Pdf.Generator.Text cellText = new Text();
Aspose.Pdf.Generator.Segment segment = cellText.Segments.Add("Test text");
segment.Hyperlink = new Aspose.Pdf.Generator.Hyperlink();
segment.Hyperlink.LinkType = HyperlinkType.Web;
segment.Hyperlink.Url = "http://www.aspose.com/";


Thanks for your advice.

Hi there,

Thanks for your inquriy. Please note you are using old generator(Aspose.Pdf.Generator), it is recommended to use new generator(Aspose.Pdf). New generator is more efficient and improved. Furthermore, we are not fixing issues and making any improvement in old generator as it will be obsolete in near future.

In reference to your requirement, please check following code snippet for adding hyperlink in a table cell using new generator.

cell = row.Cells.Add();<o:p></o:p>

cell.BackgroundColor = Aspose.Pdf.Color.Yellow;<o:p></o:p>

// Create Text Fragment instance<o:p></o:p>

text = new Aspose.Pdf.Text.TextFragment(“Aspose

// Create local hyperlink instance<o:p></o:p>

link = new Aspose.Pdf.WebHyperlink();<o:p></o:p>

// Set target page for link instance<o:p></o:p>

link.Url = “http://www.aspose.com/”;<o:p></o:p>

// Set TextFragment hyperlink<o:p></o:p>

text.Hyperlink = link;<o:p></o:p>


Please feel free to contact us for any further assistance.

Best Regards,

Hi team,

I am still facing the same issue.
Below is my code sample:

Everything is derived from Aspose.Pdf.Generator
and link is Aspose.Pdf.Generator.Hyperlink

Cell newCell = row.Cells.Add();
newCell.IsNoBorder = true;
Text text = new Text();

        Segment sg = new Segment();
        sg.Hyperlink = link;


Can you please help? Quick response is much appreciated!


Thanks for your inquiry.

I am afraid that you are using quite older approach i.e. Aspose.Pdf.Generator, which has been discontinued. It is now recommended to use new DOM (Aspose.Pdf) model and related code has already been shared in this thread.

Please try using already shared code snippet and in case you still face any issue, please share complete sample code snippet you have tried along with sample PDF document. We will test the scenario in our environment and address it accordingly.