Pyrtf Documentation
This page contains the Pyrtf Package documentation.
The Elements Module
-
gluon.contrib.pyrtf.Elements.B(*params)
-
class gluon.contrib.pyrtf.Elements.Cell(*params, **kwargs)
Bases: list
clvertalt Text is top-aligned in cell (the default).
clvertalc Text is centered vertically in cell.
clvertalb Text is bottom-aligned in cell.
cltxlrtb Vertical text aligned left (direction bottom up).
cltxtbrl Vertical text aligned right (direction top down).
-
SetAlignment(value)
-
SetFlow(value)
-
SetFrame(value)
-
SetMargins(value)
-
SetSpan(value)
-
SetStartVerticalMerge(value)
-
SetVerticalMerge(value)
-
append(*params)
-
class gluon.contrib.pyrtf.Elements.Document(style_sheet=None, default_language=None, view_kind=None, view_zoom_kind=None, view_scale=None)
-
Copy()
-
NewSection(*params, **kwargs)
-
SetTitle(value)
-
gluon.contrib.pyrtf.Elements.I(*params)
-
class gluon.contrib.pyrtf.Elements.Image(infile, **kwargs)
Bases: gluon.contrib.pyrtf.Elements.RawCode
-
ToRawCode(var_name)
-
class gluon.contrib.pyrtf.Elements.Inline(*params)
Bases: list
-
append(*params)
-
class gluon.contrib.pyrtf.Elements.LINE
-
gluon.contrib.pyrtf.Elements.MakeDefaultStyleSheet()
-
class gluon.contrib.pyrtf.Elements.Paragraph(*params)
Bases: list
-
append(*params)
-
insert(index, value)
-
class gluon.contrib.pyrtf.Elements.RawCode(data)
-
class gluon.contrib.pyrtf.Elements.Section(paper=None, margins=None, break_type=None, headery=None, footery=None, landscape=None, first_page_number=None)
Bases: list
-
SetBreakType(value)
-
SetFirstPageNumber(value)
-
SetLandscape(value)
-
SetMargins(value)
-
TwipsToRightMargin()
-
class gluon.contrib.pyrtf.Elements.StyleSheet(colours=None, fonts=None)
-
class gluon.contrib.pyrtf.Elements.TAB
-
gluon.contrib.pyrtf.Elements.TEXT(*params, **kwargs)
-
class gluon.contrib.pyrtf.Elements.Table(*column_widths, **kwargs)
-
AddRow(*cells)
-
SetAlignment(value)
-
SetColumnWidths(*column_widths)
-
SetGapBetweenCells(value)
-
SetLeftOffset(value)
-
append(*cells)
-
class gluon.contrib.pyrtf.Elements.Text(*params)
-
SetData(value)
-
gluon.contrib.pyrtf.Elements.U(*params)
-
exception gluon.contrib.pyrtf.Elements.UnhandledParamError(param)
- Bases: exceptions.Exception
The Renderer Module
-
class gluon.contrib.pyrtf.Renderer.Renderer(write_custom_element_callback=None)
-
Write(document, fout)
-
WriteInlineElement(inline_elem)
-
WriteParagraphElement(paragraph_elem, tag_prefix='', tag_suffix='\par', opening='{', closing='}')
-
WriteRawCode(raw_elem)
-
WriteTableElement(table_elem)
-
WriteText(text)
-
WriteTextElement(text_elem)
-
class gluon.contrib.pyrtf.Renderer.Settings
Bases: list
-
Join()
-
append(value, mask=None, fallback=None)
The PropertySets Module
PropertySets group common attributes together, each property set is used to control a specific part of the rendering.
PropertySets can be used in different elements of the document.
For example the FramePropertySet is used in paragraphs, tables, cells, etc.
The TextPropertySet can be used for text or in a Paragraph Style.
-
class gluon.contrib.pyrtf.PropertySets.AttributedList(accepted_type=None)
Bases: list
-
append(*values)
-
gluon.contrib.pyrtf.PropertySets.BorderPS
- alias of BorderPropertySet
-
class gluon.contrib.pyrtf.PropertySets.BorderPropertySet(width=None, style=None, colour=None, spacing=None)
-
SetColour(value)
-
SetSpacing(value)
-
SetStyle(value)
-
SetWidth(value)
-
class gluon.contrib.pyrtf.PropertySets.Colour(name, red, green, blue)
-
SetBlue(value)
-
SetGreen(value)
-
SetName(value)
-
SetRed(value)
-
class gluon.contrib.pyrtf.PropertySets.Colours
- Bases: gluon.contrib.pyrtf.PropertySets.AttributedList
-
class gluon.contrib.pyrtf.PropertySets.Font(name, family, character_set=0, pitch=None, panose=None, alternate=None)
-
SetAlternate(value)
-
SetCharacterSet(value)
-
SetFamily(value)
-
SetName(value)
-
SetPanose(value)
-
SetPitch(value)
-
class gluon.contrib.pyrtf.PropertySets.Fonts
- Bases: gluon.contrib.pyrtf.PropertySets.AttributedList
-
gluon.contrib.pyrtf.PropertySets.FramePS
- alias of FramePropertySet
-
class gluon.contrib.pyrtf.PropertySets.FramePropertySet(top=None, left=None, bottom=None, right=None)
-
SetBottom(value)
-
SetLeft(value)
-
SetRight(value)
-
SetTop(value)
-
gluon.contrib.pyrtf.PropertySets.MakeAttributeName(value)
-
gluon.contrib.pyrtf.PropertySets.MarginsPS
- alias of MarginsPropertySet
-
class gluon.contrib.pyrtf.PropertySets.MarginsPropertySet(top=None, left=None, bottom=None, right=None)
-
SetBottom(value)
-
SetLeft(value)
-
SetRight(value)
-
SetTop(value)
-
class gluon.contrib.pyrtf.PropertySets.Paper(name, code, description, width, height)
-
SetCode(value)
-
SetDescription(value)
-
SetHeight(value)
-
SetName(value)
-
SetWidth(value)
-
class gluon.contrib.pyrtf.PropertySets.Papers
- Bases: gluon.contrib.pyrtf.PropertySets.AttributedList
-
gluon.contrib.pyrtf.PropertySets.ParagraphPS
- alias of ParagraphPropertySet
-
class gluon.contrib.pyrtf.PropertySets.ParagraphPropertySet(alignment=None, space_before=None, space_after=None, tabs=None, first_line_indent=None, left_indent=None, right_indent=None, page_break_before=None)
-
Copy()
-
SetAlignment(value)
-
SetFirstLineIndent(value)
-
SetLeftIndent(value)
-
SetPageBreakBefore(value)
-
SetRightIndent(value)
-
SetSpaceAfter(value)
-
SetSpaceBefore(value)
-
SetSpaceBetweenLines(value)
-
SetTabs(*params)
-
gluon.contrib.pyrtf.PropertySets.ShadingPS
- alias of ShadingPropertySet
-
class gluon.contrib.pyrtf.PropertySets.ShadingPropertySet(shading=None, pattern=None, foreground=None, background=None)
-
SetBackground(value)
-
SetForeground(value)
-
SetPattern(value)
-
SetShading(value)
-
gluon.contrib.pyrtf.PropertySets.TabPS
- alias of TabPropertySet
-
class gluon.contrib.pyrtf.PropertySets.TabPropertySet(width=None, alignment=None, leader=None)
-
SetAlignment(value)
-
SetLeader(value)
-
SetWidth(value)
-
gluon.contrib.pyrtf.PropertySets.TextPS
- alias of TextPropertySet
-
class gluon.contrib.pyrtf.PropertySets.TextPropertySet(font=None, size=None, bold=None, italic=None, underline=None, colour=None, frame=None, expansion=None)
-
Copy()
-
SetBold(value)
-
SetColour(value)
-
SetDottedUnderline(value)
-
SetDoubleUnderline(value)
-
SetExpansion(value)
-
SetFont(value)
-
SetFrame(value)
-
SetItalic(value)
-
SetSize(value)
-
SetStrikeThrough(value)
-
SetUnderline(value)
-
SetWordUnderline(value)
The pyrtf Package
-
gluon.contrib.pyrtf.dumps(doc)
The Constants Module
-
class gluon.contrib.pyrtf.Constants.Languages
-
classmethod IsValid(value)
-
class gluon.contrib.pyrtf.Constants.ViewKind
An integer (0-5) that represents the view mode of the document.
-
classmethod IsValid(value)
-
class gluon.contrib.pyrtf.Constants.ViewScale
Zoom level of the document; the N argument is a value representing a percentage (the default is 100).
-
classmethod IsValid(value)
-
class gluon.contrib.pyrtf.Constants.ViewZoomKind
An integer (0 to 2) that represents the zoom kind of the document.
-
classmethod IsValid(value)
The Styles Module
A Styles is a collection of PropertySets that can be applied to a particular RTF element.
At present there are only two, Text and Paragraph but ListStyles will be added soon too.
-
class gluon.contrib.pyrtf.Styles.ParagraphStyle(name, text_style, paragraph_props=None, frame_props=None, shading_props=None)
-
Copy()
-
SetBasedOn(value)
- Set the Paragraph Style that this one is based on.
-
SetFramePropertySet(value)
-
SetName(value)
-
SetNext(value)
- Set the Paragraph Style that should follow this one.
-
SetParagraphPropertySet(value)
-
SetShadingPropertySet(value)
- Set the background shading for the paragraph.
-
SetTextStyle(value)
-
class gluon.contrib.pyrtf.Styles.TextStyle(text_props, name=None, shading_props=None)
-
Copy()
-
SetName(value)
-
SetShadingPropertySet(value)
-
SetTextPropertySet(value)