Module BaseDoc :: Class TextDoc
[frames] | no frames]

Class TextDoc

source code

Abstract Interface for text document generators. Output formats for text reports must implment this interface to be used by the report system.

Instance Methods
 
page_break(self)
Forces a page break, creating a new page
source code
 
start_bold(self) source code
 
end_bold(self) source code
 
start_superscript(self) source code
 
end_superscript(self) source code
 
start_paragraph(self, style_name, leader=None)
Starts a new paragraph, using the specified style name.
source code
 
end_paragraph(self)
Ends the current parsgraph
source code
 
start_table(self, name, style_name)
Starts a new table.
source code
 
end_table(self)
Ends the current table
source code
 
start_row(self)
Starts a new row on the current table
source code
 
end_row(self)
Ends the current row on the current table
source code
 
start_cell(self, style_name, span=1)
Starts a new table cell, using the paragraph style specified.
source code
 
end_cell(self)
Ends the current table cell
source code
 
write_note(self, text, format, style_name)
Writes the note's text and take care of paragraphs, depending on the format.
source code
 
write_text(self, text, mark=None)
Writes the text in the current paragraph.
source code
 
add_media_object(self, name, align, w_cm, h_cm)
Add a photo of the specified width (in centimeters)
source code
Method Details

start_paragraph(self, style_name, leader=None)

source code 

Starts a new paragraph, using the specified style name.

Parameters:
  • style_name - name of the ParagraphStyle to use for the paragraph.
  • leader - Leading text for a paragraph. Typically used for numbering.

start_table(self, name, style_name)

source code 

Starts a new table.

Parameters:
  • name - Unique name of the table.
  • style_name - TableStyle to use for the new table

start_cell(self, style_name, span=1)

source code 

Starts a new table cell, using the paragraph style specified.

Parameters:
  • style_name - TableCellStyle to use for the cell
  • span - number of columns to span

write_note(self, text, format, style_name)

source code 

Writes the note's text and take care of paragraphs, depending on the format.

Parameters:
  • text - text to write.
  • format - format to use for writing. True for flowed text, 1 for preformatted text.

write_text(self, text, mark=None)

source code 

Writes the text in the current paragraph. Should only be used after a start_paragraph and before an end_paragraph.

Parameters:
  • text - text to write.
  • mark - IndexMark to use for indexing (if supported)

add_media_object(self, name, align, w_cm, h_cm)

source code 

Add a photo of the specified width (in centimeters)

Parameters:
  • name - filename of the image to add
  • align - alignment of the image. Valid values are 'left', 'right', 'center', and 'single'
  • w_cm - width in centimeters
  • h_cm - height in centimeters