Twórz, edytuj, sprawdzaj, obliczaj i eksportuj skoroszyty Excel bezpośrednio z kodu Delphi lub C++Builder. HotXLS to natywna biblioteka Object Pascal z kodem źródłowym dla przepływów XLS i XLSX, przeznaczona do narzędzi desktopowych, zadań batch, systemów raportowych i generowania dokumentów po stronie serwera bez automatyzacji Microsoft Excel.
Ten artykuł jest przeznaczony dla teams replacing Excel COM automation in services, batch tools, installers, or desktop utilities. Traktuje Office-free workbook automation jako produkcyjną inżynierię dokumentów, a nie pojedyncze wywołanie komponentu.
Praktyczne ryzyko polega na tym, że Excel automation is often hidden infrastructure; replacing it requires explicit policies for calculation, templates, fonts, formats, and deployment. Dlatego przepływ wymaga spisanego kontraktu, obserwowalnej diagnostyki i realistycznych plików regresyjnych.
Decyzje architektoniczne
Remove desktop Office from the runtime contract. supported input and output formats such as XLS, XLSX, ODS, CSV, and HTML / template ownership, calculation expectations, and formatting policy
- supported input and output formats such as XLS, XLSX, ODS, CSV, and HTML
- template ownership, calculation expectations, and formatting policy
- service account permissions, file locking, concurrency, and temporary storage
- verification steps used instead of opening Excel during generation
Przebieg implementacji
Build workbook output as application logic. The order below keeps the workflow reviewable for Delphi and C++Builder teams.
- inventory existing COM automation behavior before replacing it
- move workbook generation into a service layer with explicit profiles
- load templates, fill data, calculate, validate, and save without launching Excel
- run output checks with workbook-level diagnostics and representative files
- deploy with file-system and service permissions tested under the real account
Dowody walidacji
Automation evidence for deployment. Keep these fields with the output or support record.
- automation profile, template version, input format, output format, and calculation mode
- service identity, output path, temporary storage, concurrency level, and elapsed time
- warnings for unsupported Excel automation behaviors that were not replicated
- open or validation result in target downstream applications
No Excel process means fewer surprises, not fewer decisions
Office-free automation avoids desktop session, COM, and installed Office dependencies. The application still needs to own workbook formats, calculation strategy, file locking, templates, and output verification.
Uwagi wdrożeniowe dla produkcji
Traktuj HotXLS Component: Office-free workbook automation in Delphi jako jawny kontrakt usługi wokół wywołań HotXLS, oddzielając walidację wejścia, zapis skoroszytu, kontrolę wyniku i dowody dla wsparcia
- Ustal źródło danych, zakresy komórek i format wyjściowy przed utworzeniem skoroszytu
- Zapisuj liczbę wierszy, arkusze, ostrzeżenia i ścieżkę wyjściową w możliwym do sprawdzenia logu
- Szczegóły aplikacji zamykaj w testowalnych helperach zamiast w zdarzeniach UI
- Otwórz lub sprawdź zapisany plik przed przekazaniem go do innego systemu lub klienta
Tryby awarii do przećwiczenia
- Udany SaveAs nie dowodzi, że kontrakt biznesowy nadal jest poprawny
- Czcionki, uprawnienia i ustawienia regionalne mogą różnić się między serwerem a maszyną deweloperską
- Logi nie mogą ujawniać haseł, danych klientów ani linków wewnętrznych
Szczegółowy przykład Delphi
Poniższy przykład Delphi pokazuje praktyczną granicę usługi dla tego tematu, z polityką, logowaniem i walidacją w warstwie możliwej do testowania
procedure BuildNightlyWorkbookWithoutExcel(const OutputFile: string; const ReportDate: TDate);
var
Wb: TXLSXWorkbook;
Summary: IXLSWorksheet;
Detail: IXLSWorksheet;
begin
Wb := TXLSXWorkbook.Create;
try
Summary := Wb.Sheets[0];
Summary.Name := 'Summary';
Detail := AddWorksheet(Wb, 'Detail');
WriteReportHeader(Summary, 'Nightly Operations', ReportDate);
WriteSummaryMetrics(Summary, LoadSummaryMetrics(ReportDate));
WriteDetailRows(Detail, LoadDetailRows(ReportDate));
LinkSummaryToDetail(Summary, Detail);
Wb.Calculate;
ValidateServerEnvironment(['fonts', 'temp-path', 'write-access']);
WriteAutomationAudit(Wb, 'no-excel-automation', ReportDate);
if Wb.SaveAs(OutputFile) <> 1 then
RaiseWorkbookSaveError(OutputFile);
finally
Wb.Free;
end;
end;
Lista produkcyjna
- 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