如何在itextsharp asp.net中创建表 [英] How to create a table in itextsharp asp.net
本文介绍了如何在itextsharp asp.net中创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建表格并将其添加到文档中?
第一个单元格跨越10列。
这些单元格跨越2行。
这个单元格跨越1行剩下的6列。
解决方案
你好vasanthagiri,
< pre lang =c#> PdfPTable table = new PdfPTable( 3 );
PdfPCell cell = new PdfPCell( new 短语( 标题跨越3列));
cell.Colspan = 3 ;
cell.HorizontalAlignment = 1 ; // 0 =左,1 =中心,2 =右
table.AddCell(单元格);
table.AddCell( Col 1 Row 1);
table.AddCell( Col 2 Row 1);
table.AddCell( Col 3 Row 1);
table.AddCell( Col 1 Row 2);
table.AddCell( Col 2 Row 2);
table.AddCell( Col 3 Row 2);
doc.Add(table);
另请参阅以下链接
iTextSharp - 介绍表 [ ^ ]
问候,
Willington
How to create a table and add it to the document ?
The first cell spans 10 columns.
These cells span 2 rows.
This cell spans the remaining 6 columns in 1 row.
解决方案
Hi vasanthagiri,
PdfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(new Phrase("Header spanning 3 columns")); cell.Colspan = 3; cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right table.AddCell(cell); table.AddCell("Col 1 Row 1"); table.AddCell("Col 2 Row 1"); table.AddCell("Col 3 Row 1"); table.AddCell("Col 1 Row 2"); table.AddCell("Col 2 Row 2"); table.AddCell("Col 3 Row 2"); doc.Add(table);
Also refer to the below link
iTextSharp - Introducing Tables[^]
Regards,
Willington
这篇关于如何在itextsharp asp.net中创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文