I see, thank you for the answer.
BlackWizardMimi
@BlackWizardMimi
Posts made by BlackWizardMimi
-
install jsreport in iisnode
Hello, I am trying to install jsreport at iisnode and it works as I use this as reference : https://jsreport.net/blog/jsreport-hosting-options-on-windows
But then I try to "add application to the default website." and then I got error. I read again and find :
I got this error :
is this a problem? I mean why I need to create separate website and not just add application to the default website ?
Thank you -
Jsreport Template
Hello, I just want to ask about jsreport templates,
I already search in google, jsreport.net, playground, etc... (but what I found is limited and I better ask than wrong)so is jsreport offers variances of template? so we can create our report with better design, different, and easier of course
Thanks
-
Excel Width Problem
Hello... I want to ask, I use microsoft visual studio and I try to render excel file using : Recipe - HtmlToXlsx
It renders successfully, but i get problem with the width column. You can check the pic below :
I used css style , width : px to control it but it give me no result. My code :
@model NetWebApp.Model.InvoiceModel <style> .heading > td { background-color: green; color: white; border: 3px solid #73AD21; width:500px; } </style> <table> <tr class="heading "> <td style="border:1px solid #000000;width:308px;"> Allocation Category </td> <td style="border:1px solid #000000;width:310px;"> Allocation Parameter </td> <td style="border:1px solid #000000;width:338px;"> Current Allocation Method </td> <td style="border:1px solid #000000;width:558px;"> Current Allocation Formula </td> <td style="border:1px solid #000000;width:337px;"> New Allocation Method </td> <td style="border:1px solid #000000; width:558px;"> New Allocation Formula </td> </tr> <tr class="item"> <td> Allocation Category </td> <td> Allocation Parameter </td> <td> Allocation Method </td> <td> Allocation Formula </td> <td> Allocation Method </td> <td> Allocation Formula </td> </tr> </table>
Please tell me, am I doing something wrong? Thanks....
-
Visual Studio MVC integration, repeat data from store procedure
Hi !
i have learning a lot if things about jsreport this week. I try to integrate it with visual studio because it will make things easier....I am trying to get data from stored procedure and its working but I can't make it work when I try to get more than one data and make it a table. I always get "IndexOutOfRangeException" and I believe its because of return function, here is the code :
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Data.SqlClient; using System.Collections; namespace NetWebApp.Model { public class InvoiceModel { public string ReferenceNumber { get; set; } public string AllocationType { get; set; } public string Contract { get; set; } public string EP { get; set; } public string json; public IEnumerable<ItemModel> Items { get; set; } public static InvoiceModel Example() { ArrayList objs = new ArrayList(); SqlConnection sqlConnection1 = new SqlConnection("Data Source=localhost\\VANDERSQL2K8R2;Initial Catalog=PGPL_GMS_DEV;User ID=admin;Password=Password"); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "[Approval].[rspSelAllocationSetupModification] '287','systemAdmin'"; cmd.Connection = sqlConnection1; sqlConnection1.Open(); SqlDataReader rdr = cmd.ExecuteReader(); // Data is accessible through the DataReader object here. rdr.Read(); return new InvoiceModel() { // I success to cal these data ReferenceNumber = rdr["ReferenceNumber"].ToString(), AllocationType = rdr["AllocationTypeName"].ToString(), Contract = rdr["ContractNumber"].ToString(), EP = rdr["AllocationPeriod"].ToString(), Items = new List<ItemModel>() { //whenever I try to call these data (item model), they got me error //"IndexOutOfRangeException" new ItemModel() { AG = rdr["AllocationCategory"].ToString(), AP = rdr["AllocationParameter"].ToString(), CAM = rdr["CurrentAllocationMethod"].ToString(), CF = rdr["CurrentAllocationFormula"].ToString(), NAM = rdr["NewAllocationMethod"].ToString(), NF = rdr["NewAllocationFormula"].ToString() } } }; sqlConnection1.Close(); } } public class ItemModel { public string AG { get; set; } public string AP { get; set; } public string CAM { get; set; } public string CF { get; set; } public string NAM { get; set; } public string NF { get; set; } public string json { get; set; } }}
I use https://github.com/jsreport/jsreport-dotnet-example-webapp as references.
can anyone help ? Please .....
thank you in advance -
RE: json file, get data from script
Thank you , this is my code for anyone with same problem :
This is work for me- Javascript :
const path = require('path') const fs = require('fs') function beforeRender(req, res, done) { //file location, file name const configPath = path.join("E:\\Program\\", 'sample.json') // any message called with console.log, console.warn, console.error will be saved into logs console.log('reading custom file..') //testing file location console.log('from : '+configPath) //read file json fs.readFile(configPath, (err, content) => { if (err) { return done(err) } try { req.data = Object.assign({}, req.data, JSON.parse(content.toString())) /* const myconfig = JSON.parse(content.toString()) // use config values to apply some conditional logic in the script if (myconfig.validateData) { // .. your custom logic here .. } // or pass custom config as data to your templates req.data.myconfig = myconfig */ done() } catch (e) { done(new Error('error while trying to parse custom config at ' + configPath + ': ' + e.message)) } }) }
- jsreport.config.json
{ "extensions": { "authentication": { "cookieSession": { "secret": "<your strong secret here>" }, "admin": { "username": "sa", "password": "Password1000" }, "enabled": false }, "scripts": { "timeout": 40000, "strategy": "http-server", "allowedModules": ["path","fs"] }, "sample-template": { "createSamples": true } }, "httpPort": 5488, "store": { "provider": "fs" }, "blobStorage": { "provider": "fs" }, "logger": { "console": { "transport": "console", "level": "debug" }, "file": { "transport": "file", "level": "info", "filename": "logs/reporter.log" }, "error": { "transport": "file", "level": "error", "filename": "logs/error.log" } }, "allowLocalFilesAccess": true, "templatingEngines": { "timeout": 10000, "strategy": "http-server" }, "chrome": { "timeout": 40000 } }
-
RE: json file, get data from script
ah, thank you !
it seems I kind of understand now, thanks :D -
RE: json file, get data from script
Oh thank you,
how can I pass through it to data?
I can't understand this one, so it creates data?