Hello:
One question more. Now, I want do a report with bars and lines in the graph. I am triying this (https://playground.jsreport.net/studio/workspace/HyqJPOI3x/23). Any ideas?
Hello:
One question more. Now, I want do a report with bars and lines in the graph. I am triying this (https://playground.jsreport.net/studio/workspace/HyqJPOI3x/23). Any ideas?
Hello:
Thank you very much for your help.
I solved the error, it was silly. Attribute "helpers" in the API call work correctly. The error was in the string content of the attribute "helpers." You and I put:
"function hackMerge(fileName, path, opts) { opts.data.root.$xlsxTemplate[fileName].hack = function () { return new Function('obj', 'return obj' + path)(opts.data.root.$xlsxTemplate[fileName]); } xlsxMerge.call(this, fileName, 'hack()', opts) }"
And the correct way is:
"function hackMerge(fileName, path, opts) { opts.data.root.$xlsxTemplate[fileName].hack = function () { return new Function('obj', 'return obj' + path)(opts.data.root.$xlsxTemplate[fileName]); }; xlsxMerge.call(this, fileName, 'hack()', opts) }"
With special attention to semicolon (";") before the if-else statement.
I have worked very hard creating tables in JSReport. I have created an adapted example for anyone who has the same needs as I did. The example is this (https://playground.jsreport.net/studio/workspace/HyqJPOI3x/21).
I have not altered the default jsreport server configuration and my tasks.strategy file is empty.
I tried your solution:
{
template: {
content: dataContent,
recipe: 'xlsx',
engine: "handlebars",
phantom: optionsPhantom,
xlsxTemplate: {
shortid: idXLSXTemplate
},
"helpers": "function hackMerge(fileName, path, opts) {\n \/\/ workaround for this bug\n \/\/ https:\/\/github.com\/jsreport\/jsreport-xlsx\/issues\/20\n opts.data.root.$xlsxTemplate[fileName].hack = function () {\n return new Function('obj', 'return obj' + path)(opts.data.root.$xlsxTemplate[fileName]);\n }\n \n xlsxMerge.call(this, fileName, 'hack()', opts)\n}"
},
data : dataReport
}
And I get this error:
Error during rendering report:
Unexpected identifier evalmachine.<anonymous>:409
function hackMerge(fileName, path, opts) { opts.data.root.$xlsxTemplate[fileName].hack = function () { return new Function('obj', 'return obj' + path)(opts.data.root.$xlsxTemplate[fileName]); } xlsxMerge.call(this, fileName, 'hack()', opts) }
^^^^^^^^^
SyntaxError: Unexpected identifier
xlsXmerge it´s not declared
Hello:
No. I store the templates in JSReport, but I don´t store the template content, or the data (I use API call) This configuration works fine in my project. The problem is: I don´t know how to add the "hackMerge" function in the API call. I have tried the last solution and it results in error. How can I solve this problem?
Example to the API call:
{
template: {
content: dataContent,
recipe: 'xlsx',
engine: "handlebars",
phantom: optionsPhantom,
xlsxTemplate: {
shortid: idXLSXTemplate
}
},
data : dataReport
}
Hello:
Thank you very much jan_blaha. You are great!
One more question: working on your solution I encountered another problem- I am working with JSReport through its API. To resolve the bug you suggest ("['c:chartSpace']['c:chart'][0]['c:plotArea'][0]['c:barChart'][0]") I need to add the "hackMerge" function to the figure in your example. I have tried to add this function in:
In all cases I receive a similar error (with xlsxMerge):
......mplate[fileName]); } xlsxMerge.call(this, fileName, 'hack()', opts) }.......
SyntaxError: Unexpected identifier
Could you explain to me how to solve this problem?
Hello:
Thank you for your attention. I am going to try to explain my problema in more detail. I have this Project (https://playground.jsreport.net/studio/workspace/Hy_V2BSh/53). The only problem that I have is with Sheet5 of the XLSX template. I want the graph on Sheet5 to be fed by the data from Table5. By default the size of the graph in the template is A1:B2. However, I need that the size of the graph to adapt dynamically according to the size indicated by Table 5 (in this case A1:E4, in other cases other sizes). I do not know how to have the size of the graph change dynamically, could you explain to me how to make this happen?
Thank you very much.
Hello:
I am using JSReport in my project. I am very happy with the tool. Now I have an important issue with one template. I want to build a basic report similar to this (https://playground.jsreport.net/studio/workspace/rJftqRaQ/10). But I want the table to be dynamic for the variables: height and weight. I don´t know how do this. Here is an example of how I would like the report to be (https://playground.jsreport.net/studio/workspace/BkyX5BZ3l/6).