Maak, bewerk, inspecteer, bereken en exporteer Excel-workbooks rechtstreeks vanuit Delphi- of C++Builder-code. HotXLS is een native Object Pascal-spreadsheetbibliotheek met broncode voor XLS- en XLSX-workflows, ontworpen voor desktoptools, batchtaken, rapportagesystemen en server-side documentgeneratie zonder Microsoft Excel-automatisering.
Dit artikel is bedoeld voor teams editing workbook content while preserving macro payloads and link relationships they do not own. Het behandelt VBA payload and external link preservation als productiegerichte documentengineering, niet als een losse componentaanroep.
Het praktische risico is dat a workbook can save successfully while silently dropping VBA projects, changing link targets, or refreshing data connections against policy. Daarom heeft de workflow een geschreven contract, observeerbare diagnose en representatieve regressiebestanden nodig.
Architectuurbeslissingen
Identify protected workbook assets before editing. whether macro-enabled workbooks are accepted, preserved, blocked, or converted / external link inventory, update policy, trusted domains, and refresh behavior
- whether macro-enabled workbooks are accepted, preserved, blocked, or converted
- external link inventory, update policy, trusted domains, and refresh behavior
- which workbook edits are allowed without rewriting protected payloads
- security warning, operator review, and audit-report requirements
Implementatiepad
Preserve opaque payloads unless policy says otherwise. The order below keeps the workflow reviewable for Delphi and C++Builder teams.
- inventory VBA projects, external links, data connections, and defined names before editing
- load worksheet data changes without executing or refreshing external content
- preserve opaque payloads where policy allows and mark blocked content clearly
- save in a format that supports the required payloads
- compare pre-save and post-save inventories before delivery
Validatiebewijs
Preservation evidence for governed workbooks. Keep these fields with the output or support record.
- macro presence, VBA project preservation status, and macro-enabled format decision
- external link targets, trusted or blocked status, and refresh policy
- payload inventory before and after save
- operator decision for workbooks with governed content
Preservation is not execution
Preserving VBA payloads and external links means keeping workbook structures intact while clearly avoiding automatic trust or execution. The application should inventory what exists and decide what is allowed to change.
Implementatienotities voor productie
Behandel HotXLS: VBA payload and external link preservation in Delphi als een expliciet servicecontract rond de HotXLS-aanroepen, met gescheiden invoercontrole, werkmapopbouw, uitvoercontrole en supportbewijs
- Leg gegevensbron, celbereiken en uitvoerformaat vast voordat de werkmap wordt gemaakt
- Log rijenaantal, bladen, waarschuwingen en uitvoerpad in controleerbaar supportbewijs
- Plaats applicatiespecifieke details in testbare helpers in plaats van UI-events
- Open of inspecteer het opgeslagen bestand voordat het naar een ander systeem of klant gaat
Foutscenario's om te oefenen
- Een geslaagde SaveAs bewijst niet dat het zakelijke contract klopt
- Lettertypen, rechten en regionale instellingen kunnen verschillen tussen server en ontwikkelmachine
- Logs mogen geen wachtwoorden, klantgegevens of interne links onthullen
Uitgebreid Delphi-voorbeeld
Het volgende Delphi-voorbeeld toont een praktische servicegrens voor dit onderwerp en houdt beleid, logging en validatie testbaar gescheiden
procedure UpdateLinkedWorkbookWithoutBreakingMacros(const InputFile, OutputFile: string; const Update: TWorkbookUpdate);
var
Wb: TXLSXWorkbook;
BeforeState: TMacroLinkInventory;
AfterState: TMacroLinkInventory;
begin
RequireFileExists(InputFile);
Wb := TXLSXWorkbook.Create;
try
Wb.Open(InputFile);
BeforeState := CaptureMacroAndLinkInventory(Wb);
AssertAllowedExternalLinks(BeforeState, Update.AllowedLinkHosts);
SetNamedValue(Wb, 'RefreshDate', Update.RefreshDate);
FillNamedTable(Wb, 'DataRefreshRows', Update.Rows);
Wb.Calculate;
if Wb.SaveAs(OutputFile) <> 1 then
RaiseWorkbookSaveError(OutputFile);
AfterState := InspectMacroAndLinkInventory(OutputFile);
AssertMacroModulesPreserved(BeforeState, AfterState);
AssertExternalLinksPolicy(AfterState, Update.AllowedLinkHosts);
WriteMacroLinkAudit(OutputFile, BeforeState, AfterState);
finally
Wb.Free;
end;
end;
Productiechecklist
- 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