0

我想在 asp.net mvc 应用程序中以 pdf 形式制作报告,目前我将结果显示为部分视图,即我的主页是 Report 并且正在调用

public ActionResult Report(int id)
{
    ViewBag.Id =id;
   return View();
} 

在 Report.cshtml 中,我调用 5 个局部视图来呈现报告的 5 个不同部分,如下所示

<div class="row">
@Html.Action("Report1", "Screening", new { Id = @ViewBag.Id })
</div>
<div class="row">
@Html.Action("Report2", "Screening", new { Id = @ViewBag.Id })
</div>
<div class="row">
@Html.Action("Report3", "Screening", new { Id = @ViewBag.Id })
 </div>
<div class="row">
@Html.Action("Report4", "Screening", new { Id = @ViewBag.Id })
</div>

现在我想将报告制作为 pdf,有什么方法可以直接从 RazorPDF 视图调用部分视图?

4

1 回答 1

0

你试过这个吗?

public ActionResult Report(int id)
{
    ViewBag.Id =id;
    var model=new YourViewModel()
    return new RazorPDF.PdfResult(model, "Report");
} 
于 2014-09-01T07:50:30.283 回答