Skip to content

emafriedrich/cesar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cesar

JasperReport for ruby MRI enviroments

Instalation

gem install cesar

Use

[cesar] (https://github.com/emafriedrich/cesar) provide four methods for generate or print reports through JasperReport

    Cesar.generate
    Cesar.pdf_export
    Cesar.excel_export
    Cesar.print

With the next options

    :export_to => :pdf || :excel 
    :datasource => :xml || :csv || :sql
    :datasource_path => String # with path of datasource (csv, xml, or properties file)
    :export_path => String # with path for export the report (Rails.root + "/tmp/pdf.pdf" for example)
    :print => true # for print the report on default printer
    :child_node => String #examples below
    :id => Number #in sql datasources for put a parameter into report if neccesary(id of a object o record for example)

pdf_export, excel_export and print methods are short way for pdf export, excel export and print reports, respectly

The report_path should not have the .jasper extension.

Examples

Generate pdf report

    Cesar.pdf_export  'report_path',
                       datasource: :sql,
                       datasource_path: 'properties_file',
                       export_path: 'pdf_file'

Generate excel report

    Cesar.excel_export  'report_path',
                         datasource: :sql,
                         datasource_path: 'properties_file',
                         export_path: 'excel_file'

For sql datasources the properties file may be the :id option

more examples in test folder

:child_node (only xml datasources)

If your structure is similar to

    <a>
      <b></b>
      <b></b>
    </a>

child_node must be equal to "b" to indicate to Cesar that you want export or print 1 report with 2 instance of "b". In other words, 1 report with 2 reports in 1 print job

Requirements

Cesar require java >= 7

datasource: :sql

Only support for postgresql. If you wont support for other DBMS, open a issue.

About

JasperReport for ruby MRI enviroments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published