Excel çalışma kitaplarını doğrudan Delphi veya C++Builder kodundan oluşturun, düzenleyin, inceleyin, hesaplayın ve dışa aktarın. HotXLS; Microsoft Excel otomasyonu olmadan masaüstü araçları, batch işleri, raporlama sistemleri ve sunucu tarafı belge üretimi için tasarlanmış, XLS ve XLSX iş akışlarına yönelik kaynak kodlu yerel bir Object Pascal kütüphanesidir.
Bu yazı teams producing many workbooks from services, schedulers, APIs, or report farms için hazırlanmıştır. streaming write and server batch jobs konusunu tek bir bileşen çağrısı olarak değil, üretim düzeyinde belge mühendisliği olarak ele alır.
Pratik risk şudur: batch generation can overload memory, leave temporary files, retry unsafe stages, or hide partial output unless job boundaries are explicit. Bu nedenle akışın yazılı sözleşmeye, gözlemlenebilir tanılara ve gerçekçi regresyon dosyalarına ihtiyacı vardır.
Mimari kararlar
Treat every workbook as an isolated job. job identifier, output destination, retry policy, timeout, and cancellation behavior / temporary file location, cleanup, quota, and retention for failed workbooks
- job identifier, output destination, retry policy, timeout, and cancellation behavior
- temporary file location, cleanup, quota, and retention for failed workbooks
- batch size, concurrency level, progress reporting, and back-pressure
- which validation can run before final upload or delivery
Uygulama akışı
Stream output only after validation checkpoints are defined. The order below keeps the workflow reviewable for Delphi and C++Builder teams.
- assign a job identifier and output boundary before opening the workbook writer
- prepare styles, sheets, and headers before streaming row data
- write rows in batches and checkpoint progress for operators
- validate size, sheet count, row count, and key formulas before final delivery
- clean or retain temporary files according to success, cancellation, or failure
Doğrulama kanıtı
Batch evidence for operators. Keep these fields with the output or support record.
- job identifier, batch item count, row count, output size, elapsed time, and memory peak
- stage timings for data load, workbook write, validation, save, and upload
- temporary path, cleanup status, retry count, and cancellation reason
- operator-facing failure reason and whether retry is safe
Streaming is a resource policy
Streaming write helps scale workbook generation, but it also limits which parts of the workbook can be revisited later. The job design should decide what must be known before streaming begins.
Üretim uygulama notları
HotXLS: streaming write and server batch jobs in Delphi konusunu HotXLS çağrılarının çevresinde açık bir servis sözleşmesi olarak ele alın; giriş doğrulama, çalışma kitabı yazma, çıktı denetimi ve destek kanıtını ayırın
- Çalışma kitabını oluşturmadan önce veri kaynağını, hücre aralıklarını ve çıktı biçimini belirleyin
- Satır sayısı, sayfalar, uyarılar ve çıktı yolunu incelenebilir destek kaydına yazın
- Uygulamaya özel ayrıntıları UI olaylarına değil test edilebilir helper'lara yerleştirin
- Dosyayı başka sisteme veya müşteriye vermeden önce kaydedilmiş çıktıyı yeniden açın veya inceleyin
Prova edilmesi gereken hata kipleri
- Başarılı SaveAs çağrısı iş sözleşmesinin doğru kaldığını kanıtlamaz
- Sunucu ile geliştirici makinesinde yazı tipleri, izinler ve bölgesel ayarlar farklı olabilir
- Loglar parola, müşteri verisi veya iç bağlantı açığa çıkarmamalıdır
Ayrıntılı Delphi örneği
Aşağıdaki Delphi örneği bu konu için pratik bir servis sınırı gösterir ve politika, günlükleme ve doğrulamayı test edilebilir katmanda tutar
procedure RunWorkbookBatch(const Jobs: TArray<TWorkbookJob>);
var
Job: TWorkbookJob;
JobResult: TWorkbookJobResult;
begin
for Job in Jobs do
begin
StartJobAudit(Job.Id, Job.OutputFile);
try
RequireWritableDestination(Job.OutputFile);
RequireTempQuota(Job.TempFolder, Job.ExpectedRows);
JobResult := WriteWorkbookJob(Job);
ValidateWorkbookForDelivery(JobResult.OutputFile, JobResult.ExpectedRows);
CompleteJobAudit(Job.Id, JobResult);
except
on E: Exception do
begin
MarkJobFailed(Job.Id, E.Message, CanRetryWorkbookJob(Job));
CleanupOrRetainTempFiles(Job, E);
raise;
end;
end;
end;
end;
function WriteWorkbookJob(const Job: TWorkbookJob): TWorkbookJobResult;
var
Wb: TXLSXWorkbook;
Sh: IXLSWorksheet;
begin
Wb := TXLSXWorkbook.Create;
try
Sh := Wb.Sheets[0];
Sh.Name := 'Batch Output';
StreamRowsIntoWorksheet(Sh, Job.Reader, Job.Progress);
WriteBatchMetricsSheet(Wb, Job);
if Wb.SaveAs(Job.OutputFile) <> 1 then
RaiseWorkbookSaveError(Job.OutputFile);
Result := BuildWorkbookJobResult(Job);
finally
Wb.Free;
end;
end;
Üretim kontrol listesi
- 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