Link in Table Cell

Link in Table Cell

Forum member · Jul 24, 2012
I am trying to figure out how to build Link objects and add them to AreaGroup then add the AreaGroup to the cell of the Table2.

Re: Link in Table Cell

Support · Jul 24, 2012
Hello, Yes, you can add links to the cell of the Table2 page element without any problem using our DynamicPDF Generator for .NET product. Below is the sample code for it. // Create a PDF Document Document document = new Document(); // Create a Page and add it to the document Page page = new Page(); document.Pages.Add(page); Table2 table = new Table2(0, 0, 400, 400); table.CellDefault.Border.Color = RgbColor.Blue; table.CellDefault.Border.LineStyle = LineStyle.Solid; table.CellDefault.Padding.Value = 3.0f; // Add columns to the table table.Columns.Add(90); table.Columns.Add(150); // The first row is used as a table heading Row2 row1 = table.Rows.Add(20, Font.HelveticaBold, 14, RgbColor.Black, RgbColor.Gray); row1.CellDefault.Align = TextAlign.Center; row1.CellDefault.VAlign = VAlign.Center; row1.Cells.Add("Page Element", 3); // The second row is the column headings Row2 row2 = table.Rows.Add(Font.HelveticaBoldOblique, 12); row2.CellDefault.Align = TextAlign.Center; row2.Cells.Add("Name"); row2.Cells.Add("Element"); Row2 row3 = table.Rows.Add(Font.Helvetica,12); row3.CellDefault.Align = TextAlign.Center; row3.Cells.Add("Link"); //Build Link page element. Label linkLabel = new Label("DynamicPDF", 0, 0, 100, 20); linkLabel.TextColor = RgbColor.Blue; UrlAction action = new UrlAction(@"http://www.dynamicpdf.com"); Link link = new Link(0, 0, 100, 20, action); //Create AreaGroup. AreaGroup group = new AreaGroup(100, 20); group.Add(linkLabel); group.Add(link); //Add AreaGroup to the cell of the Table2 row3.Cells.Add(group); // Add the table to the page page.Elements.Add(table); // Save the PDF document.Draw(@"C:\MyDocument.pdf"); Thanks, ceTe Software Support Team.

Re: Link in Table Cell

Forum member · Jul 24, 2012
Many thanks. That was exactly what I was trying to accomplish.