libreport

Libreport is the legacy code we use to generate some PDF and CSV reports. The PDF code wraps the ReportLab PDF generation library.

class libreport.csvreport.CSVReport[source]

CSVReport Is a class that creates raw CSV reports:

csvrpt = PDFRreport()
csvrpt.setLandscape(False)
csvrpt.setTitle("Title")
csvrpt.setTableData(queryset, fields, "Table Title")
csvrpt.setFilename("filename")
csvrpt.render()
setFilename(filename)[source]
Parameters:filename – filename for the generated pdf document
setPageBreak()[source]

force a page break

setTableData(queryset, fields, title)[source]

set table data

Parameters:
  • queryset – data
  • fields – table column headings
  • title – Table Heading
class libreport.pdfreport.MultiColDocTemplate(filename, frameCount=1, **kw)[source]

A multi column document template

@FIXME: need to remove frameCount to maintain consistency with BaseDocTemplate constructor and hence find a way to pass frameCount

addHeader(canvas, document)[source]

display the heading of the page or document

class libreport.pdfreport.PDFReport[source]

PDFReport

PDFReport Is a class that create table format reports The Title is placed on its own page for the first page usage:

pdfrpt = PDFRrepot()
pdfrpt.setLandscape(False)
pdfrpt.setTitle("Title")
pdfrpt.setTableData(queryset, fields, "Table Title")
pdfrpt.setFilename("filename")
pdfrpt.setNumOfColumns(2) # for two column setup
pdfrpt.render()
enableFooter(state)[source]

enable formatter for the last row of the table e.g for summaries have bold border lines

getRowHeights(numOfRows)[source]

retuns the row heights

setElements(elements)[source]

Add elements like paragraphs to the overall data

setFilename(filename)[source]
Parameters:filename – filename for the generated pdf document
setFirstRowHeight(height)[source]

Set the height of the first row

setFontSize(size)[source]
Parameters:size – font-size
setLandscape(state)[source]

enable or disable landscape display

Parameters:state – True or False
setNumOfColumns(cols)[source]
Parameters:cols – number of columns
setPageBreak()[source]

force/add a page break

setPrintOnBothSides(state)[source]
Parameters:state – True or False
setRowsPerPage(num)[source]

Sets the number of rows per page for Table data

setTableData(queryset, fields, title, colWidths=None, hasCounter=False)[source]

set table data

Parameters:
  • queryset – data
  • fields – table column headings
  • title – Table Heading
setTitle(title)[source]
Parameters:title – The Report Title
libreport.pdfreport.PreStyle

Preformatted Style

class libreport.pdfreport.RotatedParagraph(paragraph, aW, aH)[source]

Rotates a paragraph

class libreport.pdfreport.RotatedText(text, *args, **kwargs)[source]

Rotates text in a table cell.

class libreport.pdfreport.ScaledTable(*args, **kwargs)[source]

Scales a Table

libreport.pdfreport.p(txt)[source]

Create a text Paragraph using ParaStyle

libreport.pdfreport.pheader(txt, style=<ParagraphStyle 'Heading1'>, klass=<class reportlab.platypus.paragraph.Paragraph at 0x9d2e3ec>, sep=0.29999999999999999)[source]

Creates a reportlab PDF element and adds it to the global Elements list

Parameters:
  • style – can be a HeaderStyle, a ParaStyle or a custom style (default HeaderStyle)
  • klass – the reportlab Class to be called, default Paragraph
  • sep – space separator height
libreport.pdfreport.pre(txt)[source]

Create a text Preformatted Paragraph using PreStyle

Previous topic

childcount.utils

Next topic

mgvmrs

This Page