Stimulsoft.Reports.Web.NetCore StiDesigner with Angular

Stimulsoft Reports.WEB discussion
Post Reply
rabbal
Posts: 5
Joined: Sun Apr 05, 2020 9:17 am

Stimulsoft.Reports.Web.NetCore StiDesigner with Angular

Post by rabbal »

Hi there,
I'm using StiDesigner of Stimulsoft.Reports.Web.NetCore package with Angular like your "Web API with Angular" sample for StiViewer in github, but in preview page, some controls have "undefined" text.
The attachment a.PNG is no longer available
//Index.html
<script src="reporting/designer"></script>

//DesignerController

Code: Select all

[Route("reporting/designer")]
public class DesignerController : Controller
{
    [HttpGet]
    public IActionResult Get()
    {
        var requestParams = StiNetCoreDesigner.GetRequestParams(this);
        if (requestParams.Action == StiAction.Undefined)
        {
            var options = new StiNetCoreDesignerOptions
            {
                Theme = StiDesignerTheme.Office2013WhiteBlue,
                Server = {UseCompression = true, PassFormValues = true, UseCacheForResources = true},
            };

            return StiNetCoreDesigner.GetScriptsResult(this, options);
        }

        return StiNetCoreDesigner.ProcessRequestResult(this);
    }

    [HttpPost]
    public IActionResult Post()
    {
        var requestParams = StiNetCoreDesigner.GetRequestParams(this);
        switch (requestParams.Action)
        {
            case StiAction.SaveReport:
                return SaveReport();
            case StiAction.GetReport:
                return LoadReport(requestParams);
            case StiAction.PreviewReport:
                return PreviewReport(requestParams);
            default:
                return StiNetCoreDesigner.ProcessRequestResult(this);
        }
    }

    private IActionResult LoadReport(StiRequestParams requestParams)
    {
        //var reportName = requestParams.FormValues["__ReportName"];
        var report = new StiReport();

        report.Load(StiNetCoreHelper.MapPath(this, "Reports/TwoSimpleListsRed.mrt"));

        return StiNetCoreDesigner.GetReportResult(this, report);
    }

    private IActionResult PreviewReport(StiRequestParams requestParams)
    {
        var report = StiNetCoreDesigner.GetActionReportObject(this);

        return StiNetCoreDesigner.PreviewReportResult(this, report);
    }

    public IActionResult SaveReport()
    {
        var report = StiNetCoreDesigner.GetReportObject(this);

        var reportString = report.SaveToString();

        try
        {
            System.IO.File.WriteAllText(StiNetCoreHelper.MapPath(this, $"Reports/TwoSimpleListsRed.mrt"),
                reportString);
            return StiNetCoreDesigner.SaveReportResult(this);
        }
        catch (Exception e)
        {
            return StiNetCoreDesigner.SaveReportResult(this, "Error at saving: " + e.Message);
        }
    }
}
//DesignerComponent

Code: Select all

import {Component, OnInit} from '@angular/core';

declare var Stimulsoft: any;

@Component({
  selector: 'app-designer',
  templateUrl: './designer.component.html',
  styleUrls: ['./designer.component.css']
})
export class DesignerComponent implements OnInit {

  options: any;
  designer: any;

  constructor() {
  }

  ngOnInit() {
    this.renderHtml();
  }

  private renderHtml() {

    this.options = new Stimulsoft.Designer.StiDesignerOptions();

    //this.options.formValues = {__ReportName: params.get('reportId')};
    this.designer = new Stimulsoft.Designer.StiDesigner(this.options, 'MainDesigner', false);

    this.designer.renderHtml('designer');
  }
}

Also there is a wrong request to localhost:5001/undefined in preview page:
a.PNG
a.PNG (12.67 KiB) Viewed 1646 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular

Post by Lech Kulikowski »

Hello,

Please check that CSS files were added.

Thank you.
rabbal
Posts: 5
Joined: Sun Apr 05, 2020 9:17 am

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular

Post by rabbal »

Is There any reason to reference CSS files explicitly? these style files will render at runtime by DesignerController and StiNetCoreDesigner.ProcessRequestResult method.
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue.

Thank you.
#1820
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Stimulsoft.Reports.Web.NetCore StiDesigner with Angular

Post by Lech Kulikowski »

Hello,

The issue with some icons is fixed and will be available in the release 2020.3.1 within a week.

Also, please correct your code as:

Code: Select all

[HttpPost]
        public IActionResult Post()
        {
            var requestParams = StiNetCoreDesigner.GetRequestParams(this);

            if (requestParams.Component == StiComponentType.Viewer)
                return StiNetCoreViewer.ProcessRequestResult(this);

            switch (requestParams.Action)
            {
                case StiAction.SaveReport:
                    return SaveReport();
                case StiAction.GetReport:
                    return LoadReport(requestParams);
                case StiAction.PreviewReport:
                    return PreviewReport(requestParams);
                default:
                    return StiNetCoreDesigner.ProcessRequestResult(this);
            }
        }
Thank you.
Post Reply