本文整理汇总了C#中iTextSharp.text.Table.CloneNonPositionParameters方法的典型用法代码示例。如果您正苦于以下问题:C# Table.CloneNonPositionParameters方法的具体用法?C# Table.CloneNonPositionParameters怎么用?C# Table.CloneNonPositionParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.Table
的用法示例。
在下文中一共展示了Table.CloneNonPositionParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTable
/**
* Creates a Table object based on this TableAttributes object.
* @return a com.lowagie.text.Table object
* @throws BadElementException
*/
public Table CreateTable() {
if (content.Count == 0) throw new BadElementException("Trying to create a table without rows.");
SimpleCell rowx = (SimpleCell)content[0];
int columns = 0;
foreach (SimpleCell cell in rowx.Content) {
columns += cell.Colspan;
}
float[] widths = new float[columns];
float[] widthpercentages = new float[columns];
Table table = new Table(columns);
table.Alignment = alignment;
table.Spacing = cellspacing;
table.Padding = cellpadding;
table.CloneNonPositionParameters(this);
int pos;
foreach (SimpleCell row in content) {
pos = 0;
foreach (SimpleCell cell in row.Content) {
table.AddCell(cell.CreateCell(row));
if (cell.Colspan == 1) {
if (cell.Width > 0) widths[pos] = cell.Width;
if (cell.Widthpercentage > 0) widthpercentages[pos] = cell.Widthpercentage;
}
pos += cell.Colspan;
}
}
float sumWidths = 0f;
for (int i = 0; i < columns; i++) {
if (widths[i] == 0) {
sumWidths = 0;
break;
}
sumWidths += widths[i];
}
if (sumWidths > 0) {
table.Width = sumWidths;
table.Locked = true;
table.Widths = widths;
}
else {
for (int i = 0; i < columns; i++) {
if (widthpercentages[i] == 0) {
sumWidths = 0;
break;
}
sumWidths += widthpercentages[i];
}
if (sumWidths > 0) {
table.Widths = widthpercentages;
}
}
if (width > 0) {
table.Width = width;
table.Locked = true;
}
else if (widthpercentage > 0) {
table.Width = widthpercentage;
}
return table;
}