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

Class ParagraphStyle

source code

Defines the characteristics of a paragraph. The characteristics are: font (a FontStyle instance), right margin, left margin, first indent, top margin, bottom margin, alignment, level, top border, bottom border, right border, left border, padding, and background color.

Instance Methods
 
__init__(self, source=None) source code
 
set_description(self, text)
Set the desciption of the paragraph
source code
 
get_description(self)
Return the desciption of the paragraph
source code
 
set(self, rmargin=None, lmargin=None, first_indent=None, tmargin=None, bmargin=None, align=None, tborder=None, bborder=None, rborder=None, lborder=None, pad=None, bgcolor=None, font=None)
Allows the values of the object to be set.
source code
 
set_header_level(self, level)
Set the header level for the paragraph.
source code
 
get_header_level(self)
Return the header level of the paragraph
source code
 
set_font(self, font)
Set the font style of the paragraph.
source code
 
get_font(self)
Return the FontStyle of the paragraph
source code
 
set_padding(self, val)
Set the paragraph padding in centimeters
source code
 
get_padding(self)
Return a the padding of the paragraph
source code
 
set_top_border(self, val)
Set the presence or absence of top border.
source code
 
get_top_border(self)
Return 1 if a top border is specified
source code
 
set_bottom_border(self, val)
Set the presence or absence of bottom border.
source code
 
get_bottom_border(self)
Return 1 if a bottom border is specified
source code
 
set_left_border(self, val)
Set the presence or absence of left border.
source code
 
get_left_border(self)
Return 1 if a left border is specified
source code
 
set_right_border(self, val)
Set the presence or absence of rigth border.
source code
 
get_right_border(self)
Return 1 if a right border is specified
source code
 
get_background_color(self)
Return a tuple indicating the RGB components of the background color
source code
 
set_background_color(self, color)
Set the background color of the paragraph.
source code
 
set_alignment(self, align)
Set the paragraph alignment.
source code
 
get_alignment(self)
Return the alignment of the paragraph
source code
 
get_alignment_text(self)
Return a text string representing the alginment, either 'left', 'right', 'center', or 'justify'
source code
 
set_left_margin(self, value)
sets the left indent in centimeters
source code
 
set_right_margin(self, value)
sets the right indent in centimeters
source code
 
set_first_indent(self, value)
sets the first line indent in centimeters
source code
 
set_top_margin(self, value)
sets the space above paragraph in centimeters
source code
 
set_bottom_margin(self, value)
sets the space below paragraph in centimeters
source code
 
get_left_margin(self)
returns the left indent in centimeters
source code
 
get_right_margin(self)
returns the right indent in centimeters
source code
 
get_first_indent(self)
returns the first line indent in centimeters
source code
 
get_top_margin(self)
returns the space above paragraph in centimeters
source code
 
get_bottom_margin(self)
returns the space below paragraph in centimeters
source code
 
set_tabs(self, tab_stops) source code
 
get_tabs(self) source code
Method Details

__init__(self, source=None)
(Constructor)

source code 
Parameters:
  • source - if not None, then the ParagraphStyle is created using the values of the source instead of the default values.

set(self, rmargin=None, lmargin=None, first_indent=None, tmargin=None, bmargin=None, align=None, tborder=None, bborder=None, rborder=None, lborder=None, pad=None, bgcolor=None, font=None)

source code 

Allows the values of the object to be set.

Parameters:
  • rmargin - right indent in centimeters
  • lmargin - left indent in centimeters
  • first_indent - first line indent in centimeters
  • tmargin - space above paragraph in centimeters
  • bmargin - space below paragraph in centimeters
  • align - alignment type (PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, or PARA_ALIGN_JUSTIFY)
  • tborder - non zero indicates that a top border should be used
  • bborder - non zero indicates that a bottom border should be used
  • rborder - non zero indicates that a right border should be used
  • lborder - non zero indicates that a left border should be used
  • pad - padding in centimeters
  • bgcolor - background color of the paragraph as an RGB tuple.
  • font - FontStyle instance that defines the font

set_header_level(self, level)

source code 

Set the header level for the paragraph. This is useful for numbered paragraphs. A value of 1 indicates a header level format of X, a value of two implies X.X, etc. A value of zero means no header level.

set_font(self, font)

source code 

Set the font style of the paragraph.

Parameters:
  • font - FontStyle object containing the font definition to use.

set_padding(self, val)

source code 

Set the paragraph padding in centimeters

Parameters:
  • val - floating point value indicating the padding in centimeters

set_top_border(self, val)

source code 

Set the presence or absence of top border.

Parameters:
  • val - True indicates a border should be used, False indicates no border.

set_bottom_border(self, val)

source code 

Set the presence or absence of bottom border.

Parameters:
  • val - True indicates a border should be used, False indicates no border.

set_left_border(self, val)

source code 

Set the presence or absence of left border.

Parameters:
  • val - True indicates a border should be used, False indicates no border.

set_right_border(self, val)

source code 

Set the presence or absence of rigth border.

Parameters:
  • val - True indicates a border should be used, False indicates no border.

set_background_color(self, color)

source code 

Set the background color of the paragraph.

Parameters:
  • color - tuple representing the RGB components of a color (0,0,0) to (255,255,255)

set_alignment(self, align)

source code 

Set the paragraph alignment.

Parameters:
  • align - PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, or PARA_ALIGN_JUSTIFY