iText 5

Section

Section Public class

Description

A Section is a part of a Document containing other Sections, Paragraphs, List and/or Tables.

Diagram

flowchart LR classDef interfaceStyle stroke-dasharray: 5 5; classDef abstractStyle stroke-width:4px subgraph iTextSharp.text iTextSharp.text.Section[[Section]] iTextSharp.text.ITextElementArray[[ITextElementArray]] class iTextSharp.text.ITextElementArray interfaceStyle; iTextSharp.text.IElement[[IElement]] class iTextSharp.text.IElement interfaceStyle; iTextSharp.text.ILargeElement[[ILargeElement]] class iTextSharp.text.ILargeElement interfaceStyle; iTextSharp.text.IElement[[IElement]] class iTextSharp.text.IElement interfaceStyle; end subgraph iTextSharp.text.api iTextSharp.text.api.IIndentable[[IIndentable]] class iTextSharp.text.api.IIndentable interfaceStyle; end subgraph iTextSharp.text.pdf.interfaces iTextSharp.text.pdf.interfaces.IAccessibleElement[[IAccessibleElement]] class iTextSharp.text.pdf.interfaces.IAccessibleElement interfaceStyle; end subgraph System.Collections.Generic System.Collections.Generic.List_1[[List]] end iTextSharp.text.ITextElementArray --> iTextSharp.text.Section iTextSharp.text.IElement --> iTextSharp.text.ITextElementArray iTextSharp.text.ILargeElement --> iTextSharp.text.Section iTextSharp.text.IElement --> iTextSharp.text.ILargeElement iTextSharp.text.api.IIndentable --> iTextSharp.text.Section iTextSharp.text.pdf.interfaces.IAccessibleElement --> iTextSharp.text.Section System.Collections.Generic.List_1 --> iTextSharp.text.Section

Members

Properties

Public properties

Type

Name

Methods

bool

BookmarkOpen


Get/set the bookmark

get, set

string

BookmarkTitle

set

IList<

Chunk

>

Chunks


Gets all the chunks in this element.

get

int

Depth


Returns the depth of this section.

get

bool

ElementComplete

get, set

AccessibleElementId

ID

get, set

float

Indentation


Get/set the indentation of the content of this Section.

get, set

float

IndentationLeft


Get/set the indentation of this Section on the left side.

get, set

float

IndentationRight


Get/set the indentation of this Section on the right side.

get, set

bool

IsInline

get

bool

NotAddedYet

get, set

int

NumberDepth


Get/set the numberdepth of this Section.

get, set

int

NumberStyle

get, set

PdfName

Role

get, set

Paragraph

Title


Get/set the title of this section

get, set

bool

TriggerNewPage

get, set

int

Type


Gets the type of the text element.

get

Protected properties

Type

Name

Methods

bool

AddedCompletely

get, set

Methods

Public methods

Returns

Name

void

Add

(...)
Adds a Paragraph, List or Table
to this Section.

bool

AddAll

(ICollection<T> collection)

MarkedSection

AddMarkedSection

()

Section

AddSection

(...)
Creates a Section, adds it to this Section and returns it.

void

FlushContent

()

PdfObject

GetAccessibleAttribute

(

PdfName

key)

Dictionary<

PdfName

,

PdfObject

>

GetAccessibleAttributes

()

Paragraph

GetBookmarkTitle

()

bool

IsChapter

()
Checks if this object is a Chapter.

bool

IsContent

()

bool

IsNestable

()

bool

IsSection

()
Checks if this object is a Section.

void

NewPage

()

bool

Process

(

IElementListener

listener)
Processes the element by adding it (or the different parts) to an
IElementListener.

void

SetAccessibleAttribute

(

PdfName

key,

PdfObject

value)

void

SetChapterNumber

(int number)

string

ToString

()

Public Static methods

Returns

Name

Paragraph

ConstructTitle

(

Paragraph

title, List<int> numbers, int numberDepth, int numberStyle)

