Pass a List of objects in .NET Core to nodejs exportPDF

Stimulsoft Reports.NET discussion
Post Reply
MichalCh
Posts: 17
Joined: Fri Sep 22, 2017 7:37 am

Pass a List of objects in .NET Core to nodejs exportPDF

Post by MichalCh »

Hello,

I'd like to ask if there is a way to pass in exportPdf/exportHtml a list of objects (might be converted to json by Newtonsoft Json) as datasource instead of a path to saved json file?

Code: Select all

.NET Core
var objects = new List<FancyClass>() {
new FancyClass() { Name = "Test One" },
new FancyClass() { Name = "Test Two" } }

(...)
in the method then:
byte[] result = await _nodeServices.InvokeAsync<byte[]>("./node/exportPdf", reportPath, objects); <- overload with an extra parameter

Code: Select all

exportPdf file: 

module.exports = function (callback, reportPath, listOfObjects) {
var dataSet = new Stimulsoft.System.Data.DataSet("Demo");
dataSet.readJsonFile("Demo.json"); <- here I'd like to do sth like dataSet.readJson(listOfObjects)/dataset.read(listOfObjects)
I'm sure this topic came up previously but I wasn't able to find that in documentation/example projects/forum. Could you be in any help?

Cheers
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Pass a List of objects in .NET Core to nodejs exportPDF

Post by HighAley »

Hello, Michal.

Yes, it's possible to pass the JSON object.
The only thing that you should change is the readJsonFile() method. You should change it to the dataSet.readJson(listOfObjects);

Thank you.
Post Reply