c# - 如何应用分页符
问题描述
我试图从表格中跳过我的 TR,但我无法应用它。如果我的页面等于 1 并且 countSeq = 2,那么它会设置 always 的值。跳到下一页。
我正在努力:
<table class="table table-striped table-itens-pedido-report">
<thead style="border: none !important;">
<tr style="border: none !important">
@if (ViewBag.bSeqProduto == true)
{
<th style="width:3% !important ; border: none !important;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;font-weight: 600 !important;font-size: 12px !important;">SEQ</th>
}
@if (ViewBag.bImagemProduto == true)
{
<th style="width:5% !important ; border: none !important;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;font-weight: 600 !important;font-size: 12px !important;">IMAGEM</th>
}
@if (ViewBag.bTotalProduto)
{
<th style="width:8% !important ; border: none !important ; text-align:center !important;font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;font-weight: 600 !important;font-size: 12px !important;">TOTAL</th>
}
</tr>
</thead>
@{int contadorSeq = 0;}
<tbody>
@foreach (var item in agrupar.Distinct())
{
string classPageBreak = "always";
if ((pagina == 1 && contadorSeq == 2) || contadorSeq >= 1)
{
classPageBreak = "always";
}
<tr style="border: none !important; page-break-after: @(classPageBreak) ">
@if (ViewBag.bSeqProduto == true)
{
<th style="font-size: 13px !important; width:3% !important ; text-align:center">@contadorSeq</th>
}
</tr>
</table>
总结问题,我需要从tr跳,编程逻辑是工作的。
解决方案
您必须在文档头中插入一些样式
<head>
<style>
@media print {
tr.page-break { display: block; page-break-before: always; }
}
</style>
</head>
这是描述它的答案
推荐阅读
- vhdl - 如何在 vhdl 中重置序列识别自动机中的变量?
- java - 如何在java中的数组中获取某些字符串值
- mysql - 从具有不同键值的mysql中选择
- wix - MSI 安装程序中的 ADDLOCAL=FEATURE1 删除其他 FEATURES
- django - 更改 Django 用户列表显示
- google-streetview-publish - STATUS:INVALID_ARGUMENT and ERROR: The API Key and the authentication credential are from different projects
- templates - 自定义模板 Prestashop
- algorithm - 一个顶点的团
- javascript - 需要等待 setInterval 过程完成
- slurm - slurm:Slurm 作业的源代码及其依赖文件应该存储在哪里?