[英]ASP.NET Core 6 "Cannot implicitly convert type 'Rotativa.ViewAsPdf' to 'Microsoft.AspNetCore.Mvc.ActionResult'"
I want to make PDF export in my ASP.NET Core 6 project.我想在我的 ASP.NET Core 6 项目中导出 PDF 。 I use 'Rotativa' and this code to export:
我使用“Rotativa”和这段代码来导出:
public Microsoft.AspNetCore.Mvc.ActionResult Export()
{
return new ViewAsPdf("PdfReport");
}
I get this error:我收到此错误:
Cannot implicitly convert type 'Rotativa.ViewAsPdf' to 'Microsoft.AspNetCore.Mvc.ActionResult'.
无法将类型“Rotativa.ViewAsPdf”隐式转换为“Microsoft.AspNetCore.Mvc.ActionResult”。 An explicit conversion exists (are you missing a cast?)
存在显式转换(您是否缺少演员表?)
Please help me - what do I need to do?请帮助我 - 我需要做什么?
Thanks.谢谢。
Use IActionResult
instead ActionResult
使用
IActionResult
代替ActionResult
public IActionResult Export()
{
return new ViewAsPdf("PdfReport");
}
I just install 'Rotativa.AspNetCore' package and everything is ok.我只安装了“Rotativa.AspNetCore”package,一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.