I am adding a playground link
https://playground.jsreport.net/w/teodora.gardjeva-pesheva/YUe5Y7~q
As you can see, the data is filled in sequentially. It iterates from the first row, but can not fill in the cells if another table already filled them in
The tables are filled in the following order: table3, table1, table2
teodoragardjeva
@teodoragardjeva
Posts made by teodoragardjeva
-
RE: Jsreport xlsx with multiple tables on same sheet
-
Jsreport xlsx with multiple tables on same sheet
Hi,
I have an .xlsx file that I have imported as an asset. In it I have configured in Sheet1 three tables.
Table1: A, B columns
Table2: E, F, G columns
Table3: L,M columns
base on which I have added Named Ranges for each column with offset and counta. Those ranges I use in other sheets in same xlsx file to show different types of graphs. So far so good. All of that set up in the xlsx asset file works fine
Then I have created a new template in jsreport studio with xlsx and handlebars. This template uses the asset mentioned above.
Then I iterate with {{#each}} three data collections I have in order to fill in the data in the three table. In order to put the data in the right column, I am using the "r" attribute of the cell. This also works fine
What is not working is that the tables are not filled in from row 1, but sequentially. If first {{#each}} stops on row 5, then the second {{#each}} will start filling data from the row 5. With the help of an AI tool I found out this is normal behavior of handlebars {{xlsxAdd}}. It adviced me to use {{xlsxMerge}} , but then It does not fill in any data at all.
P*S I have inner {{#each}} in the structure that prints the data
Would you please help me understand how to print the data in the three tables at the right columns, but starting from 2nd row (to respect the headers) -
Problem with installing/upgrading jsreport on CentOS
Hi,
we have been using jsreport for our main reporting tool for over two years.
We the developers are really pleased with the API that jsreport provides, but deployment on the server has been really a nightmare for us.
Installing JSreport on our PCs with Windows works like a charm, but it is not the case when it comes to the server.
Currently we are deploying jsreport on CentOS, which becomes harder and harder to maintain. We want to upgrade to latest jsreport, but can't install packages and run the server successfully.
It turns out that not all of the npm packages can be installed on CentOS easily, according to our colleague he experienced the same in the past when he had to setup initially jsreport on the server.
So we are ready to change. We are willing to setup the jsreport from scratch on a dedicated server.
That's why we will be grateful, if you advice us about the best way to maintain a jsreport in production environment. This are the questions that we need help for:- Which is the best suitable Linux based OS to be used for running jsreport?
- Do you have some hardware limitations for RAM, CPU, ect.
- What are the requirements other than node.js (>= 8.9), npm (>= 6.x)., we want to upgrade to latest jsreport version
- What is the preferable way to build deployment packages: standard package deploy or docker usage. Currently we use docker but we face some difficulties, which may be caused by the server OS
These are the development packages that we need to install to run our reports, we use chrome-pdf, xlsx, and handlebars to load reports:
"jsreport": "2.9.0", "jsreport-chrome-pdf": "1.8.0", "jsreport-cli": "2.2.4", "jsreport-pdf-utils": "1.8.0", "jsreport-version-control": "1.5.0"
Thanks for your help,
Teodora -
RE: class="pageNumber" and class="totalPages" in parallel report generationg with pdf-utils
Thanks for the replay. It worked perfectly, with this implementation report of 80 pdf pages was generated for 40 seconds, while before it was taking 100 seconds which is huge improving. Thanks
-
RE: class="pageNumber" and class="totalPages" in parallel report generationg with pdf-utils
Hi, I tried what you suggested. From the start I didn't want to go in that direction, cause before we got header/footer in pdf utils, but because of the merge to every page with Header-Footer util the generation time was twice bigger than with the usage of "Display header/footer" option.
Anyway, I tried now with pdf-utils header and footer. Now my problem is that the Header-Footer template is merged to the first page only. From the api I see three params only, seems like merge whole documents is not available, or I don't know how to do it.
Here is a sample playground that imitates what I am trying to achieve with our reportshttps://playground.jsreport.net/w/teodora.gardjeva.pesheva/rcbQXUsu
Thanks for the help
-
class="pageNumber" and class="totalPages" in parallel report generationg with pdf-utils
Hi, I am using handlebars and chrome-pdf to generate a report. We have some pretty big pdf files that takes forever to be generated so I decided to give it a try to the pdf-utils parallel generation.
So far so good, with reducing some necessary big css assets it went down from 90 seconds to 40 seconds.
The problem is that I am using the option "display header/footer". where in the footer the html is<span class="pageNumber"></span> / <span class="totalPages"></span>
The values of pageNumber and totalPages are not kept through the different parallel generations. One stream generates 14 pages. So report of 70 pages will have 5 times count - 1/14, 2/14 - 14/14 and the again 1/14, 2/14 instead of 1/70, 2/70
here is my code
async function afterRender(req, res) { const pages = Math.ceil(req.data.allData[0].values.length / req.data.chunckSize); const renderPromises = []; let reqData; for (let i = 0; i < pages; i += 1) { //...do calculations to split data per page renderPromises.push(jsreport.render({ template: { name: 'reportTemplate' }, data: reqData })); } const results = await Promise.all(renderPromises); for (let i = 0; i < results.length; i++) { if (i == 0) { res.content = results[i].content; // the main report is blank template, so override it } else { res.content = await jsreport.pdfUtils.append(res.content, (results[i].content)); } } }
I tried also with other way around from i = results.length - 1; to prepend templates, but the result is still the same.
What do I have to fix to keep the paging correct throughout the whole report?
Thanks,
Teodora -
RE: XLSX file corrupted after download from JSreport using API
We are facing the same issue. If I execute jsreport.renderAsync directly from client side the Excel files are downloaded correctly. But if I use node.js server (with Docker) to download the file is corrupted. I still can't provide more infomation, because the colleague that is developing the node.js API has one more day off. The pdf files are working fine. When he is back, if it is not error on his side we will provide corrupted file. But I assume that it won't be, having in mind that we are not the first one facing the problem.
Best regards,
Teodora -
RE: jsreport@2.1.0 in development mode using configuration file: none
Hi, after lot of struggling I think that I manage to fix this. The solution with downgrading node.js didn't work. Then I tried to install empty 1.10.0 jsreport and migrate it. Like that it worked. So I thought that something is breaking the migration on my PC that is not part of jsreport native (strangely this is not the case on my colleague PC). So we have in the project some external js files that are being required from tempalte scripts. Normally this are valid files but when I checkouted the project, removed the helper js files the migration went fine with recognizing jsreport.config.json.
To be sure that this works I did the same steps again. Next time it didn't work. So something is comepletely wrong with execution on my PC. -
RE: jsreport@2.1.0 in development mode using configuration file: none
jsreport start from D:\Proj\jsReportDev folder and it has been working perfectly fine till I migrated today.
I checkouted the project again from git and migrated it and the same problem occurred. If I stay on 1.10 version it works.
We have a license for single server jsreport and we really want to update production server to version 2 -
RE: jsreport@2.1.0 in development mode using configuration file: none
The project was created from scratch: jsreport init as a start point. The things is that the same project on other person machine doesn't have the same problem after migration steps.
Just for test I tried on my PC to create completely new jsreport and there everything went fine.
This is server.js:
var jsreport = require('jsreport')()if (process.env.JSREPORT_CLI) {
// export jsreport instance to make it possible to use jsreport-cli
module.exports = jsreport
} else {
jsreport.init().then(function () {
// running
}).catch(function (e) {
// error during startup
console.error(e.stack)
process.exit(1)
})
}And this is the jsreport.config.json:
{
"certificate": {
"key": "certificates/jsreport.net.key",
"cert": "certificates/jsreport.net.cert"
},
"httpPort": 5488,
"httpsPort": null,
"logger": {
"console": {
"transport": "console",
"level": "debug"
},
"file": {
"transport": "file",
"level": "info",
"filename": "logs/reporter.log"
},
"error": {
"transport": "file",
"level": "error",
"filename": "logs/error.log"
}
},
"blobStorage": {
"provider": "fs"
},
"phantom": {
"strategy": "dedicated-process",
"timeout": 60000
},
"allowLocalFilesAccess": false,
"store": {
"provider": "fs"
},
"templatingEngines": {
"strategy": "dedicated-process",
"timeout": 10000,
"allowedModules": [
"request",
"globals"
]
},
"extensions": {
"authentication": {
"cookieSession": {
"secret": "<your strong secret>"
},
"admin": {
"username": "admin",
"password": "password"
},
"enabled": false
},
"scripts": {
"allowedModules": "*",
"timeout": 60000
},
"sample-template": {
"createSamples": true
}
}
}And logs
2018-06-04T16:42:19.616Z - info: Initializing jsreport@2.1.0 in development mode using configuration file: none
2018-06-04T16:42:19.616Z - info: Searching for available extensions in D:\Proj\jsReportDev\node_modules\jsreport
2018-06-04T16:42:19.647Z - info: Extensions location cache contains up to date information, skipping crawling in D:\Proj\jsReportDev\node_modules\jsreport\node_modules
2018-06-04T16:42:19.663Z - info: Found 5 extensions
2018-06-04T16:42:19.663Z - debug: Writing extension locations cache to C:\Users\TEODOR~2\AppData\Local\Temp\jsreport\core\locations.json
2018-06-04T16:42:19.663Z - debug: Discovered 5 extensions
2018-06-04T16:42:19.678Z - info: Setting process based strategy for rendering. Please visit http://jsreport.net/learn/configuration for information how to get more performance.
2018-06-04T16:42:19.678Z - info: Using extension cli
2018-06-04T16:42:19.694Z - info: Using extension freeze
2018-06-04T16:42:19.694Z - info: Using extension chrome-pdf
2018-06-04T16:42:19.816Z - info: Using extension pdf-utils
2018-06-04T16:42:20.010Z - info: Using extension version-control
2018-06-04T16:42:20.139Z - info: reporter initialized