rapport v0.5.0 Rapport

Rapport aims to provide a robust set of modules to generate HTML reports that both looks good in the browser and when being printed.

Link to this section Summary

Functions

Adds a new page to a report

Adds a new page to a report

Adds a list of pages to a report

Generates HTML for the report

Creates a new report

Sets the padding (in millimeters) for the report

Sets the paper size for the report

Sets the rotation for the report

Sets the title for a report. This is the title of the generated html report

Link to this section Functions

Link to this function add_page(report, page)

Adds a new page to a report.

Options

Link to this function add_page(report, page_template, fields)

Adds a new page to a report.

Options

  • report - A Rapport.Report struct that you want to add the page to.
  • page_template - An EEx template for the page
  • fields - A map with fields that must be assigned to the EEx template
Link to this function add_pages(report, pages)

Adds a list of pages to a report.

Options

Link to this function generate_html(report)

Generates HTML for the report.

Options

Link to this function new(template \\ "", fields \\ %{})

Creates a new report.

An optional EEx template can be passed to the new function. This template is meant to hold global things like styles, fonts etc that can be used on all pages thats added to the report.

The new function sets the default paper size to :A4, the rotation to :portrait, the page padding to 10mm and the report title to “Report”. Those defaults can easily be overridden by using set_paper_size/2, set_rotation/2, set_padding/2 and set_title/2.

Returns a Rapport.Report struct.

Options

  • template - An optional EEx template for the report.
  • fields - A map with fields to assign to the EEx report template
Link to this function set_padding(report, padding)

Sets the padding (in millimeters) for the report.

It expects the padding to be an integer and must be 10, 15, 20 or 25 mm, otherwise ArgumentError will be raised.

Options

  • report - The Rapport.Report that you want set the padding for
  • rotation - The padding.
Link to this function set_paper_size(report, paper_size)

Sets the paper size for the report.

It expects the paper size to be an atom and must be :A4, :A3, :A5, :half_letter, :letter, :legal, :junior_legal or :ledger, otherwise ArgumentError will be raised.

Options

  • report - The Rapport.Report that you want set the paper size for
  • paper_size - The paper size.
Link to this function set_rotation(report, rotation)

Sets the rotation for the report.

It expects the rotation to an atom and must be :portrait or :landscape, otherwise ArgumentError will be raised.

Options

  • report - The Rapport.Report that you want set the rotation for
  • rotation - The rotation.
Link to this function set_title(report, title)

Sets the title for a report. This is the title of the generated html report.

Options

  • report - The Rapport.Report you want to set the title for.
  • title - The new title