Paragraph.cs:
/// <summary>
/// Allows Tables to be added as a Paragraph parameter. This allows
PdfPTables to be
/// used as Chapter Headers or Paragraph body.
/// </summary>
/// <param name="table">the table</param>
public Paragraph(PdfPTable table) : base(table, new Font()) {}
Phrase.cs:
/// <summary>
/// Added to allow construction of a Phrase with PdfPTable. This
will allow
/// user to have more control of the style of their chapter headers.
/// </summary>
/// <param name="table"></param>
/// <param name="font"></param>
protected Phrase(PdfPTable table, Font font)
{
Font = font;
if (table is IElement)
{
base.Add(table);
}
}
Chapter.cs:
/// <summary>
/// Allows the user to specify wether to construct a title for the
chapter, or to
/// use the title param as is.
/// </summary>
/// <param name="title"></param>
/// <param name="number"></param>
/// <param name="customTitle"></param>
public Chapter(Paragraph title, int number, Boolean customTitle) :
base(title, 1, customTitle)
{
numbers = new ArrayList();
numbers.Add(number);
triggerNewPage = true;
}
Section.cs:
protected internal Section(Paragraph title, int numberDepth, Boolean
customTitle)
{
this.numberDepth = numberDepth;
this.title = title;
CustomTitle = customTitle;
}
/**
* Constructs a Paragraph that will be used as title for a Section or
Chapter.
* @param title the title of the section
* @param numbers a list of sectionnumbers
* @param numberDepth how many numbers have to be shown
* @param numberStyle the numbering style
* @return a Paragraph object
* @since iText 2.0.8
*/
public static Paragraph ConstructTitle(Paragraph title, ArrayList
numbers, int numberDepth, int numberStyle) {
if (title == null) {
return null;
}
if(!CustomTitle)
{
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;
}
else
{
return title;
}
}
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/