9.5. Creating Reports and Charts


This section may need updating !!!

It is possible to write reports if the current ones are not suitable. To do this you will need to know Scheme (a LISP-like programming language), and it is an excellent idea to have a copy of the GnuCash source code available.

The reporting interface is documented in the source code file src/report/report-system/doc/report-html.txt. The file src/report/utility-reports/hello-world.scm in the GnuCash source distribution provides a good example of how reports are developed.

9.5.1. Accessing the GnuCash API

It is also necessary to access data from the engine to get information for your report. This is since version 2.1.x performed by a set of Scheme wrapper functions that are documented in the file src/engine/swig-engine.c. Up to version 2.0.5 it was src/g-wrap/gnc.html. Examine some of the other reports in src/scm/report for an indication of how they are used.

Some users started a table in the GnuCash wiki Custom Reports#The GnuCash API.

Because the above file only contains the syntax of the function you can use the Doxygen source documentation either local after running

./configure --enable-doxygen --enable-html-docs
make doc

on your sources or online http://code.gnucash.org/docs/MAINT/ or http://code.gnucash.org/docs/MASTER/ to get more information about the functions.

9.5.2. Report Rendering

At present, reports are produced by calling a HTML-generation API, which outputs a dialect of HTML and rendering this with a HTML widget. This has limitations, particularly when trying to align objects precisely, as might be necessary for printing onto pre-printed invoices for example.