usmanazizgroupdocs
12/8/2015 - 6:56 AM

AddCustomDocumentPropertiesXlsFormat.cs

// For complete examples and data files, please go to https://github.com/groupdocsmetadata/GroupDocs_Metadata_NET
// initialize XlsFormat
XlsFormat xlsFormat = new XlsFormat(Common.MapSourceFilePath(filePath));

// initialize XlsMetadata
XlsMetadata metadata = xlsFormat.DocumentProperties;

string propertyName = "New Custom Property";
string propertyValue = "123";

// check if property already exists
if (!metadata.ContainsKey(propertyName))
{
    // add property
    metadata.Add(propertyName, propertyValue);
}

// save file in destination folder
xlsFormat.Save(Common.MapDestinationFilePath(filePath));