Strikethough in table cell text

Strikethough in table cell text

Forum member · Aug 24, 2021
Hi Team, I have requirement to apply strikethrough in table cell text. Even cell text is more than table column width then it need to wrap text in multiple line and apply strikethrough on that. Please help me to achieve the same. Thanks, Chandan Singh

Re: Strikethough in table cell text

Support · Aug 24, 2021
Hello Chandan, You may want to use formatted text by adding strike through tag and add it to the cell of the table using HtmlArea page element. Please note that once you add a page element to a cell then that respective cell becomes non splitable and you will need to handle content splitting across pages. Please refer to the documentation on adding page elements to cell at: https://www.dynamicpdf.com/docs/dotnet/dynamic-pdf-adding-page-elements-to-cells Here is a code sample. // Create a PDF Document Document document = new Document(); Page page = new Page(); document.Pages.Add(page); Table2 table = new Table2(0, 0, 400, 400); // Add columns to the table table.Columns.Add(90); table.Columns.Add(150); string html="<p style=\"text-decoration: line-through;\">Strikethrough text for testing in table cell</p>"; HtmlArea area = new HtmlArea(html, 0, 0, 150, 30); Row2 row1 = table.Rows.Add(); row1.Cells.Add("HtmlArea"); row1.Cells.Add(area); // The second row is the column headings Row2 row2 = table.Rows.Add(); row2.Cells.Add("Item1"); row2.Cells.Add("Item2"); // Add the table to the page page.Elements.Add(table); // Save the PDF string pdfFilePath = @"C:\Temp\MyTable.pdf"; document.Draw(pdfFilePath); Thanks, ceTe Software Support Team