The RtfDocumentHeader contains all classes required for the generation of
the document header area.
| Method from com.lowagie.text.rtf.document.RtfDocumentHeader Detail: |
public void addInfoElement(RtfInfoElement rtfInfoElement) {
this.infoGroup.add(rtfInfoElement);
}
Adds an RtfInfoElement to the list of RtfInfoElements |
public void freeListNumber(RtfList list) {
this.listTable.freeListNumber(list);
}
Removes a RtfList from the list table |
public int getColorNumber(RtfColor color) {
return this.colorList.getColorNumber(color);
}
Gets the number of the specified RtfColor |
public int getFontNumber(RtfFont font) {
return this.fontList.getFontNumber(font);
}
Gets the number of the specified RtfFont |
public int getListNumber(RtfList list) {
return this.listTable.getListNumber(list);
}
Gets the number of the specified RtfList |
public RtfListTable getListTable() {
return this.listTable;
}
Get the RtfListTable object. |
public RtfPageSetting getPageSetting() {
return this.pageSetting;
}
Gets the RtfPageSetting object of this RtfDocument |
public RtfParagraphStyle getRtfParagraphStyle(String styleName) {
return this.stylesheetList.getRtfParagraphStyle(styleName);
}
Gets the RtfParagraphStyle with the given style name. |
protected void init() {
this.codePage = new RtfCodePage(this.document);
this.colorList = new RtfColorList(this.document);
this.fontList = new RtfFontList(this.document);
this.listTable = new RtfListTable(this.document);
this.stylesheetList = new RtfStylesheetList(this.document);
this.infoGroup = new RtfInfoGroup(this.document);
this.protectionSetting = new RtfProtectionSetting(this.document);
this.pageSetting = new RtfPageSetting(this.document);
this.header = new RtfHeaderFooterGroup(this.document, RtfHeaderFooter.TYPE_HEADER);
this.footer = new RtfHeaderFooterGroup(this.document, RtfHeaderFooter.TYPE_FOOTER);
this.generator = new RtfGenerator(this.document);
}
initializes the RtfDocumentHeader. |
public void registerParagraphStyle(RtfParagraphStyle rtfParagraphStyle) {
this.stylesheetList.registerParagraphStyle(rtfParagraphStyle);
}
Registers the RtfParagraphStyle for further use in the document. |
public void setFooter(HeaderFooter footer) {
this.footer = footer;
}
Sets the current footer to use |
public void setHeader(HeaderFooter header) {
this.header = header;
}
Sets the current header to use |
public void writeContent(OutputStream result) throws IOException {
try {
// This is so that all color, font and similar information is processed once, before
// the header section is written.
writeSectionDefinition(new RtfNilOutputStream());
this.codePage.writeDefinition(result);
this.fontList.writeDefinition(result);
this.colorList.writeDefinition(result);
this.stylesheetList.writeDefinition(result);
this.listTable.writeDefinition(result);
this.generator.writeContent(result);
this.infoGroup.writeContent(result);
this.protectionSetting.writeDefinition(result);
this.pageSetting.writeDefinition(result);
writeSectionDefinition(result);
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
Writes the contents of the document header area. |
public void writeSectionDefinition(OutputStream result) {
try {
RtfHeaderFooterGroup header = convertHeaderFooter(this.header, RtfHeaderFooter.TYPE_HEADER);
RtfHeaderFooterGroup footer = convertHeaderFooter(this.footer, RtfHeaderFooter.TYPE_FOOTER);
if(header.hasTitlePage() || footer.hasTitlePage()) {
result.write(TITLE_PAGE);
header.setHasTitlePage();
footer.setHasTitlePage();
}
if(header.hasFacingPages() || footer.hasFacingPages()) {
result.write(FACING_PAGES);
header.setHasFacingPages();
footer.setHasFacingPages();
}
footer.writeContent(result);
header.writeContent(result);
pageSetting.writeSectionDefinition(result);
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
Writes the section definition data |