Link on Table cell text

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v11)  /  Link on Table cell text

DynamicPDF CoreSuite for .NET (v11) Forum

 Jul 06 2021 9:05 AM
Hi Team,

I have requirement to generate multiple pdf files and that should be part of one folder.
I want to  add hyperlink on Table Cell text. That link should open an another PDF file from the same folder.

Ex:
Folder---
     ---MainFile.pdf
     --- File1.pdf
     --- File2.pdf
    --- File3.pdf
Here "MainFile.pdf" having list of file name(File1.pdf, File2.pdf etc..) as hyperlink in table row cell.
How I can achieve this?

Thanks,
Chandan Singh
 Jul 06 2021 12:35 PM
Posted by a ceTe Software moderator
Hi Chandan,

You can create PDFs and save them in a folder by specifying the file path. Please refer to the documentation on document output here.

You can also add a link to a table. You will need to use the Table2, Link, Label and AreaGroup page elements. You can set a UrlAction by specifying the required URL to a file. Please refer to the documentation on Link page element here and documentation on Table2 here.

Here is a code sample:

           Document document = new Document();
            Page page = new Page();
            document.Pages.Add(page);

            //Create Table...................
            Table2 tableA = new Table2(0, 0, 200, 600);
           
            // Add columns to the table
            tableA.Columns.Add(100);
          
            // Add rows to the table and add cells to the rows
            Row2 row1 = tableA.Rows.Add();
            Cell2 cellR1C1 = row1.Cells.Add("Main PDF");

            Row2 row2 = tableA.Rows.Add();
            AreaGroup grp = new AreaGroup(100,20);
            Label label1 = new Label("PDF 1", 0, 0, 100, 20);
            grp.Add(label1);
            UrlAction action1 = new UrlAction(@"file://C:/Temp/MyDocument.pdf");
            Link link = new Link(0, 0, 100, 20, action1);
            grp.Add(link);
            Cell2 cellR21C1 = row2.Cells.Add(grp);
        
            // Add the table to the page
            page.Elements.Add(tableA);

            // Save the PDF
            string pdfFilePath = @"C:\Temp\MyTable.pdf";
            document.Draw(pdfFilePath);

Feel free to download fully functional evaluation edition of DynamicPDF Core Suite for .NET product from NuGet (Package ID: ceTe.DynamicPDF.CoreSuite.NET) or from our website here.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 11:53 AM.