jsreport / jsreport-dotnet

jsreport .NET sdk home repository
https://jsreport.net
MIT License
63 stars 9 forks source link

How can I do to connect c# mvc with jasper server for to get report #59

Closed pmillan81 closed 3 years ago

pmillan81 commented 3 years ago

Hi, I´m new with jasper report, I have my server with Jasper server and I ready can to deploy my report, but I need to show my report in my app with view mvc and c#, I saw tutorial about of theme and comment on the jasper client for .net, but and I don´t know about how can I do to show my report in page MVC I hav this code

var rs = new ReportingService("http://localhost:8080/", "jasperadmin", "jasperadmin"); var report = await rs.RenderByNameAsync("xxx", new { xxx = "***" });

anyone have some code for to show report in c# mvc, for to show report in app

I see this code but I don´t understand how to setup my server http://localhost:8080/", "jasperadmin", "jasperadmin") for to get my report that I design in my jaspersoft studio and deploy in my jaspersoft server, this is the code I saw:

public ActionResult Index() { return View(); }

    [EnableJsReport()]
    public ActionResult Invoice()
    {
        HttpContext.JsReportFeature().Recipe(Recipe.ChromePdf);

        return View(InvoiceModel.Example());
    }

    [EnableJsReport()]
    public ActionResult InvoiceDownload()
    {
        HttpContext.JsReportFeature().Recipe(Recipe.ChromePdf)
            .OnAfterRender((r) => HttpContext.Response.Headers["Content-Disposition"] = "attachment; filename=\"myReport.pdf\"");

        return View("Invoice", InvoiceModel.Example());
    }

    [EnableJsReport()]
    public ActionResult InvoiceWithHeader()
    {
        HttpContext.JsReportFeature()
            .Recipe(Recipe.ChromePdf)
            .Configure((r) => r.Template.Chrome = new Chrome {
                HeaderTemplate = this.RenderViewToString("Header", new { }),
                DisplayHeaderFooter = true,
                MarginTop = "2cm",
                MarginLeft = "1cm",
                MarginBottom = "2cm",
                FooterTemplate = " "
            });

        return View("Invoice", InvoiceModel.Example());
    }

    [EnableJsReport()]
    public ActionResult Items()
    {
        HttpContext.JsReportFeature()
            .Recipe(Recipe.HtmlToXlsx);

        return View(InvoiceModel.Example());
    }

    [EnableJsReport()]
    public ActionResult ItemsExcelOnline()
    {
        HttpContext.JsReportFeature()
            .Configure(req => req.Options.Preview = true)
            .Recipe(Recipe.HtmlToXlsx);

        return View("Items", InvoiceModel.Example());
    }

    [EnableJsReport()]
    public ActionResult InvoiceDebugLogs()
    {
        HttpContext.JsReportFeature()
            .DebugLogsToResponse()
            .Recipe(Recipe.ChromePdf);

        return View("Invoice", InvoiceModel.Example());
    }

I saw this in example, in this foroum the workflow is design Jaspersoft studio-> deploy Jaspersoft server with parameter-> and I need to see on my app mvc c# in my view

best regards

pofider commented 3 years ago

JasperReports is a completely different technology. This is the repo for jsreport .net client.... you are probably at the wrong place.