Specifying language on RenderRequest object



  • Hi all, sorry if this is doc'ed, I searched for a while and couldn't find it.
    I am using the .NET SDK client and want to pass a RenderRequest object and specify the language.

    If I post this via Postman to api/report, it renders in German like I expect:

    { "template": { "shortid" : "HkaCcar-M" }, "data": { "TestId": 17 }, "options": {"language": "de"} }
    

    But, I'm not sure where on the RenderRequest object to specify the language. The RenderOptions object has no Language prop, but it does have "Base" which is a string, so I tried:

    var request = new RenderRequest
    {
        Template = new Template { Shortid = "HkaCcar-M" },
        Data = new { TestId = 17 },
        Options = new RenderOptions
        {
            Base = "{\"language\": \"de\"}"
        }
    };
    var report = await rs.RenderAsync(request);
    

    But, no luck, I got the default language (en) for the template. Is there a way to do this via the RenderRequest object?

    Thanks,
    Keith



  • If I make my own anonymous type that serializes to the same json as I used in Postman, that renders in German for me as well.

    var request = new
    {
        Template = new Template { Shortid = "HkaCcar-M" },
        Data = new { TestId = 17 },
        Options = new { Language = "de" }
    };
    var report = await rs.RenderAsync(request);
    

    Which works, but I'm curious if I can use the RenderRequest object to accomplish this instead.



  • Please update jsreport.Types nuget to the latest. I've just added that prop there.



  • Thanks Jan, works great!


Log in to reply
 

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