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 formatted workbook output that must remain editable and visually consistent için hazırlanmıştır. conditional formatting, rich text, and styles 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: style-heavy workbooks become slow, bloated, or visually inconsistent when every cell creates a new style or when conditional rules overlap without priority control. 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
Manage styles as reusable assets. style catalog, theme colors, indexed colors, fonts, borders, and number formats / conditional-rule priority, stop-if-true behavior, and target ranges
- style catalog, theme colors, indexed colors, fonts, borders, and number formats
- conditional-rule priority, stop-if-true behavior, and target ranges
- rich text runs, hyperlink styling, and localization of inline labels
- style reuse policy for generated rows and template-derived sections
Uygulama akışı
Apply formatting through named profiles. The order below keeps the workflow reviewable for Delphi and C++Builder teams.
- define style profiles before writing large ranges
- reuse existing workbook styles when they match the intended appearance
- apply conditional rules in explicit priority order
- write rich text runs only where the mixed formatting carries meaning
- inspect style count and workbook size as part of regression testing
Doğrulama kanıtı
Formatting evidence for regression review. Keep these fields with the output or support record.
- style count, reused style identifiers, and newly created style profiles
- conditional rule type, priority, target range, and formula or threshold
- rich text run count, font changes, and hyperlink interactions
- visual comparison against approved template output
Workbook formatting has a cost model
Conditional formatting, rich text runs, and cell styles are workbook resources. Reusing styles and explaining rule priority improves performance, file size, and long-term template maintenance.
Üretim uygulama notları
HotXLS: conditional formatting, rich text, and styles 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 BuildKpiWorkbook(const OutputFile: string; const Rows: TArray<TKpiRow>);
var
Wb: TXLSXWorkbook;
Sh: IXLSWorksheet;
RowIndex: Integer;
Row: TKpiRow;
begin
Wb := TXLSXWorkbook.Create;
try
Sh := Wb.Sheets[0];
Sh.Name := 'KPI Review';
WriteHeaderRow(Sh, ['Team', 'Owner', 'Target', 'Actual', 'Status']);
RowIndex := 2;
for Row in Rows do
begin
Sh.Range['A' + IntToStr(RowIndex)].Value := Row.Team;
Sh.Range['B' + IntToStr(RowIndex)].Value := Row.Owner;
Sh.Range['C' + IntToStr(RowIndex)].Value := Row.Target;
Sh.Range['D' + IntToStr(RowIndex)].Value := Row.Actual;
Sh.Range['E' + IntToStr(RowIndex)].Value := Row.StatusText;
Inc(RowIndex);
end;
Sh.Range['A1:E1'].ApplyBuiltinStyle(xbsTitle);
ApplyCurrencyFormat(Sh, 'C2:D' + IntToStr(RowIndex - 1));
AddTrafficLightRules(Sh, 'E2:E' + IntToStr(RowIndex - 1));
AddRichTextStatusNotes(Sh, Rows, 2);
ValidateStyleBudget(Wb, 80);
if Wb.SaveAs(OutputFile) <> 1 then
RaiseWorkbookSaveError(OutputFile);
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