Giter VIP home page Giter VIP logo

carbone's People

Contributors

cadichon avatar cmaraujo87 avatar dgrelaud avatar douglascrp avatar rabel-e avatar rkaw92 avatar steevepay avatar toub avatar viincenb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carbone's Issues

Has anyone had any luck integrating with Libreoffice 6.2.x or 6.3.x in a Linux environment?

Hi,

Has anyone had any luck integrating with a Libreoffice 6.2.x or 6.3.x in a linux environment?

I set PYTHONPATH="/usr/lib/libreoffice/program" so that Carbone can find Uno, but I get some strange errors when Carbone's converter.py is attempting to import from com.sun.star...

When I run the test program with Nodejs debug turned on, i get:

  carbone:converter python stderr : Traceback (most recent call last):
  File "/usr/local/dcs/node_modules/carbone/lib/converter.py", line 9, in <module>
    from com.sun.star.document.UpdateDocMode import QUIET_UPDATE
  File "/usr/lib/libreoffice/program/uno.py", line 434, in _uno_import
    raise uno_import_exc
  File "/usr/lib/libreoffice/program/uno.py", line 356, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)
ImportError: No module named 'com' (or 'com.sun.star.document.UpdateDocMode.QUIET_UPDATE' is unknown)
 +109ms
  carbone:converter process Python of factory 0 died 1 +4ms
  carbone:converter process Office of factory 0 died null +70ms
  carbone:converter factory 0 is completely off +0ms
  carbone:converter python stderr : Traceback (most recent call last):
  File "/usr/local/dcs/node_modules/carbone/lib/converter.py", line 9, in <module>
    from com.sun.star.document.UpdateDocMode import QUIET_UPDATE
  File "/usr/lib/libreoffice/program/uno.py", line 434, in _uno_import
    raise uno_import_exc
  File "/usr/lib/libreoffice/program/uno.py", line 356, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)
ImportError: No module named 'com' (or 'com.sun.star.document.UpdateDocMode.QUIET_UPDATE' is unknown)
 +101ms
  carbone:converter process Python of factory 0 died 1 +4ms
  carbone:converter process Office of factory 0 died null +289ms
  carbone:converter factory 0 is completely off +0ms
  carbone:converter python stderr : Traceback (most recent call last):
  File "/usr/local/dcs/node_modules/carbone/lib/converter.py", line 9, in <module>
    from com.sun.star.document.UpdateDocMode import QUIET_UPDATE
  File "/usr/lib/libreoffice/program/uno.py", line 434, in _uno_import
    raise uno_import_exc
  File "/usr/lib/libreoffice/program/uno.py", line 356, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)
ImportError: No module named 'com' (or 'com.sun.star.document.UpdateDocMode.QUIET_UPDATE' is unknown)
 +99ms
  carbone:converter process Python of factory 0 died 1 +3ms

Thanks in advance for any advice!

Cheers,

Nathan

Image support

Hey,

great work here. I wonder if images are on the roadmap for this project? If yes, are there any plans yet for when this is going to be implemented? I'd love to be able to insert images dynamically into Word templates.

Processing .docx template with table of contents fails

Inserting a table of contents in a word .docx template causes processing to fail with the following errors:

Error: getSubstitutionFunction: Impossible to generate the XML builder.
SyntaxError: Invalid Unicode escape sequence
...

[Feature Request]: Add support for hyperlinks

