Dim Book As New XLS.Book(ProjectPath & "Attachments\监造周报.xls") Dim fl As String = ProjectPath & "Reports\监造周报.xls" Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表 With Sheet.PrintSetting '页眉左边为日期,中间为时间,右边为表名 .Header = "&L&D &C&T&G &R&F" ''在页脚右边打印页号和总页数 .Footer = "&R第&P页,总&N页" End With Book.Build() '生成细节区 Book.Save(fl) '保存工作簿