Technischer Artikel

HotXLS Component: ODS open, save, and round-trip in Delphi

Erstellen, bearbeiten, pruefen, berechnen und exportieren Sie Excel-Arbeitsmappen direkt aus Delphi- oder C++Builder-Code. HotXLS ist eine native Object-Pascal-Bibliothek fuer XLS und XLSX, entwickelt fuer Desktop-Tools, Batchauftraege, Berichte und Dokumenterzeugung ohne Microsoft-Excel-Automatisierung.

Dieser Artikel richtet sich an teams accepting OpenDocument Spreadsheet files while still producing Excel-compatible workflows. Er behandelt ODS open, save, and round-trip als produktive Dokumenttechnik und nicht als kurzen Komponentenaufruf.

Das praktische Risiko besteht darin, dass round-trip support can preserve values but still lose formulas, styles, charts, or page settings when feature gaps are not reported. Deshalb braucht der Ablauf einen schriftlichen Vertrag, nachvollziehbare Diagnosen und reale Regressionsdateien.

Architekturentscheidungen

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

Implementierungsablauf

Track what is preserved, converted, or dropped. The order below keeps the workflow reviewable for Delphi and C++Builder teams.

  1. inspect the ODS package and create a feature inventory before editing
  2. map sheets, cells, formulas, styles, images, and charts to supported workbook objects
  3. apply edits while preserving original intent where possible
  4. save output in the chosen format and compare key sheets with the source
  5. attach a compatibility report when features are converted or dropped

Validierungsnachweise

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.

Implementierungshinweise für die Produktion

Behandle HotXLS Component: ODS open, save, and round-trip in Delphi als klaren Servicevertrag rund um die HotXLS-Aufrufe, mit getrennten Schritten für Eingabeprüfung, Arbeitsmappenaufbau, Ausgabekontrolle und Support-Evidenz

  • Datenquelle, Zellbereiche und Ausgabeformat festlegen, bevor die Arbeitsmappe erzeugt wird
  • Zeilenanzahl, Blattanzahl, Warnungen und Ausgabepfad in ein prüfbares Support-Protokoll schreiben
  • Anwendungsspezifische Details in testbare Helper kapseln, statt sie in UI-Ereignissen zu verteilen
  • Die gespeicherte Datei erneut öffnen oder prüfen, bevor sie an ein anderes System oder an Kunden geht

Fehlerfälle, die getestet werden sollten

  • Ein erfolgreicher SaveAs-Aufruf beweist noch nicht, dass der fachliche Vertrag stimmt
  • Schriftarten, Rechte und regionale Einstellungen können auf Servern anders sein als auf Entwicklerrechnern
  • Logs dürfen keine Passwörter, Kundendaten oder internen Links offenlegen

Ausführliches Delphi-Beispiel

Das folgende Beispiel zeigt eine praktische Servicegrenze für dieses Thema und hält Policy, Logging und Validierung testbar getrennt

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;

Produktionscheckliste

  • 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

Product documentation

HotXLS Component