Cloud
Облачный сервис для быстрого и эффективного анализа и визуализации данных для вашего бизнеса без необходимости создания своих приложений и программирования.
StiMvcDesigner component to the view page. Also, you need to pass the StiMvcDesignerOptions object to the constructor. The minimum required options are two actions - GetReport and DesignerEvent:
@using Stimulsoft.Report.Mvc;
...
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions()
{
Actions =
{
GetReport = "GetReport",
DesignerEvent = "DesignerEvent"
}
})
GetReport() action loads the report template and returns answer to the client part of the designer using the GetReportResult() static method. In the parameters of this method, the report object should be passed:
public ActionResult GetReport()
{
var report = new StiReport();
report.Load(Server.MapPath("~/Content/Reports/TwoSimpleLists.mrt"));
// Add System.Web.Mvc.dll library to the report references
var assemblies = new string[report.ReferencedAssemblies.Length + 1];
Array.Copy(report.ReferencedAssemblies, assemblies, report.ReferencedAssemblies.Length);
assemblies[assemblies.Length - 1] = "System.Web.Mvc.dll";
report.ReferencedAssemblies = assemblies;
return StiMvcDesigner.GetReportResult(report);
}
AddFunction() method:
public static string MyFunc(string value)
{
return value.ToUpper();
}
static DesignerController()
{
var ParamNames = new string[1];
var ParamTypes = new Type[1];
var ParamDescriptions = new string[1];
ParamNames[0] = "value";
ParamDescriptions[0] = "Descriptions";
ParamTypes[0] = typeof(string);
// How to add my function
StiFunctions.AddFunction(
"MyCategory",
"MyFunc",
"MyFunc",
"Description",
typeof(DesignerController),
typeof(string),
"Return Description",
ParamTypes,
ParamNames,
ParamDescriptions);
}
...