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. //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);
}
}
}
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');
}
}