Class Chapter
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<Element>, Collection<Element>, List<Element>, RandomAccess, SequencedCollection<Element>, Element, LargeElement, TextElementArray
- Direct Known Subclasses:
ChapterAutoNumber
A
Chapter is a special Section.
A chapter number has to be created using a Paragraph as title and an int as chapter number.
The chapter number is shown be default. If you don't want to see the chapter number, you have to set the numberdepth
to 0.
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);
chapter2.setNumberDepth(0);
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);
- See Also:
-
Field Summary
FieldsFields inherited from class Section
addedCompletely, bookmarkOpen, bookmarkTitle, complete, indentation, indentationLeft, indentationRight, notAddedYet, numberDepth, numbers, numberStyle, NUMBERSTYLE_DOTTED, NUMBERSTYLE_DOTTED_WITHOUT_FINAL_DOT, subsections, title, triggerNewPageFields inherited from class AbstractList
modCountFields inherited from interface Element
ALIGN_BASELINE, ALIGN_BOTTOM, ALIGN_CENTER, ALIGN_JUSTIFIED, ALIGN_JUSTIFIED_ALL, ALIGN_LEFT, ALIGN_MIDDLE, ALIGN_RIGHT, ALIGN_TOP, ALIGN_UNDEFINED, ANCHOR, ANNOTATION, AUTHOR, CCITT_BLACKIS1, CCITT_ENCODEDBYTEALIGN, CCITT_ENDOFBLOCK, CCITT_ENDOFLINE, CCITTG3_1D, CCITTG3_2D, CCITTG4, CELL, CHAPTER, CHUNK, CREATIONDATE, CREATOR, FOOTNOTE, HEADER, IMGRAW, IMGTEMPLATE, JBIG2, JPEG, JPEG2000, KEYWORDS, LIST, LISTITEM, MARKED, MODIFICATIONDATE, MULTI_COLUMN_TEXT, PARAGRAPH, PHRASE, PRODUCER, PTABLE, RECTANGLE, ROW, SECTION, SUBJECT, TABLE, TITLE, YMARK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this element is nestable.inttype()Gets the type of the text element.Methods inherited from class Section
add, add, addAll, addMarkedSection, addSection, addSection, addSection, addSection, addSection, addSection, addSection, addSection, constructTitle, flushContent, getBookmarkTitle, getChunks, getDepth, getIndentation, getIndentationLeft, getIndentationRight, getNumberDepth, getNumberStyle, getTitle, isAddedCompletely, isBookmarkOpen, isChapter, isComplete, isContent, isNotAddedYet, isSection, isTriggerNewPage, newPage, process, setAddedCompletely, setBookmarkOpen, setBookmarkTitle, setChapterNumber, setComplete, setIndentation, setIndentationLeft, setIndentationRight, setNotAddedYet, setNumberDepth, setNumberStyle, setTitle, setTriggerNewPageMethods inherited from class ArrayList
addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, stream, toArrayMethods inherited from interface List
containsAll, reversed
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
Chapter
public Chapter(int number) Constructs a newChapter.- Parameters:
number- the Chapter number
-
Chapter
Constructs a newChapter.- Parameters:
title- the Chapter title (as aParagraph)number- the Chapter number
-
Chapter
Constructs a newChapter.- Parameters:
title- the Chapter title (as aString)number- the Chapter number
-
-
Method Details
-
type
-
isNestable
public boolean isNestable()Description copied from interface:ElementChecks if this element is nestable.- Specified by:
isNestablein interfaceElement- Overrides:
isNestablein classSection- Returns:
- true if this element can be nested inside other elements.
- Since:
- iText 2.0.8
- See Also:
-