Details

Summary

A Section is a part of a Document containing other Sections, Paragraphs, List and/or Tables.

Remarks

You can not construct a Section yourself. You will have to ask an instance of Section to the Chapter or Section to which you want to add the new Section.

Example

Paragraph title2 = new Paragraph("This is Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255))); Chapter chapter2 = new Chapter(title2, 2); Paragraph someText = new Paragraph("This is some text"); chapter2.Add(someText); Paragraph title21 = new Paragraph("This is Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0))); Section section1 = chapter2.AddSection(title21); Paragraph someSectionText = new Paragraph("This is some silly paragraph in a chapter and/or section. It contains some text to test the functionality of Chapters and Section."); section1.Add(someSectionText); Paragraph title211 = new Paragraph("This is SubSection 1 in Section 1 in Chapter 2", FontFactory.GetFont(FontFactory.HELVETICA, 14, Font.BOLD, new Color(255, 0, 0))); Section section11 = section1.AddSection(40, title211, 2); section11.Add(someSectionText);strong>

Inheritance

Constructors

Section [1/2]

Source code

protected internal Section()

Summary

Constructs a new Section.

Section [2/2]

Source code

protected internal Section(Paragraph title, int numberDepth)

Arguments

Type

Name

Description

Paragraph

title

a Paragraph

int

numberDepth

the numberDepth

Summary

Constructs a new Section.

Methods

Process

Source code

public virtual bool Process(IElementListener listener)

Arguments

Type

Name

Description

IElementListener

listener

the IElementListener

Summary

Processes the element by adding it (or the different parts) to an IElementListener.

Returns

true if the element was processed successfully

IsContent

Source code

public virtual bool IsContent()

IsNestable

Source code

public virtual bool IsNestable()

Add [1/2]

Source code

public virtual void Add(int index, IElement element)

Arguments

Type

Name

Description

int

index

index at which the specified element is to be inserted

IElement

element

Summary

Adds a Paragraph, List or Table to this Section.

Add [2/2]

Source code

public virtual bool Add(IElement element)

Arguments

Type

Name

Description

IElement

element

Summary

Adds a Paragraph, List, Table or another Section to this Section.

Returns

a bool

AddAll

Source code

public virtual bool AddAll<T>(ICollection<T> collection) where T : IElement

Arguments

Type

Name

Description

ICollection<T>

collection

AddSection [1/8]

Source code

public virtual Section AddSection(float indentation, Paragraph title, int numberDepth)

Arguments

Type

Name

Description

float

indentation

the indentation of the new section

Paragraph

title

the title of the new section

int

numberDepth

the numberDepth of the section

Summary

Creates a Section, adds it to this Section and returns it.

Returns

the newly added Section

AddSection [2/8]

Source code

public virtual Section AddSection(float indentation, Paragraph title)

Arguments

Type

Name

Description

float

indentation

the indentation of the new section

Paragraph

title

the title of the new section

Summary

Creates a Section, adds it to this Section and returns it.

Returns

the newly added Section

AddSection [3/8]

Source code

public virtual Section AddSection(Paragraph title, int numberDepth)

Arguments

Type

Name

Description

Paragraph

title

the title of the new section

int

numberDepth

the numberDepth of the section

Summary

Creates a Section, add it to this Section and returns it.

Returns

the newly added Section

AddMarkedSection

Source code

public virtual MarkedSection AddMarkedSection()

AddSection [4/8]

Source code

public virtual Section AddSection(Paragraph title)

Arguments

Type

Name

Description

Paragraph

title

the title of the new section

Summary

Creates a Section, adds it to this Section and returns it.

Returns

the newly added Section

AddSection [5/8]

Source code

public virtual Section AddSection(float indentation, string title, int numberDepth)

Arguments

Type

Name

Description

float

indentation

the indentation of the new section

string

title

the title of the new section

int

numberDepth

the numberDepth of the section

Summary

Adds a Section to this Section and returns it.

