Dim Book As New XLS.Book(ProjectPath & "Attachments\监造周报.xls") Dim fl As String = ProjectPath & "Reports\监造周报.xls" Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表 'Sheet.Locked = True '禁止编辑 With Sheet.PrintSetting '页眉左边为日期,中间为时间,右边为表名 .Header = "&R&G" .Footer = "&R第&P页,总&N页" End With Book.Build() '生成细节区 Book.Save(fl) '保存工作簿