Pass a List of objects in .NET Core to nodejs exportPDF
Posted: Mon Nov 06, 2017 7:59 am
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?
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
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)
Cheers