[.Net Core 2] CSV with text recipe



  • Hi,

    I'm currently working on a new template which use the text recipe to generate a csv file. (.Net core 2)

    I've checked online and on the Text recipe page (https://jsreport.net/learn/text) which parameters I have to use but the names to use aren't present.

    I'm guessing that I should do something like this :
    {
    "recipe": "text",
    "engine": "handlebars",
    "text": {
    "content-type": "text/csv",
    "file-extension": "csv",
    "content-disposition": "inline"
    }
    }

    Moreover, I use accented characters in my csv file, how can I specify an utf8 encoding?

    If you find some spare time, it would be great to reference a full configuration file with all possible options, as for now information is scatterred here and there and some are missing. (Expanding this page would be awesome : https://jsreport.net/learn/configuration)

    Thank you in advance,

    St├ęphane


  • administrators

    Hi,
    I'm currently working on a new template which use the text recipe to generate a csv file. (.Net core 2)
    I've checked online and on the Text recipe page (https://jsreport.net/learn/text) which parameters I have to use but the names to use aren't present.

    i see the confusion, and you are right about Text docs page not being clear about the options, i will add a note to myself to later change this page.

    I'm guessing that I should do something like this :
    {
    "recipe": "text",
    "engine": "handlebars",
    "text": {
    "content-type": "text/csv",
    "file-extension": "csv",
    "content-disposition": "inline"
    }
    }

    the right way to specify the request input options for text is:

    {
      "template": {
        "recipe": "text",
        "engine": "handlebars",
        "contentType": "text/csv",
        "fileExtension": "csv",
        "contentDisposition": "inline"
      }
    }
    

    Moreover, I use accented characters in my csv file, how can I specify an utf8 encoding?

    hmm our default response should be utf8, the problem arises when other encoding needs to be supported (for reference here is a link where other user asked about support for different encoding). right now we only support utf8 because we don't do anything special with the response and javascript by default encodes strings as utf8

    if you just want utf8 and you want to tell the browser so it can work with the content normally, then i think you can do text/plain; charset=utf-8 to be explicit about it.


  • administrators

    If you find some spare time, it would be great to reference a full configuration file with all possible options, as for now information is scatterred here and there and some are missing. (Expanding this page would be awesome : https://jsreport.net/learn/configuration)

    the https://jsreport.net/learn/configuration page describes the configuration format, not the request input options which is what you were asking here, however if you can be specific about what can be added or what is missing in configurations docs, then all suggestions are welcome.

    right now we try to put the general configuration in that page, and configuration for specific extensions are in the page of each extension (for example here is a link to an extension docs where it has a section for describing configuration), but remember that the configuration described there is different than request input options


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.