Skip to main content
Skip table of contents

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
TypeNameMethods
boolBookmarkOpen
Get/set the bookmark
get, set
stringBookmarkTitleset
IList<Chunk>Chunks
Gets all the chunks in this element.
get
intDepth
Returns the depth of this section.
get
boolElementCompleteget, set
AccessibleElementIdIDget, set
floatIndentation
Get/set the indentation of the content of this Section.
get, set
floatIndentationLeft
Get/set the indentation of this Section on the left side.
get, set
floatIndentationRight
Get/set the indentation of this Section on the right side.
get, set
boolIsInlineget
boolNotAddedYetget, set
intNumberDepth
Get/set the numberdepth of this Section.
get, set
intNumberStyleget, set
PdfNameRoleget, set
ParagraphTitle
Get/set the title of this section
get, set
boolTriggerNewPageget, set
intType
Gets the type of the text element.
get
Protected properties
TypeNameMethods
boolAddedCompletelyget, set

Methods

Public methods
ReturnsName
voidAdd(...)
Adds a Paragraph, List or Table
to this Section.
boolAddAll(ICollection<T> collection)
MarkedSectionAddMarkedSection()
SectionAddSection(...)
Creates a Section, adds it to this Section and returns it.
voidFlushContent()
PdfObjectGetAccessibleAttribute(PdfName key)
Dictionary<PdfName, PdfObject>GetAccessibleAttributes()
ParagraphGetBookmarkTitle()
boolIsChapter()
Checks if this object is a Chapter.
boolIsContent()
boolIsNestable()
boolIsSection()
Checks if this object is a Section.
voidNewPage()
boolProcess(IElementListener listener)
Processes the element by adding it (or the different parts) to an
IElementListener.
voidSetAccessibleAttribute(PdfName key, PdfObject value)
voidSetChapterNumber(int number)
stringToString()
Public Static methods
ReturnsName
ParagraphConstructTitle(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
TypeNameDescription
Paragraphtitlea Paragraph
intnumberDepththe numberDepth
Summary

Constructs a new Section.

Methods

Process

Source code

public virtual bool Process(IElementListener listener)
Arguments
TypeNameDescription
IElementListenerlistenerthe 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
TypeNameDescription
intindexindex at which the specified element is to be inserted
IElementelement
Summary

Adds a Paragraph, List or Table to this Section.

Add [2/2]

Source code

public virtual bool Add(IElement element)
Arguments
TypeNameDescription
IElementelement
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
TypeNameDescription
ICollection<T>collection
AddSection [1/8]

Source code

public virtual Section AddSection(float indentation, Paragraph title, int numberDepth)
Arguments
TypeNameDescription
floatindentationthe indentation of the new section
Paragraphtitlethe title of the new section
intnumberDepththe 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
TypeNameDescription
floatindentationthe indentation of the new section
Paragraphtitlethe 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
TypeNameDescription
Paragraphtitlethe title of the new section
intnumberDepththe 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
TypeNameDescription
Paragraphtitlethe 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
TypeNameDescription
floatindentationthe indentation of the new section
stringtitlethe title of the new section
intnumberDepththe 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
TypeNameDescription
stringtitlethe title of the new section
intnumberDepththe 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
TypeNameDescription
floatindentationthe indentation of the new section
stringtitlethe 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
TypeNameDescription
stringtitlethe 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
TypeNameDescription
Paragraphtitle
List<int>numbers
intnumberDepth
intnumberStyle
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
TypeNameDescription
intnumber
FlushContent

Source code

public virtual void FlushContent()
NewPage

Source code

public virtual void NewPage()
GetAccessibleAttribute

Source code

public virtual PdfObject GetAccessibleAttribute(PdfName key)
Arguments
TypeNameDescription
PdfNamekey
SetAccessibleAttribute

Source code

public virtual void SetAccessibleAttribute(PdfName key, PdfObject value)
Arguments
TypeNameDescription
PdfNamekey
PdfObjectvalue
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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.