如何在C#中使用EPPlus删除Excel文件的Related People(Author和Modified By)属性



我正在使用EPPlus创建一个excel文件。现在我想删除Excel文件的Related People(Author and Modified By(属性。

我该怎么做?

回答我自己的问题时,可以将Workbook.Properties.LastModefiedByWorkbook.Properties.Author添加到ExcelPackage中,如下所示:

//Get file info of temp excel file
FileInfo newFile = new FileInfo(@"your-docx-file-path");
//Create ExcelPackage for excel file
ExcelPackage pck = new ExcelPackage(newFile);
pck.Workbook.Properties.LastModifiedBy = string.Empty;
pck.Workbook.Properties.Author = string.Empty;

最新更新