Rotativa - 奇怪的标题输出

Sli*_*nky 5 c# wkhtmltopdf asp.net-mvc-3 rotativa

我正在尝试解决我的HTML中的表头在后续页面上无法正确呈现的问题.有关如何解决此问题的任何想法?

标题

 <thead>
                <tr>
                    <th></th>
                    <th>@Index.LastName</th>
                    <th>@Index.FirstName</th>
                    <th>@Index.Contact</th>
                    <th>@Index.Division</th>
                    <th>@Index.ClubName</th>
                    <th>@Index.Position</th>
                </tr>
            </thead>
Run Code Online (Sandbox Code Playgroud)

那个行动:

public ActionResult PrintResults(UserMemberSearchViewModel model)
{
    model.Results = UserMemberSearchTasks.Search(model);
    return new PartialViewAsPdf("ResultsPDF", model)
    {
        FileName = Resources.UserMemberSearch.Index.MemberDetails + ".pdf",

    };
}
Run Code Online (Sandbox Code Playgroud)

结果

在此输入图像描述

Sli*_*nky 11

这解决了问题,这显然是由wktohtml中的错误引起的.

<style>
      tr { page-break-inside: avoid;}
</style>
Run Code Online (Sandbox Code Playgroud)

看到这个更多......

  • 正确的解决方案是使用 `thead, tfoot { display: table-row-group }` (2认同)