Problem to solve
Currently there seems to be no way to add hyperlinks
(http://officeopenxml.com/WPhyperlink.php)

Proposed solution
Add option to write to document.xml.rels via formatter context. So we would be able to implement hyperlinks.

Describe alternatives you've considered
I've considered implementing via formatter similar to convCRLF(). But hyperlinks require writing Relationship to document.xml.rels.

How to Use ifContain Dynamically?

Hi guys, I've been struck from past few days. Actually For text replacement I'm Using :ifContain for example : {d.j1.INITIATOR.afterTypeACleaning3.18WipeThePartsWith70Ipa:ifContain(satisfactory✔, ✓):ifContain(no,X)} Here I'm replacing text with ✓ if it exists satisfactory✔ . Like the way now I had a requirement that if the text contains satisfactory✔ then I should map another Key else remain same.This is what I'm Trying {d.j1.INITIATOR.ensureThatStatusLabelIsUpdatedAsToBeCleaned:ifContain(S,({d.j1.USER[key="ensureThatStatusLabelIsUpdatedAsToBeCleaned"].commitedUser}))} .Where I'm doing wrong?Please throw some light. Does carbone support this kind of thing?

What if I have to merge existing PDF?

First of all, guys, congrats, u did a terrific job!

With our requirements in mind there are a couple of things I'm still not able to map with your tool, could you help me understanding if there's a way for the main one?

Merge of existing Documents
Our source of informations are:

  • a raw Json (which can be mapped as you clearly describe)
  • many photos (we can see a way into your documentation)
  • other docs / pdf (to be merged in a specific order)

The requirement is to be able to attach those "other docs" at a certain position of the final document, sometimes "other docs" are PDF with the same format of the ODT (e.g: Vertical A4), othertimes they could be (DOC, DOCX, TIFF, TXT) with different graphic format: (Horizontal, Letter, Legal), etc....

Thanks,
mM

Question about templates

Hello,

I've spend some time trying to figure out what i'm doing wrong. I'm trying to create a template for some data and I want to create 2 tables. The problem is that in the output the two tables are merged together.
Anyway to fix this?
carbone

Request for async formatter function support so we can query async data through formatter functions.

I'd appreciate it a lot if the project would support async function formatters, because then my formatter routines could make network requests/db requests to autopopulate common entries. Just maybe have a check on the formatter prototype so it awaits if the formatter function is detected to be async.

It would be even MORE rad if substitution values were checked prior to substitutions if they were a async/function type, and were called directly to generate values.

eg. data.value_to_substitute = async function()
{
return "some dynamic value here";
}

and in the ODT document you'd have something like {d.value_to_substitute} where it generates the value by calling the async routine in await.

Single file output for multiple documents? (batch process)

Say I wanted to create invoices. Is it possible to send an array of JSON objects to my invoice template and create an output file containing all of the invoices? We tend to process things in batches (invoices, packing slips, etc) and it isn't practical to open and print each file individually.

Conditional sections

Is there a possibility to construct the template so that some of text sections are included selectively (conditionally).

How to render HTML text on Document?

Hi All,
thanks for the great work you've done here!
I wondering if it's possible somehow to render HTML text on a document template.
I have HTML text stored from a WYSIWYG control.
the html text has lists, strong, br.

Low severity vulnerabilities in dependencies

foo@bar$ npm audit

                      === npm audit security report ===                        
                                                                                
┌──────────────────────────────────────────────────────────────────────────────┐
│                                Manual Review                                 │
│            Some vulnerabilities require your attention to resolve            │
│                                                                              │
│         Visit https://go.npm.me/audit-guide for additional guidance          │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ debug                                                        │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in>= 2.6.9 < 3.0.0 || >= 3.1.0                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ carbone                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ carbone > debug                                              │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/534                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Regular Expression Denial of Service                         │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ moment                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in>=2.19.3                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ carbone                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ carbone > moment                                             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/532                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
found 2 low severity vulnerabilities in 69 scanned packages
  2 vulnerabilities require manual review. See the full report for details.

Please update the dependencies of this module!
For those who are using this package in production and wondering whether they might be affected by these vulnerabilities, please read: owasp

Page break support?

Is there support for page breaks in templates? I tried by simply creating an ODT file (with repetitions) where each repetition I wanted to begin on a new page (inserting a page break to do so).

Is this something that's supported?

Font seems to mess To Calibri (From Open Sans)

Dear,

Its seem that it is not respecting original font from template.

I used Open Sans, and when I export to docx the font seems changed to Calibri.

What am I doind wrong? Or is it a liitation?]

Thanks

Loving Carbone so far. Is there any way to limit which substitutions take place? Aka, only replace specific {d.value} elements.

I'm generating massive reports, and want to only replace certain elements at a time. I noticed that if I have {d.value} elements in a document, and don't set a value, carbone just overwrites them with empty strings.

Is there some way to turn off this functionality? I essentially want to load a set of records into memory, run the rendering routine in carbone, produce a report, and have the empty values preserved in the generated report as {d.value} strings.

That way I can just update reports with loaded data instead of storing gigs of data in memory prior to generation.

Thanks! (Carbone is awesome btw, have used it to generate 1000 page+ reports so far with zero issues)

Stability of Carbone under load

Hi,

We are looking at integrating Carbone into our corporate system to generate tens of thousands of PDFs from MS Word Doc templates per day. We will obviously perform various load tests on this process but I was wondering if anyone has used this project under similar load?

Thanks!

JO

TypeError on null fields

When the template contains a Placeholder with nested properties, everything works fine if the path described by the placeholder exists or if one (or more) of the listed properties does not exist at all, but a TypeError occurs if one of the properties is null.

