本文整理汇总了C#中iTextSharp.text.Table.InsertTable方法的典型用法代码示例。如果您正苦于以下问题:C# Table.InsertTable方法的具体用法?C# Table.InsertTable怎么用?C# Table.InsertTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp.text.Table
的用法示例。
在下文中一共展示了Table.InsertTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddElement
//.........这里部分代码省略.........
/// JPEGs, GIFs or PNGs to a Cell.
/// </remarks>
/// <param name="element">the Element to add</param>
public void AddElement(IElement element)
{
if (IsTable())
{
Table table = (Table) arrayList[0];
Cell tmp = new Cell(element);
tmp.Border = NO_BORDER;
tmp.Colspan = table.Columns;
table.AddCell(tmp);
return;
}
switch (element.Type)
{
case Element.LISTITEM:
case Element.ROW:
case Element.CELL:
throw new BadElementException("You can't add listitems, rows or cells to a cell.");
case Element.JPEG:
case Element.IMGRAW:
case Element.IMGTEMPLATE:
arrayList.Add(element);
break;
case Element.LIST:
if (float.IsNaN(this.Leading))
{
leading = ((List) element).Leading;
}
if (((List) element).Size == 0) return;
arrayList.Add(element);
return;
case Element.ANCHOR:
case Element.PARAGRAPH:
case Element.PHRASE:
if (float.IsNaN(leading))
{
leading = ((Phrase) element).Leading;
}
if (((Phrase) element).IsEmpty()) return;
arrayList.Add(element);
return;
case Element.CHUNK:
if (((Chunk) element).IsEmpty()) return;
arrayList.Add(element);
return;
case Element.TABLE:
Table table = new Table(3);
float[] widths = new float[3];
widths[1] = ((Table)element).WidthPercentage;
switch (((Table)element).Alignment)
{
case Element.ALIGN_LEFT:
widths[0] = 0f;
widths[2] = 100f - widths[1];
break;
case Element.ALIGN_CENTER:
widths[0] = (100f - widths[1]) / 2f;
widths[2] = widths[0];
break;
case Element.ALIGN_RIGHT:
widths[0] = 100f - widths[1];
widths[2] = 0f;
break;
}
table.Widths = widths;
Cell tmp;
if (arrayList.Count == 0)
{
table.AddCell(Cell.DummyCell);
}
else
{
tmp = new Cell();
tmp.Border = NO_BORDER;
tmp.Colspan = 3;
foreach (IElement ele in arrayList)
{
tmp.Add(ele);
}
table.AddCell(tmp);
}
tmp = new Cell();
tmp.Border = NO_BORDER;
table.AddCell(tmp);
table.InsertTable((Table)element);
tmp = new Cell();
tmp.Border = NO_BORDER;
table.AddCell(tmp);
table.AddCell(Cell.DummyCell);
Clear();
arrayList.Add(table);
return;
default:
arrayList.Add(element);
break;
}
}
示例2: GetAllTable
private Table GetAllTable(Table fieldTable)
{
Table allTable = new Table(1);
int k = 0;
if (HeaderTable != null)
{
allTable.InsertTable(HeaderTable, new System.Drawing.Point(k, 0));
k++;
}
allTable.InsertTable(fieldTable, new System.Drawing.Point(k, 0));
k++;
if (FooterTable != null)
{
allTable.InsertTable(FooterTable, new System.Drawing.Point(k, 0));
}
//float[] widthf = new float[fieldTable.ProportionalWidths.Length];
//fieldTable.ProportionalWidths.CopyTo(widthf, 0);
//int[] widths = new int[fieldTable.ProportionalWidths.Length];
//for (int i = 0; i < widthf.Length; i++)
//{
// widths[i] = Convert.ToInt32(widthf[i]);
//}
//allTable.SetWidths(widths);
return allTable;
}