Crea, modifica, ispeziona, calcola ed esporta cartelle di lavoro Excel direttamente da Delphi o C++Builder. HotXLS e una libreria nativa Object Pascal per XLS e XLSX, progettata per strumenti desktop, batch, report e generazione documenti senza automazione Microsoft Excel.
Questo articolo è rivolto a teams accepting OpenDocument Spreadsheet files while still producing Excel-compatible workflows. Tratta ODS open, save, and round-trip come ingegneria documentale di produzione, non come una semplice chiamata al componente.
Il rischio pratico è che round-trip support can preserve values but still lose formulas, styles, charts, or page settings when feature gaps are not reported. Per questo il flusso richiede un contratto scritto, diagnostica osservabile e file di regressione realistici.
Decisioni architetturali
Classify ODS compatibility before editing. accepted ODS sources, supported feature set, and blocked feature categories / formula, style, chart, image, conditional formatting, and page setup handling
- accepted ODS sources, supported feature set, and blocked feature categories
- formula, style, chart, image, conditional formatting, and page setup handling
- save format after editing and whether the user expects ODS or XLSX output
- warning policy for unsupported or approximated features
Percorso di implementazione
Track what is preserved, converted, or dropped. The order below keeps the workflow reviewable for Delphi and C++Builder teams.
- inspect the ODS package and create a feature inventory before editing
- map sheets, cells, formulas, styles, images, and charts to supported workbook objects
- apply edits while preserving original intent where possible
- save output in the chosen format and compare key sheets with the source
- attach a compatibility report when features are converted or dropped
Evidenze di validazione
Round-trip evidence for customer trust. Keep these fields with the output or support record.
- source format, sheet count, formula count, style count, chart count, and image count
- preserved, converted, approximated, and dropped feature counts
- output format, warning summary, and key-cell comparison
- viewer compatibility notes for LibreOffice and Excel when relevant
OpenDocument and Excel models overlap but differ
ODS support should identify which workbook features map cleanly, which require conversion, and which need warnings. A professional workflow gives users evidence instead of pretending every spreadsheet model is identical.
Note di implementazione per la produzione
Tratta HotXLS Component: ODS open, save, and round-trip in Delphi come un contratto di servizio esplicito attorno alle chiamate HotXLS, separando validazione dell'input, scrittura della cartella, controllo dell'output ed evidenze di supporto
- Definire origine dati, intervalli di celle e formato di output prima di creare la cartella
- Registrare righe, fogli, avvisi e percorso di output in una prova verificabile
- Incapsulare i dettagli applicativi in helper testabili invece che in eventi UI
- Riaprire o ispezionare il file salvato prima di consegnarlo a un altro sistema o al cliente
Casi di errore da provare
- Un SaveAs riuscito non prova che il contratto di business sia corretto
- Font, permessi e impostazioni locali possono variare tra server e macchina di sviluppo
- I log non devono esporre password, dati cliente o link interni
Esempio Delphi dettagliato
L'esempio Delphi seguente mostra un confine di servizio pratico per questo tema, mantenendo policy, logging e validazione in un livello testabile
procedure RoundTripOdsWorkbook(const InputOds, OutputOds: string);
var
Wb: TXLSXWorkbook;
BeforeState: TWorkbookInventory;
AfterState: TWorkbookInventory;
begin
RequireFileExists(InputOds);
Wb := TXLSXWorkbook.Create;
try
Wb.Open(InputOds);
BeforeState := CaptureWorkbookInventory(Wb);
NormalizeFeaturesForOdsOutput(Wb);
WriteCompatibilitySheet(Wb, BeforeState, 'ods-round-trip');
if Wb.SaveAs(OutputOds) <> 1 then
RaiseWorkbookSaveError(OutputOds);
AfterState := InspectSavedWorkbook(OutputOds);
CompareRoundTripInventory(BeforeState, AfterState, [
'sheet-count',
'used-ranges',
'formula-cells',
'visible-styles'
]);
finally
Wb.Free;
end;
end;
Checklist di produzione
- 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