HotXLS Docs

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

API surface

type
  IXLSWorkbook = class
    property LastSavedBy: WideString;
    property EncryptionPassword: WideString;
  end;

  TXLSWorkbook = class
    property LastSavedBy: WideString;
    property EncryptionPassword: WideString;
    property CreatedDate: TDateTime;
    property LastSavedDate: TDateTime;
    property RevisionNumber: Integer;
    property EditTimeMinutes: Double;
    property SharedRevisionProtected: Boolean;
    property SharedRevisionPasswordHash: Word;
    property WindowProtected: Boolean;
  end;
      

The four SummaryInformation date and numeric properties (CreatedDate, LastSavedDate, RevisionNumber, EditTimeMinutes) round-trip through the OLE document-properties stream, so a workbook loaded and saved keeps its original stamps unless the application changes them

The three protection flags expose the preserved raw records as typed values: SharedRevisionProtected mirrors the PROT4REV shared-workbook revision-tracking flag, SharedRevisionPasswordHash the legacy 16-bit PROT4REVPASSWORD hash, and WindowProtected the WINDOWPROTECT flag that locks the workbook window configuration. They are read-write on the class so applications can author the same states Excel does

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');
      

Related topics