Glom: Reports/Printing

Printing/Reports is the last big task for Glom before it's
fundamentally usable, I think. It's also the perfect thing for other people to hack on, because it doesn't need much knowledge of the existing code. The Document object can tell you about the database structure and you can get the data directly from Postgres itself, using the existing GlomConversion functions to display the values appropriately in the locale.

I don't plan to muck around with libgnomeprint, considering that cairo should replace it somehow within the foreseeable future. So I'm happy just to ouput HTML and let the browser take care of printing it. We'd need HTML output anyway.

I already coded a proof of concept. Choosing File|Print in the Details view does the following:

  • Creates an XML document, in memory
  • Transforms the XML to HTML, in memory, using an installed XSLT file.
  • Saves the HTML to a temporary file and shows it in the browser.

The output is ugly but any non-hacker can improve it by editing the XSLT file and/or adding a stylesheet.

However, people will want to create custom printouts for Details, such as Invoice printouts, and they will want to create grouped List reports. For the reports, they will need to specify (optional) parts like:

  • Headers – e.g. “Staff Payroll Summary”
  • Group-By sub-titles (repeated, nested) – e.g. “Departments:”
  • Record Details (repeated) – e.g. Bob McBob, Sales, EUR 99.999
  • Group-By Summary (repeated) – e.g. Number of staff: 5, Total salary: 888,888
  • Footers – e.g. “Page ??. Confidential.”

The UI for adding and arranging these parts to a layout might use a TreeView, or maybe a canvas. It's worth looking at FileMaker, but layout is very fiddly with FileMaker, and people find the print layout UI very unintuitive.

I don't know of any existing report generators for Linux, but maybe there's a good one. I'm happy to cooperate and reuse code wherever the license allows.