[英]c# edit excel file if print pages > 1?
I have a function that writes a large list of data to an excel file. 我有一个函数,可以将大量数据写入excel文件。 It is created on the fly, with a header and title being inserted at creation rather than using an existing template. 它是动态创建的,在创建时会插入标题和标题,而不是使用现有模板。 At the minute it prints out at about 6 pages, I know i can use xlWorkSheet2.PageSetup.Pages.Count to get how many pages there are, but what i'm looking to do is detect when there will be a new page printed, and add my header/title to the top of this page before it prints. 在它大约打印6页时,我知道我可以使用xlWorkSheet2.PageSetup.Pages.Count来获取有多少页,但是我要做的是检测何时将打印新页,并在页面顶部添加我的标题/标题,然后再进行打印。
Any ideas how to do this? 任何想法如何做到这一点?
您可以定义一次标题,然后使用它来设置标题的范围,该范围在随后的每个页面上重复。
xlWorkSheet2.PageSetup.PrintTitleRows = "$1:$1"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.