[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Generating pages with tables in the new PDF generation code
From: |
Vadim Zeitlin |
Subject: |
[lmi] Generating pages with tables in the new PDF generation code |
Date: |
Wed, 16 Aug 2017 01:01:45 +0200 |
Hello,
I've finally finished writing and tidying up code for generating pages
with tables in the new PDF generation code and would like to hear your
feedback about it if possible.
First, I couldn't find any acceptable way to define the tables in the
external Mustache template files, so the tables themselves are implemented
entirely in code, even if the fixed part of the page before the table can
still come from the template. This is not ideal because any changes to the
table require editing C++ code and rebuilding it but, again, I just don't
see how to specify the table structure externally in anything that could
still be qualified an HTML templating language.
To make this more concrete, here is how the template for the "Tabular
Detail" page looks like:
https://github.com/vadz/lmi/blob/97ddfb2e7532a49b4ac367b6e8b7e3f2d96e9f4c/tabular_details.mustache
(notice that it has no trace of the table in it) and here is the code
responsible for actually generating the table:
https://github.com/vadz/lmi/blob/97ddfb2e7532a49b4ac367b6e8b7e3f2d96e9f4c/ledger_pdf_generator_wx.cpp#L1850
This code on its own probably doesn't make much sense, but hopefully it
does become clearer if you look at the definition of
page_with_tabular_report class at
https://github.com/vadz/lmi/blob/97ddfb2e7532a49b4ac367b6e8b7e3f2d96e9f4c/ledger_pdf_generator_wx.cpp#L1715
first. This class basically implements both "Tabular Detail" and "Tabular
Details, continued" pages at once and avoids code duplication between them
(and other similar pages in other illustrations) at the price of some extra
complexity due to another level of indirection.
As I said in the beginning of this email, I'd welcome your comments, both
generally, i.e. if you accept the idea of creating tables in the C++ code,
at least for now, and any more precise remarks about the code at the links
above.
Thanks in advance,
VZ
- [lmi] Generating pages with tables in the new PDF generation code,
Vadim Zeitlin <=
- Re: [lmi] Generating pages with tables in the new PDF generation code, Greg Chicares, 2017/08/16
- Re: [lmi] Generating pages with tables in the new PDF generation code, Vadim Zeitlin, 2017/08/17
- Re: [lmi] Generating pages with tables in the new PDF generation code, Greg Chicares, 2017/08/27
- Re: [lmi] Generating pages with tables in the new PDF generation code, Vadim Zeitlin, 2017/08/27
- [lmi] XML sorting [Was: Generating pages with tables in the new PDF generation code], Greg Chicares, 2017/08/27
- Re: [lmi] XML sorting, Vadim Zeitlin, 2017/08/27
- Re: [lmi] XML sorting, Greg Chicares, 2017/08/27
- Re: [lmi] Generating pages with tables in the new PDF generation code, Greg Chicares, 2017/08/27