Cloud
Облачный сервис для быстрого и эффективного анализа и визуализации данных для вашего бизнеса без необходимости создания своих приложений и программирования.
StiMvcViewer component to the view page. Also you need to pass the StiMvcViewerOptions object to the constructor. In the options, you should set the next actions - GetReport, EmailReport and ViewerEvent. They are located in the Actions options group. To enable the the ability to send Email, you should set the ShowSendEmailButton option in the Toolbar group to true:
@using Stimulsoft.Report.Mvc;
...
@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
Actions =
{
GetReport = "GetReport",
EmailReport = "EmailReport",
ViewerEvent = "ViewerEvent"
},
Toolbar =
{
ShowSendEmailButton = true
}
})
GetReport action loads the report and returns the answer to the client part of the viewer using the GetReportResult() static method. In the parameters of this method, the report object should be passed:
public ActionResult GetReport()
{
var options = StiMvcViewer.GetEmailOptions();
options.AddressFrom = "admin@test.com";
//options.AddressTo = "manager@test.com";
//options.Subject = "Quarterly Report";
//options.Body = "Quarterly report on arrival of the goods.";
options.Host = "smtp.test.com";
//options.Port = 465;
options.UserName = "admin@test.com";
options.Password = "************";
return StiMvcViewer.EmailReportResult(options);
}
ViewerEvent action handles all the viewer events (switching pages, zooming, etc.) and returns the answer to the client using the ViewerEventResult() static method:
public ActionResult ViewerEvent()
{
return StiMvcViewer.ViewerEventResult();
}
EmailReport action will be invoked when you send a report by Email through menu of the viewer. In this action, you can get the email options object of the StiEmailOptions type. In these options will be passed all the data required for sending the Email. You need to fill the necessary options, such as server address, login, password and other. Also you can change the address of the recipient, email subject and body, if it is important (these options are requested in the viewer dialog).EmailReportResult() static method. In the parameters of this method, the email options object should be passed:
public ActionResult EmailReport()
{
StiEmailOptions options = StiMvcViewer.GetEmailOptions();
options.AddressFrom = "admin@test.com";
//options.AddressTo = "manager@test.com";
//options.Subject = "Quarterly Report";
//options.Body = "Quarterly report on arrival of the goods.";
options.Host = "smtp.test.com";
//options.Port = 465;
options.UserName = "admin@test.com";
options.Password = "************";
return StiMvcViewer.EmailReportResult(options);
}