Search code examples
windowsdelphifile-properties

Delphi: How to SET(write) extended file properties?


I would like to set properties as shown in Windows Explorer File Properties->Summary Tab (Authors, Title, Subject, etc). (In Windows 7 is the Details tab) I already know how to GET them using StgCreateStorageEx,

The target file extensions are xls, xlsx, csv, txt and jpg files. OS: Windows 2003/2008/XP/Windows 7. Notice that this code will go a web service application and the server does not have Excel installed.

Note:It seems to be that there is no information/sample code about how to SET them. Details tab


Solution

  • Partial answer: The set property Delphi code can be found here. or if you have the latest JCL library - use TJclFilePropertySet at jclNtfs.pas Warning: Notice that this code works for xls files but it does not seem to work for txt/cvs and jpg files in Windows 7 Pro/Enterprise or 2008 (64 bits). It seems that M$ has changed the way properties work in these OS: "You can't add or change the file properties of some types of files. For example, you can't add any properties to TXT or RTF file". Sadly for me, going back to XP mode is not an option.