Delphi または C++Builder コードから直接 Excel ワークブックを作成、編集、検査、計算、エクスポートできます。HotXLS はソース付き Object Pascal スプレッドシートライブラリで、XLS/XLSX ワークフロー、デスクトップツール、バッチジョブ、レポート、Excel 自動化なしのサーバー側生成に適しています。
この記事は teams replacing Excel COM automation in services, batch tools, installers, or desktop utilities 向けです。Office-free workbook automation を単なるコンポーネント呼び出しではなく、本番向けのドキュメントエンジニアリングとして扱います。
実務上のリスクは Excel automation is often hidden infrastructure; replacing it requires explicit policies for calculation, templates, fonts, formats, and deployment です。そのため、明確な契約、観測可能な診断、実際の顧客ファイルに近い回帰サンプルが必要です。
アーキテクチャ上の判断
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
実装フロー
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
検証エビデンス
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.
本番実装の要点
HotXLS Component: Delphi での Office-free workbook automation は HotXLS 呼び出しの前後に置く明確なサービス契約として扱い、入力検証、ブック作成、出力確認、サポート証跡を分離します
- ブックを作成する前にデータソース、セル範囲、出力形式を確定する
- 行数、シート数、警告、出力先をレビュー可能な証跡として記録する
- アプリ固有の処理は UI イベントではなくテスト可能な helper に閉じ込める
- 保存済みファイルを別システムや顧客へ渡す前に再オープンまたは検査する
事前に試験すべき失敗パターン
- SaveAs の成功だけでは業務契約が正しいとは言えません
- サーバーと開発機ではフォント、権限、地域設定が異なることがあります
- ログにパスワード、顧客データ、内部リンクを残してはいけません
詳しい Delphi サンプル
次の Delphi 例は、このテーマをサービス境界として実装する形を示し、ポリシー、ログ、検証をテスト可能な層に分けます
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;
本番チェックリスト
- 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