Hi,
I would like to get the custom attributes of a protected excel workbook.
But seems the following line
Aspose.Cells.FileFormatInfo fft = Aspose.Cells.FileFormatUtil.DetectFileFormat(ms);
This doesn’t give any info about the custom attributes and
Workbook workbook = new Workbook(, options) needs password.
We add the custom attribute while generating the spreadsheet and while trying to open the sheet using the app, we use the custom attribute to retrieve the password from database. But we’re stuck with the aspose api to get the excel file custom attribute.
Is there any aspose solution available? the custom attributes are readable from the explorer window without password. So expecting password to read the attribute doesn’t sound correct.
@ksnaspose
Thanks for using Aspose APIs.
To read meta data information of the workbook, you should use
Aspose.Cells.Metadata
namespace. Please see the following code and read its comments for more help.
C#
//We only want to load document properties
Aspose.Cells.Metadata.MetadataOptions mo = new Aspose.Cells.Metadata.MetadataOptions(Aspose.Cells.Metadata.MetadataType.DocumentProperties);
//This will load meta data information of the workbook
Aspose.Cells.Metadata.WorkbookMetadata wb = new Aspose.Cells.Metadata.WorkbookMetadata("yourFile.xlsx", mo);
//Now access your custom property from custom document property collection
Aspose.Cells.Properties.CustomDocumentPropertyCollection cdpc = wb.CustomDocumentProperties;
//Access document property
Aspose.Cells.Properties.DocumentProperty dp = cdpc["MyCustomProp"];
//Print its name and value
Console.Write("Name: " + dp.Name);
Console.Write("Value: " + dp.Value);
Reference Article:
1 Like