Classic XLS workbook metadata preservation
HotXLS preserves workbook-level BIFF8 metadata records that Excel can place in classic .xls files. This includes saved-by metadata, workbook sharing metadata, and revision protection records that are not exposed as editable high-level API objects
Preserved records
WRITEACCESS($005C) stores the Excel user name that last saved the workbook. HotXLS exposes this throughIXLSWorkbook.LastSavedBy/TXLSWorkbook.LastSavedByFILESHARING($005B) andFILESHARING2($01A5) are retained when an Excel-authored workbook is opened and saved againPROT4REV($01AF) andPROT4REVPASS($01BC) preserve workbook revision-protection metadata during open-save cyclesHIDEOBJ($008D) and zero-lengthTEMPLATE($0060) preserve workbook view policy and template markersTABID($013D) andBOOKEXT($0863) preserve sheet tab identifiers and workbook extension metadataUSERSVIEWBEGIN($01AA) throughUSERSVIEWEND($01AB) preserve Excel Custom Views in workbook globals and worksheet substreams, including unmodeled records inside the blockOBPROJ,USES-ELFS,BOOKBOOL,BACKUP,FNGROUPCOUNT,COUNTRY, andRECALCIDcontinue to round-trip through the existing raw-record preservation path
API surface
type
IXLSWorkbook = class
property LastSavedBy: WideString;
property EncryptionPassword: WideString;
end;
TXLSWorkbook = class
property LastSavedBy: WideString;
property EncryptionPassword: WideString;
end;
The file-sharing and revision-protection records are intentionally preserved as raw BIFF record payloads. HotXLS does not reinterpret or rewrite their internal flags and password hashes, so an Excel-authored workbook can pass through HotXLS without losing that metadata
Update the saved-by user name
uses lxHandle;
var
Workbook: TXLSWorkbook;
begin
Workbook := TXLSWorkbook.Create;
try
Workbook.Open('shared-template.xls');
Workbook.LastSavedBy := 'Build Server';
Workbook.SaveAs('shared-template-updated.xls');
finally
Workbook.Free;
end;
end;
Use encryption separately
Workbook sharing metadata is separate from HotXLS file encryption. To write an encrypted classic XLS file, set EncryptionPassword before saving:
Workbook.EncryptionPassword := 'secret';
Workbook.SaveAs('encrypted.xls');