如何使用C#知道Excel中的分页符 [英] How to know the page break in Excel using C#
本文介绍了如何使用C#知道Excel中的分页符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用C#创建和格式化Excel电子表格,所以我需要格式化(合并单元格,更改字体等),直到第一页的最后一页。如何知道Excel电子表格中页面的最后一行?
I´m using C# to create and format a Excel spreadsheet, so I need to format (merge cells, change the font, etc) until the final of the first page. How can I know the final line of the page in the Excel spreadsheet?
推荐答案
以下代码将为您提供最后一行号码在Excel工作表中的每个水平分页符之前:
The following code will give you the last row number before every horizontal page break in an Excel worksheet:
foreach (Excel.HPageBreak pageBreak in worksheet.HPageBreaks)
{
int row = pageBreak.Location.Row - 1;
// ...
}
这篇关于如何使用C#知道Excel中的分页符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文