Header and Footer in jsreport-html-embedded-in-docx recipe
-
Hi All,
I am facing some issue in implementing header and footer in jsreport-html-embedded-in-docx recipe.
Can anyone have idea how we can achieve header and footer in jsreport-html-embedded-in-docx recipe?
Thanks!
-
This recipe is just a wrapper for this library so far
https://github.com/evidenceprime/html-docx-jsThere are some tricks mentioned here, but I wasn't able to let it run so far. Maybe you will have a better luck
https://github.com/evidenceprime/html-docx-js/search?q=header&type=issues
-
Hey @jan_blaha @bjrmatos
I'm trying to implement header footer on html-embedded-docx recipe using this https://sebsauvage.net/wiki/doku.php?id=word_document_generation#forcing_display_mode_on_opening Concept
For that I need to set header file path into main html file. I'm unable to apply correct path for that. Can you able to help me with that?
How we can set the path here in jsreport?
@page
{
mso-header: url("mydocument_files/headerfooter.htm") h1;
}However we can use path for the assets like images and font like below but this method is not working for the html file.
@font-face {
font-family: 'calibri';
src: url({#asset /demo/font/calibriRegular.ttf @encoding=dataURI});
}Thanks!
-
Does it actually work for you when you put there an absolute path to your local file?
@page { mso-header: url("/mydisk/mydocument_files/headerfooter.htm") h1; }
If yes, could you give me a full code so I can try it out?
I would make sure it works with jsreport assets then.
Thank you.
-
Hello @jan_blaha
Yes, It is working fine when I open normal html file with word application. Here is a playground https://playground.jsreport.net/w/Heplinesss_17/hhWfqTdd with the full code.
If you can help me to set path in jsreport that will be great.
Thanks!
-
Thank you,
I am trying this locally and adding to the URL something like this
mso-header: url("file:///d:/work/jsreport2/header.html") h1;
However, this doesn't print any header into docx?
Does this work for you?
-
Hey @jan_blaha
Let me share one clip, It's working fine in my local when I open html file with the word application : https://vimeo.com/554137761
I am using below path for my local:
mso-header: url("../demo/word_header.html") h1;Can we use same method for the jsreport word recipe?
Thanks!
-
Ah I see, you open html directly with the office. This is a bit different flow...
The library used in the recipe takes your HTML and wraps it with Word Processing ML and embeds it inside docx file.
I wasn't able to find a way how to include to the docx an additional file like header HTML using the library API.
It would likely mean forking/extending the library.I've submitted a task to our backlog to analyze this and provide a solution.
https://github.com/jsreport/jsreport/issues/808Unfortunately, our priority is now jsreport v3 release and we plan to concentrate on new features afterward, so it can take some time until we get there.
Maybe you can look at docx recipe, it isn't so simple to use as HTML, but it is the proper way of generating docx.