How to remove the Related People (Author and Modified By) property of Excel file using EPPlus in C#

442 Views Asked by At

I am using the EPPlus to create an excel file. Now I want to remove the Related People (Author and Modified By) property of the Excel file.

How can I do this?

1

There are 1 best solutions below

0
Viveka On BEST ANSWER

Answering my own question, this can be done by adding the Workbook.Properties.LastModefiedBy and Workbook.Properties.Author to the ExcelPackage as below:

//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;