public static Table GetTable(Properties attributes) {
String value;
Table table;
value = attributes[ElementTags.WIDTHS];
if (value != null) {
StringTokenizer widthTokens = new StringTokenizer(value, ";");
ArrayList values = new ArrayList();
while (widthTokens.HasMoreTokens()) {
values.Add(widthTokens.NextToken());
}
table = new Table(values.Count);
float[] widths = new float[table.Columns];
for (int i = 0; i < values.Count; i++) {
value = (String)values[i];
widths[i] = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
table.Widths = widths;
}
else {
value = attributes[ElementTags.COLUMNS];
try {
table = new Table(int.Parse(value));
}
catch {
table = new Table(1);
}
}
table.Border = Table.BOX;
table.BorderWidth = 1;
table.DefaultCell.Border = Table.BOX;
value = attributes[ElementTags.LASTHEADERROW];
if (value != null) {
table.LastHeaderRow = int.Parse(value);
}
value = attributes[ElementTags.ALIGN];
if (value != null) {
table.SetAlignment(value);
}
value = attributes[ElementTags.CELLSPACING];
if (value != null) {
table.Spacing = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
value = attributes[ElementTags.CELLPADDING];
if (value != null) {
table.Padding = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
value = attributes[ElementTags.OFFSET];
if (value != null) {
table.Offset = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
value = attributes[ElementTags.WIDTH];
if (value != null) {
if (value.EndsWith("%"))
table.Width = float.Parse(value.Substring(0, value.Length - 1), System.Globalization.NumberFormatInfo.InvariantInfo);
else {
table.Width = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
table.Locked = true;
}
}
table.TableFitsPage = Utilities.CheckTrueOrFalse(attributes, ElementTags.TABLEFITSPAGE);
table.CellsFitPage = Utilities.CheckTrueOrFalse(attributes, ElementTags.CELLSFITPAGE);
table.Convert2pdfptable = Utilities.CheckTrueOrFalse(attributes, ElementTags.CONVERT2PDFP);
SetRectangleProperties(table, attributes);
return table;
}