As an instance, considering the placeholder {d.A.B.C}

{ "A" : { "B" : { "C" : 1 } } } => Ok
{ "A" : { } } => Ok
{ "A" : { "B" : null }} => TypeError: Cannot read property 'C' of null

Mainly, the issue was due to the use of the operator "!==" to perform the due checks (null !== undefined => true).

Moreover a null/undefined check is missing at all in "getBuilderFunction" method, in the section responsible for the composition of the code related to arrays initialization (rows 474 and 477).

Malformed JSON in payload

Hi,

Thanks for a great product! (I have spoken to @devSwoop about this over the chat support, and he has assisted)

When using the API to render a report: [https://app.carbone.io/version/{template uuid}/render]

The logical payload for json would be:

{
	"convertTo"   : "pdf",
	"data"        :  {},
  	"complement"  : {},
  	"enum"        : {}
}

However this returns and unexpected error:

{
"success": false,
"message": "Wrong JSON data",
"data":{},
"errors":[]
}

The json node value assigned to either data, complement, enum needs to be escaped thus like this:

{
	"convertTo"   : "pdf",
	"data"        :  "{\"dog\":\"jack russel\"}",
  	"complement"  : "{}",
  	"enum"        : "{}"
}

You can easily escape values for json node values here: [https://www.freeformatter.com/json-escape.html]

So there is a work around, its just not ideal. The only reason why I think this might have been implemented this way, is to allow data to be in a xml/csv format. If not, I think it needs to be corrected.

Regards,

Willem

[Bug Report]: When you have over 2 levels of inner tables in your template you are no longer able to use tokens outside of the most inner table

My template (attached) has the following structure:

image

The fact that there are tables with inner tables, prevents me from being able to use tokens outside those inner tables. The part highlighted in orange in the screenshot above, is already enough for Carbone to generate an invalid DOCX file, even though it throws no errors at all. Attempting to open the generated file on MS Word or LibreOffice Writer, gives the following error:

image

If I remove the tokens that are outside that structure (from the orange highlighted part in the screenshot above and everything beneath it), the generated DOCX works just fine.

The template used for test is carbone_play.docx and the data used for rendering is data.txt

Environment
Carbone Version: 1.2.0
Node Version: 10.14.2
Browsers: [e.g. chrome 22]
Server OS: Alpine 3.9

Expected Behaviour
Carbone should be able to populate the attached template.

Actual Behaviour
The result of carbone render generates an invalid word document that can't be opened.

Steps to reproduce
Steps to reproduce the bug:

  1. Use the attached template.
  2. Use the attached json request for transformation.
  3. Try to open the resulting word document with MS Word or Libreoffice Writer.
  4. You should see a message stating the resulting document is invalid.

Being able to create new sheets using templates

Hi, We are looking to use carbone in one of our projects and are going through evaluating different features, We are trying to customize the number of sheets and sheet names using the templates but not sure how to do this, Can someone please help if you think this is achievable or we are trying something that is not in scope for the library

Invalid output file

Hi,
I'm using following data: https://gist.github.com/dcdamien/9e50948219d3792307521c43b3108877

And following templates:

{d.type}
{d.numberAssignments[i=0].designation}
{d.seller.address.phoneNumbers[i=0].number}
itemName
{d.lines[i].itemName}
{d.lines[i+1].itemName}

Carbone generates correct output files only when using single of them, but when they are merged into one template, output file gets corrupted. Opening file in Microsoft Word ends with The file cannot be opened because there are problems with the contents error.

output-files.zip

Support for ranges in Excel

Not sure if this is possible or not, but it would be nice to be able to set up a table containing tags as a named range or full-on Excel table that could then be referenced by other items such as charts and pivot tables once the data is populated (note previous issue relating to pivot tables corrupting spreadsheet).

Currently, a named range / table does not expand to include all data that is populated - it remains the same size as it was originally defined.

expose python and sofficeExecPath as option and improve detection under linux

It would be better if you expose them as option. It's a extreme headache for your admin to keep the office up to date otherwise.
And to top it of, there is a much better way to get your python and soffice binary under linux:

const fs = require('fs');

process.env.PATH.split(':').forEach(function(dir){
	if (fs.existsSync(dir)){
		var files = fs.readdirSync(dir);
		files.forEach(function(file){
			if(file == 'python' || file == 'soffice'){
				console.log(dir + '/' + file);
			}
		});
	}
});

Maybe keep your old method as failover, but under linux there should always be an PATH env.

Barcode support

Is it possible to use barcodes or QR codes? Has anyone already tried that?

[Feature Request]: Examples for Dynamic Data + Dynamic Color Changes

Hello. I seem to be having trouble following your documentation regarding dynamic Color changes. We may need a few dynamic color markings on our generated Documents / PDF. I tried placing a few bindColor() calls at the template files we're editing. The dynamic data works, but bindColor seems to just imprint at the document. Possible that i may have misunderstood the documentation, but i think it's better for some example templates involving the color manipulation. We're using Word/ODT Format templates, to PDF conversion.

I would like to ask a few example templates with dynamic Data with Dynamic Color manipulations.

Thank you, good day.

Corrupt PDF

Used the recommended Dockerfile, getting a corrupt PDF every time I render a report.
docx & odt open nicely with no problem.

FROM node:8

WORKDIR /tmp
RUN wget http://download.documentfoundation.org/libreoffice/stable/6.1.5/deb/x86_64/LibreOffice_6.1.5_Linux_x86-64_deb.tar.gz -O libo.tar.gz
RUN apt update \
    && apt install -y libxinerama1 libfontconfig1 libdbus-glib-1-2 libcairo2 libcups2 libglu1-mesa libsm6 unzip \
    && tar -zxvf libo.tar.gz
WORKDIR LibreOffice_6.1.5.2_Linux_x86-64_deb/DEBS
RUN dpkg -i *.deb

WORKDIR /home/node

COPY package.json .
RUN npm install --quiet

COPY . .

image

Code used in app:

let options = {
  convertTo: "pdf" //can be docx, txt, ...
};

carbone.render(
        appRoot + "/templates/sample_template.odt",
        dataJSON,
        options,
        function(err, result) {
          if (err) {
            return console.log(err);
          }
          // write the result
          fs.writeFileSync(appRoot + "/templates/sample.pdf", result);
          console.log(result);
          return result;
        }
      );

In Conditioned output, the characters after comma is not getting printed on the document.

I have a condition where ifEqual to 1 it should print

Some sentence, some more sentences.

I am doing this, {d.sentenceExist:ifEqual(1, 'Some sentence, some more sentences.')}

In the output, if the condition is true, only the text before the comma is getting printed.

That means, the output is,

Some sentence

instead of

Some sentence, some more sentences.

LibreOffice not fund on windows

When trying to convert to pdf file, I got an error telling me that LibreOffice is not installed.

Scenario:
OS: Windows 7 SP1 (x64)
LibreOffice Version: 6.2.5.2 (x64)
soffice.exe Path: 'C:/Program Files/LibreOffice/program/soffice.exe'

The current filter cannot find this path: (Line 497 of file "converter.js")
var _windowsDirnamePattern = /^LibreOffice \d+(?:\.\d+)?$/i;

I could correct it locally by changing it to:
var _windowsDirnamePattern = /^LibreOffice( \d+(?:\.\d+)?)?$/i;

Font issue with Carlito.

I've been using the node.js library and it appears that when I use Carlito as the font in my .ODT template, It's writing with DejaVuSans instead. I have tried several packaged Libreoffice fonts.

bindColor cell example

good morning,
I have a question, the bindcolor on an excel template does not work, can I have working examples?

{d.to_pay} -> color cell 0000ff

i write {bindColor(0000ff, hexa) = d.color3} in another cell and my data json is:

data.total_pay = 5
data.color = '#FF0000';
data.color2 = '#00FF00';
data.color3 = '#0000FF';
data.color4 = 'red';

can you help me?

Pivot table in .xlsx and .ods file corrupts output file

When using template tags in a spreadsheet that is the source for a pivot table, the output document is corrupted. In Excel, you are prompted to recover the document and the pivot table is there however it is no longer recognized as a pivot table and does not update. In Libre ODS format, the output file will not open at all and the following error message is displayed:

Read Error.
Format error discovered in the file in sub-document content.xml at 2553,28021(row,col).

Using carbone.io with a dockerised headless LibreOffice...

Hello Developers,

Thanks for carbone.io. We have been looking at carbone.io in the hope that we can use it with the following dockerised LibreOffice:
https://github.com/hannesdejager/docker-libreoffice-api
Which publishes itself on port 8100 of its IP address.

We see the general carbone parameters contain options for factories & startFactory but we can't see how to specify a remote existing headless LibreOffice.

If there is an option for this configuration, please will you let us know.

TypeError: Cannot read property 'position' of undefined (Bi-directional loop)

Greetings.
I am trying to use the bi-directional loop with an .odt file but can't seem to get it working as I've started with the provided examples in the docs but it doesn't work as expected and produces the following error:

TypeError: Cannot read property 'position' of undefined
at Object.splitMarkers (<project>/node_modules/carbone/lib/extracter.js:228:41)
at <project>/node_modules/carbone/lib/builder.js:41:50
at Object.preprocessMarkers (<project>/node_modules/carbone/lib/parser.js:286:5)
at <project>/node_modules/carbone/lib/builder.js:38:18
at <project>/node_modules/carbone/lib/parser.js:39:7
at process._tickCallback (internal/process/next_tick.js:61:11)

Environment information:

Angular v8
LibreOffice calc generation .odt template
Node.js 10.15.0

Your quick response and help is very much appreciated.

DOCX to PDF conversion use only 1 worker even configured to multiple worker

Hi,
I'm facing a problem with pdf conversion is very slow. I'm using carbone to generate a document from docx and convert to pdf at a time. A docx file contains around 400 pages(~15 MB file size of docx). I've configured carbone to use 3 LibreOffice workers. It takes about an hour to complete conversion.

I figure out that only 1 worker is using 99% CPU usage and the other process is using 0% CPU Usage.

Has anyone facing this issue? How can I config the carbone to accerelate pdf conversion by using every worker?

System
Amazon EC2 t2.medium
OS: Ubuntu Server 18.04
LibreOffice_5.3.2.2_Linux_x86-64_deb

1548386442636

Nested arrays broke on first iteration

Hello,

On example node_modules/carbone/examples/movies.docx it doesn't work, if you add an image on first loop. The image have to be inside the first loop, or the anchor's image.
Result loop stop on first iteration.

While repetition with arrays, the data gets printed one extra time. That means loop happens for data.length + 1 times.

I have an array of JSON objects as below,

const data = [
  {"fname": "Prashanth", "lname": "Gowda"},
  {"fname": "Jonny", "lname": "Doe"},
  {"fname": "Jimmy", "lname": "Doe"}
]

and doc template code as below,

sentence is having first name {d[i].fname}
sentence is having last name {d[i].lname}

sentence is having first name{d[i+1].fname}
sentence is having last name {d[i+1].lname}

when i get the output document it prints one extra line as shown in figure below,

CaptureCarboneIssue

Question on converting string into numeric format

Hi,
I have some problems in converting a numeric result into a real number in excel.

I have seen that the Carbon documentation reports several Formatters for date and string but not for numbers.
Do you know if there is something like convInt, confFloat I could sue in my template?

Thank you in advance for your help,
Best Regards,
Mario

Windows support and file paths

Hi,
We're currently developing two features concurrently: support for Windows and improved path detection for compatibility with OS-provided packages (not on any branch as of now) that should basically solve #10 .
Since the features are related (Windows needs path support, too), we'll need to base one of the change sets upon the other.
Should we prepare a cumulative pull request for both, or separate them (Windows support + Linux/Mac-only path detection, and then another changeset for adding Windows support to path detection) into different PRs?

Large document generation/inserting dynamic content.

Is there a streaming interface for carbone? Essentially I'm trying to generate massive documents, but the problem is that at points, I have to load in more data than exists physical memory on the machine.

To get around this, I'm having to load chunks of data, write the data to the document, insert new carbone elements into the document at the tail of the document, then repeat the process in a loop.

The issue with this, is that I can't insert anything other than plain text elements. I'd like to be able to insert dynamic tables into the document by writing carbone elements but it seems there is no functionality for that?

Am I mistaken? Or is this the case? If so, are there any plans for a streaming interface for carbone? One that could generate huge reports without having to load the full data into memory?

Nested object trouble

Hi,
I am having trouble with getting my nested JSON to work.

{"Results": {
    "rheometer":[{
        "temperature":40,"shear_rate":0.1,"viscosity":0.1453},    
        {"temperature":40,"shear_rate":0.1585,"viscosity":0.1379},
        {"temperature":100,"shear_rate":100,"viscosity":0.01063}],
    "xrf":{"data":[{"element":"Ag","amount":58.19125,"units":"ppm"},
        {"element":"Al","amount":42.8444,"units":"ppm"},
        {"element":"Ba","amount":1121.773,"units":"ppm"},
        {"element":"Ca","amount":1878.824,"units":"ppm"},
        {"element":"Zn","amount":12.94434,"units":"ppm"}]    }}}

I am using the following in my word doc to iterate over the data

{d.Results.rheometer[i].temperature} {d.Results.rheometer[i+1].temperature}
{d.Results.rheometer[i].viscosity:toFixed(2)} {d.Results.rheometer[i+1].viscosity:toFixed(2)}

but I get the following error: TypeError: Cannot read property 'rheometer' of undefined. This is strange as the "Results" object definitely has the "rheometer" property.

Filter Array based on other properties of same json object.

I have a json object like below,

[
  {
    "1": {
      "title": "Orthopaedic Surgeons 22",
      "runningTitle": "Surgeons",
      "investigationLoc": "Bengaluru"
    },
    "2": {
      "authors": [
        {
          "authorName": "Auth1",
          "finalDegrees": "MBBS",
          "firstAffiliation": "Patna",
          "secondAffiliation": "Delhi",
          "authorEmail": "[email protected]"
        },
        {
          "authorName": "Auth2",
          "finalDegrees": "BE",
          "firstAffiliation": "Pune",
          "secondAffiliation": "Mumbai",
          "authorEmail": "[email protected]"
        },
        {
          "authorName": "Auth3",
          "finalDegrees": "MS",
          "firstAffiliation": "Bangalore",
          "secondAffiliation": "Karnataka",
          "authorEmail": "[email protected]"
        }
      ]
    },
    "3": {
      "correspondingAuthorEnumRadio": "Auth1"
    }
  }
]

my template looks like,

{d[i].2.authors[i].authorName}
{d[i].2.authors[i].firstAffiliation}
{d[i].2.authors[i, authorName = 'Auth1'].authorEmail}

{d[i].2.authors[i+1].authorName}
{d[i].2.authors[i+1].firstAffiliation}
{d[i].2.authors[i+1, authorName = 'Auth1'].authorEmail}

{d[i].2.authors[i].authorName}
{d[i].2.authors[i].secondAffiliation}
{d[i].2.authors[i, authorName = 'Auth1'].authorEmail}

{d[i].2.authors[i+1].authorName}
{d[i].2.authors[i+1].secondAffiliation}
{d[i].2.authors[i+1, authorName = 'Auth1'].authorEmail}

I will get the desired output for the above template, but the problem is i want the 'Auth1' value to be substituted dynamically, which i ll obtain from {d[i].3.correspondingAuthorEnumRadio}, so i used it as show in below template,

{d[i].2.authors[i].authorName}
{d[i].2.authors[i].firstAffiliation}
{d[i].2.authors[i, authorName = {d[i].3.correspondingAuthorEnumRadio}].authorEmail}

{d[i].2.authors[i+1].authorName}
{d[i].2.authors[i+1].firstAffiliation}
{d[i].2.authors[i+1, authorName = {d[i].3.correspondingAuthorEnumRadio}].authorEmail}

{d[i].2.authors[i].authorName}
{d[i].2.authors[i].secondAffiliation}
{d[i].2.authors[i, authorName = {d[i].3.correspondingAuthorEnumRadio}].authorEmail}

{d[i].2.authors[i+1].authorName}
{d[i].2.authors[i+1].secondAffiliation}
{d[i].2.authors[i+1, authorName = {d[i].3.correspondingAuthorEnumRadio}].authorEmail}

But i am getting output as below which is not as expected,

Auth1
Patna
{d[i].2.authors[i, authorName = Auth1].authorEmail}

Auth2
Pune
{d[i].2.authors[i, authorName = Auth1].authorEmail}

Auth3
Bangalore
{d[i].2.authors[i, authorName = Auth1].authorEmail}

{d[i].2.authors[i+1, authorName = Auth1].authorEmail}

Auth1
Delhi
{d[i].2.authors[i, authorName = Auth1].authorEmail}

Auth2
Mumbai
{d[i].2.authors[i, authorName = Auth1].authorEmail}

Auth3
Karnataka
{d[i].2.authors[i, authorName = Auth1].authorEmail}

{d[i].2.authors[i+1, authorName = Auth1].authorEmail}

Kindly help me solving this issue.
Thanks

Add carbone to a docker image

How can I add carbone to a docker image?
Since LibraOffice is required, is there any way to bunddle LibraOffice in Docker image as well?

Should I add following command to Dockerfile or package.json?
npm install carbone

Custom font for PDF generated file

Hi
Could anyone please help me regarding adding a custom font to the generated pdf. the template which is a .odt file has my custom font but when converted, the pdf will use it's own font.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.