LeeSki

 NPOI从Nuget上下载

//设置Excel打印分页
table.FitToPage = false;
const int rowBreakCount = 22;//每个打印分页22行,起始是第27行
for (int j = 27; j < i; j += rowBreakCount)
{
     table.SetRowBreak(j); //设置Excel打印分页
}

 注意打印的结果可能横向也会有打印分页,这是因为超过了打印的范围大小,缩小一下单元格就可以解决

设置打印标题

//设置打印标题(0-4行)
table.RepeatingRows = new NPOI.SS.Util.CellRangeAddress(0, 4, 0, 0);

参考资料:https://www.cnblogs.com/lstory/p/6812353.html 

设置页脚

//设置打印的页脚
table.Footer.Left = "本图纸知识产权属于**责任公司,未经书面许可,不得复制、传播和使用。";
table.Footer.Right = @"第  &P 页,共 &N 页";

参考资料:https://www.cnblogs.com/cppfans140812/p/5694417.html

 

End

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2021-10-29
  • 2022-12-23
  • 2021-07-29
猜你喜欢
  • 2022-01-17
  • 2021-11-24
  • 2021-09-01
  • 2022-12-23
  • 2021-11-17
  • 2021-07-29
相关资源
相似解决方案