[GNC] What is wrong with this custom stylesheet code?

Geert Janssens geert.gnucash at kobaltwit.be
Tue Jul 4 10:59:32 EDT 2023


Any error messages in gnucash.trace when the loading fails ?

Regards,

Geert

Op dinsdag 4 juli 2023 03:57:17 CEST schreef Vincent Dawans:
> HI Robert:
> 
> Here are a few things you need to change:
> 
> That very last statement (gnc:make-html-style-sheet "DWS_Stylesheet" (N_
> "DWS Stylesheet")) the first parameter is actually the template name
> defined just above, so it should be "DWS Stylesheet" without the
> underscore. The second parameter is the name of the default stylesheet
> created based on that template. You can use the same name as the template
> or you could call your Template "DWS Template" both here and above, as in:
> 
> (gnc:define-html-style-sheet
>  'version 3.0
>  'name (N_ "DWS Template")
>  'renderer dws-renderer
>  'options-generator dws-options)
> 
> (gnc:make-html-style-sheet "DWS Template" (N_ "DWS Stylesheet"))
> 
> I would also advise you put your code in a separate scm file, for instance
> dws.scm, then store it in the USER_DATA directory .local/share/gnucash and
> load it from config-user.scm by adding
> 
> (load (gnc-build-userdata-path "dws.scm"))
> 
> Finally, possibly you are hitting a bug with the inability to save or there
> is something I don't know about loading the template because I have the
> same problem. Actually it's saving fine, you can see it in
> local/share/gnucash/stylesheets-2.0. It's the loading that's not working. I
> am wondering if it's not trying to load the saved stylesheet before running
> config-user.scm and therefore not finding it or something like that. But if
> I put the scm file directly in the main template directory under gnucash
> then it works, it's loading the saved settings, so that's a work-around.
> You don't load it in config-user.scm; instead you copy the file to
> 
> <gnucash install
> dir>/gnucash/share/guile/site/2.2/gnucash/report/stylesheets/
> 
> Sincerely,
> 
> Vincent Dawans
> 
> Then it saves fine for me.
> 
> On Mon, Jul 3, 2023 at 7:17 AM Robert Heller <heller at deepsoft.com> wrote:
> > I have written a style sheet module and it *seems* to be loading now, but
> > things are wonky any I don't know why.
> > 
> > What I am *trying to go:
> > 
> > 1) Put my company letterhead across the top of the invoice
> > 2) Put a "button image" (Payments by PayPal) under the invoice table.
> > 
> > My custom stylesheet code adds two options: the button image and some
> > (optional) text to put under the button image (typically the e-mail
> > address to
> > use as the payment target).
> > 
> > Several things are not working:
> > 
> > If I use the Edit->Style Sheets options and create a new stylesheet from
> > my
> > template, the addition options are not available (why?) If I just edit the
> > template itselt (with Edit->Style Sheets) I can set the header image and
> > the


More information about the gnucash-user mailing list