Returns

the newly added Section

AddSection [6/8]

Source code

public virtual Section AddSection(string title, int numberDepth)

Arguments

Type

Name

Description

string

title

the title of the new section

int

numberDepth

the numberDepth of the section

Summary

Adds a Section to this Section and returns it.

Returns

the newly added Section

AddSection [7/8]

Source code

public virtual Section AddSection(float indentation, string title)

Arguments

Type

Name

Description

float

indentation

the indentation of the new section

string

title

the title of the new section

Summary

Adds a Section to this Section and returns it.

Returns

the newly added Section

AddSection [8/8]

Source code

public virtual Section AddSection(string title)

Arguments

Type

Name

Description

string

title

the title of the new section

Summary

Adds a Section to this Section and returns it.

Returns

the newly added Section

ConstructTitle

Source code

public static Paragraph ConstructTitle(Paragraph title, List<int> numbers, int numberDepth, int numberStyle)

Arguments

Type

Name

Description

Paragraph

title

List<int>

numbers

int

numberDepth

int

numberStyle

IsChapter

Source code

public virtual bool IsChapter()

Summary

Checks if this object is a Chapter.

Returns

true if it is a Chapter, false if it is a Section

IsSection

Source code

public virtual bool IsSection()

Summary

Checks if this object is a Section.

Returns

true if it is a Section, false if it is a Chapter.

GetBookmarkTitle

Source code

public virtual Paragraph GetBookmarkTitle()

ToString

Source code

public override string ToString()

SetChapterNumber

Source code

public virtual void SetChapterNumber(int number)

Arguments

Type

Name

Description

int

number

FlushContent

Source code

public virtual void FlushContent()

NewPage

Source code

public virtual void NewPage()

GetAccessibleAttribute

Source code

public virtual PdfObject GetAccessibleAttribute(PdfName key)

Arguments

Type

Name

Description

PdfName

key

SetAccessibleAttribute

Source code

public virtual void SetAccessibleAttribute(PdfName key, PdfObject value)

Arguments

Type

Name

Description

PdfName

key

PdfObject

value

GetAccessibleAttributes

Source code

public virtual Dictionary<PdfName, PdfObject> GetAccessibleAttributes()

Properties

Type

public virtual int Type { get; }

Summary

Gets the type of the text element.

Value

a type

Chunks

public virtual IList<Chunk> Chunks { get; }

Summary

Gets all the chunks in this element.

Value

an ArrayList

Title

public virtual Paragraph Title { get; set; }

Summary

Get/set the title of this section

Value

a Paragraph

NumberStyle

public virtual int NumberStyle { get; set; }

NumberDepth

public virtual int NumberDepth { get; set; }

Summary

Get/set the numberdepth of this Section.

Value

a int

IndentationLeft

public virtual float IndentationLeft { get; set; }

Summary

Get/set the indentation of this Section on the left side.

Value

the indentation

IndentationRight

public virtual float IndentationRight { get; set; }

Summary

Get/set the indentation of this Section on the right side.

Value

the indentation

Indentation

public virtual float Indentation { get; set; }

Summary

Get/set the indentation of the content of this Section.

Value

the indentation

Depth

public virtual int Depth { get; }

Summary

Returns the depth of this section.

Value

the depth

BookmarkOpen

public virtual bool BookmarkOpen { get; set; }

Summary

Get/set the bookmark

Value

a bool

BookmarkTitle

public virtual string BookmarkTitle { set; }

TriggerNewPage

public virtual bool TriggerNewPage { get; set; }

NotAddedYet

public virtual bool NotAddedYet { get; set; }

AddedCompletely

protected virtual bool AddedCompletely { get; set; }

ElementComplete

public virtual bool ElementComplete { get; set; }

Role

public virtual PdfName Role { get; set; }

ID

public virtual AccessibleElementId ID { get; set; }

IsInline

public virtual bool IsInline { get; }

Generated with ModularDoc