solution1368
asked on
asp.net, itextshape format
I have the following code working fine to create table with itextsharp,
my question is i will have more tables like table1, table2 for something.
How can i make default format for all of the table?
like I want all of the table has totalwidth = 540f?
Thanks
PdfPTable table = new PdfPTable(2); //Table with 2 columns
//======================== ========== ========== ========== ==
//table format
table.TotalWidth = 540f;
table.LockedWidth = true;
var titleFont = FontFactory.GetFont("Arial ", 18, Font.BOLD);
var subTitleFont = FontFactory.GetFont("Arial ", 14, Font.BOLD);
var boldTableFont = FontFactory.GetFont("Arial ", 12, Font.BOLD);
var endingMessageFont = FontFactory.GetFont("Arial ", 10, Font.ITALIC);
var bodyFont = FontFactory.GetFont("Arial ",8, Font.NORMAL);
table.HorizontalAlignment = 0;
table.SpacingBefore = 10;
table.SpacingAfter = 10;
table.DefaultCell.Border = 1;
//table.SetWidths(new int[] { 1, 4 });
//======================== ========== ========== ========== ==
my question is i will have more tables like table1, table2 for something.
How can i make default format for all of the table?
like I want all of the table has totalwidth = 540f?
Thanks
PdfPTable table = new PdfPTable(2); //Table with 2 columns
//========================
//table format
table.TotalWidth = 540f;
table.LockedWidth = true;
var titleFont = FontFactory.GetFont("Arial
var subTitleFont = FontFactory.GetFont("Arial
var boldTableFont = FontFactory.GetFont("Arial
var endingMessageFont = FontFactory.GetFont("Arial
var bodyFont = FontFactory.GetFont("Arial
table.HorizontalAlignment = 0;
table.SpacingBefore = 10;
table.SpacingAfter = 10;
table.DefaultCell.Border = 1;
//table.SetWidths(new int[] { 1, 4 });
//========================
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
do we have any options to set master settings like
table.SpacingBefore = 10;
table.SpacingAfter = 10;
table.DefaultCell.Border = 1;
If yes, how to do that? Thanks