Setting Core File Properties?

Hi Adrian,

What's the best way to set the Core File Properties of a worksheet? In particular I'd like to set the "Creator".

I thought it would be simply:

xls.FileProps.Core.Creator :=  'Whatever';

However, it seems Core is nil. 

You advice would be appreciated!

- Steve


xls.FileProps is an internal property. In .NET it is declared as "internal", but as sadly Delphi doesn't have an internal access modifier, they are defined as public. There aren't many of those properties, but by default, every FlexCel method and property is documented. If there isn't help on it, then it is for internal use.

APIMate should show how to set the properties, at the end of the generated code. Note also that you can only set properties in xlsx files, not in xls.

Here is an example I got from APIMate in a simple file. You can also set other properties and look at the APIMate code:

 //Standard Document Properties - Only for xlsx files
  xls.DocumentProperties.SetStandardProperty(TPropertyId.Author, 'adrian');

  //You will normally not set LastSavedBy, since this is a new file.
  //If you don't set it, FlexCel will use the creator instead.
  //  xls.DocumentProperties.SetStandardProperty(TPropertyId.LastSavedBy, 'adrian');

  //You will normally not set CreateDateTime, since this is a new file and FlexCel will automatically use the current datetime.
  //But if you are editing a file and want to preserve the original creation date, you need to either set PreserveCreationDate to true:
  //  xls.DocumentProperties.PreserveCreationDate := true;
  //Or you can hardcode a creating date by setting it in UTC time, ISO8601 format:
  //  xls.DocumentProperties.SetStandardProperty(TPropertyId.CreateTimeDate, '2015-07-31T09:09:14Z');



Thanks Adrian