Hello.
Hi Dmitry,
Thanks for your inquiry. Please note you are using old approach for creating PDF document. Please use new DOM approach (new generator) for the purpose, it will resolve the issue. It can be used for both creating a PDF document from scratch or to manipulate existing PDF. It is more efficient and improved. Please check sample code snippet for the purpose.
Document document = new Document();
Aspose.Pdf.Page docSection = document.Pages.Add();
docSection.PageInfo.Margin = new Aspose.Pdf.MarginInfo
{ Bottom = 0, Left = 0, Right = 0, Top = 0 };
// add fake text
for (int i = 0; i < 81; i++)
{
TextFragment textPar = new TextFragment("line " + i.ToString());
docSection.Paragraphs.Add(textPar);
}
docSection.Paragraphs.Add(new TextFragment("")); // empty line separates topics
// add sample table
DataTable dataSource = GenerateSampleTable();
Table table = new Table
{
DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F),
DefaultColumnWidth = "150",
RepeatingRowsCount = 1,
Margin = { Top = 2, Bottom = 0 }
};
float colWidth = 150;
MarginInfo headerPadding = new MarginInfo { Left = 5, Top = 5, Right = 5, Bottom = 5 };
MarginInfo contentPadding = new MarginInfo { Left = 2, Top = 2, Right = 2, Bottom = 2 };
Row headerRow = table.Rows.Add();
foreach (DataColumn dc in dataSource.Columns)
{
Cell cell = headerRow.Cells.Add(dc.ColumnName);
cell.BackgroundColor = Aspose.Pdf.Color.Yellow;
}
foreach (DataRow sourceRow in dataSource.Rows)
{
Row destRow = table.Rows.Add();
foreach (DataColumn dc in dataSource.Columns)
{
Cell cell = destRow.Cells.Add(sourceRow[dc].ToString());
}
}
docSection.Paragraphs.Add(table);
document.Save("Tableoutput1.pdf");
Please feel free to contact us for any further assistance.
Best Regards,
Hello,
Hi Dmitry,
Hello,
Hi Dmitry,
Thanks for your inquiry. I am afraid the strikeout feature is missing in TextFragment, we have already logged a ticket PDFNEWNET-38556 for the rectification. We will notify you as soon as it is resolved. However, as a workaround, you can use HtmlFragment
for adding html text for the purpose as following.
HtmlFragment html = new HtmlFragment("<p>Aspose.Pdf for .NET 10.6.0 is <strike>not yet available!</strike> now available!</p>");
page.Paragraphs.Add(html);
We are sorry for the inconvenience caused.
Best Regards,