Skapa, redigera, granska, beräkna och exportera Excel-arbetsböcker direkt från Delphi- eller C++Builder-kod. HotXLS är ett nativt Object Pascal-bibliotek med källkod för XLS- och XLSX-flöden, avsett för skrivbordsverktyg, batchjobb, rapportsystem och serversidig dokumentgenerering utan Microsoft Excel-automatisering.
Den här artikeln är skriven för teams delivering password-protected XLSX files from Delphi services or desktop applications. Den behandlar XLSX AES-protected output som produktionsnära dokumentteknik, inte som ett isolerat komponentanrop.
Den praktiska risken är att protected workbook output can satisfy a password prompt but still fail policy if key handling, password delivery, viewer compatibility, and unsupported encrypted-read paths are unclear. Därför behöver flödet ett skrivet kontrakt, observerbar diagnostik och realistiska regressionsfiler.
Arkitekturbeslut
Separate workbook protection from file encryption. password generation, delivery, rotation, escrow, and retry policy / difference between workbook structure protection, sheet protection, and file encryption
- password generation, delivery, rotation, escrow, and retry policy
- difference between workbook structure protection, sheet protection, and file encryption
- supported target applications and whether encrypted input reading is part of scope
- temporary file and support-bundle handling for protected workbooks
Implementeringsflöde
Create protected output from a named security profile. The order below keeps the workflow reviewable for Delphi and C++Builder teams.
- generate the workbook content and validate it before applying file encryption
- select the AES protection profile and obtain the password through approved code paths
- save the protected XLSX to a controlled temporary destination
- test open behavior with target Excel versions or downstream consumers
- log security profile identifiers without logging secrets
Valideringsbevis
Protection evidence for delivery and support. Keep these fields with the output or support record.
- security profile, output format, protection mode, target viewer test, and output hash
- password delivery channel identifier without password value
- temporary path, cleanup result, and retention rule
- viewer compatibility result and operator-facing failure reason
Password-protected XLSX still needs workflow policy
AES-protected output is a delivery decision. The application should know how passwords are generated, transmitted, rotated, and never logged; it should also verify that target viewers can open the result.
Implementeringsanteckningar för produktion
Behandla HotXLS Component: XLSX AES-protected output in Delphi som ett tydligt servicekontrakt runt HotXLS-anropen, med separerad indatavalidering, arbetsboksskrivning, utdata kontroll och supportbevis
- Bestäm datakälla, cellområden och utdataformat innan arbetsboken skapas
- Logga rader, blad, varningar och utdata sökväg i granskningsbar supportevidens
- Kapsla applikationsdetaljer i testbara helpers i stället för UI-händelser
- Öppna eller inspektera den sparade filen innan den lämnas till ett annat system eller kunden
Felmoder att öva
- En lyckad SaveAs bevisar inte att affärskontraktet fortfarande är korrekt
- Typsnitt, behörigheter och regionala inställningar kan skilja mellan server och utvecklingsdator
- Loggar får inte exponera lösenord, kunddata eller interna länkar
Detaljerat Delphi-exempel
Följande Delphi-exempel visar en praktisk servicegräns för ämnet och håller policy, loggning och validering testbart separerade
procedure SaveProtectedXlsxReport(const OutputFile, Password: string; const Rows: TArray<TSecureRow>);
var
Wb: TXLSXWorkbook;
Sh: IXLSWorksheet;
RowIndex: Integer;
Row: TSecureRow;
Policy: TEncryptionPolicy;
begin
RequireStrongWorkbookPassword(Password);
Policy := BuildEncryptionPolicy('customer-delivery', 256);
Wb := TXLSXWorkbook.Create;
try
Sh := Wb.Sheets[0];
Sh.Name := 'Secure Export';
WriteHeaderRow(Sh, ['RecordId', 'Owner', 'Amount', 'Status']);
RowIndex := 2;
for Row in Rows do
begin
Sh.Range['A' + IntToStr(RowIndex)].Value := Row.RecordId;
Sh.Range['B' + IntToStr(RowIndex)].Value := Row.Owner;
Sh.Range['C' + IntToStr(RowIndex)].Value := Row.Amount;
Sh.Range['D' + IntToStr(RowIndex)].Value := Row.Status;
Inc(RowIndex);
end;
WriteEncryptionAuditSheet(Wb, Policy, RowIndex - 2);
SaveAsEncryptedWorkbook(Wb, OutputFile, Password, Policy);
VerifyEncryptedWorkbookCanOpen(OutputFile, Password);
RegisterSecureDelivery(OutputFile, Policy);
finally
Wb.Free;
end;
end;
Produktionschecklista
- Run the workflow on an empty workbook, a normal customer workbook, and a worst-case workbook
- Open the output with the target spreadsheet application or downstream importer
- Log product version, template version, profile, row count, output path, elapsed time, and warning count
- Keep passwords, temporary files, customer data, and support bundles under explicit retention rules
- Add regression workbooks when a customer file exposes a new edge case