Changes

Jump to: navigation, search

Report-writing tutorial

88 bytes removed, 02:26, 28 December 2012
m
Document interface: format
Paragraph and font styles are defined in the <tt>make_default_style()</tt> function of the options class. The paragraphs are grouped into a <tt>StyleSheet</tt>, which the <tt>make_default_style()</tt> function defines. For the example report (<tt>DbSummary</tt>), the paragraph styles are defined as below:
<pre>
def make_default_style(self, default_style):
# Define the title paragraph, named 'DBS-Title', which uses a # 18 point, bold Sans Serif font with a paragraph that is centered
font = docgen.FontStyle() font.set_size(18) font.set_type_face(docgen.FONT_SANS_SERIF) font.set_bold(True)
para = docgen.ParagraphStyle() para.set_header_level(1) para.set_alignment(docgen.PARA_ALIGN_CENTER) para.set_font(font) para.set_description(_('The style used for the title of the page.'))
default_style.add_style('DBS-Title',para)
# Define the normal paragraph, named 'DBS-Normal', which uses a # 12 point, Serif font.
font = docgen.FontStyle() font.set_size(12) font.set_type_face(docgen.FONT_SERIF)
para = docgen.ParagraphStyle() para.set_font(font) para.set_description(_('The style used for normal text'))
default_style.add_style('DBS-Normal',para)
</pre>

Navigation menu