public static Paragraph ConstructTitle(Paragraph title, ArrayList numbers, int numberDepth, int numberStyle) {
if (title == null) {
return null;
}
int depth = Math.Min(numbers.Count, numberDepth);
if (depth < 1) {
return title;
}
StringBuilder buf = new StringBuilder(" ");
for (int i = 0; i < depth; i++) {
buf.Insert(0, ".");
buf.Insert(0, (int)numbers[i]);
}
if (numberStyle == NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT) {
buf.Remove(buf.Length - 2, 1);
}
Paragraph result = new Paragraph(title);
result.Insert(0, new Chunk(buf.ToString(), title.Font));
return result;
}