مقال تقني

HotXLS Component: workbook metadata and document properties في Delphi

أنشئ وحرر وافحص واحسب وصدّر مصنفات Excel مباشرة من كود Delphi أو C++Builder. HotXLS مكتبة جداول Object Pascal أصلية مع المصدر لسير عمل XLS وXLSX، ومناسبة لأدوات سطح المكتب والمهام الدفعية وأنظمة التقارير وتوليد المستندات على الخادم دون أتمتة Microsoft Excel.

هذه المقالة موجّهة إلى teams integrating workbook output with document management, search, audit, or customer-delivery systems. وهي تتعامل مع workbook metadata and document properties كجزء من هندسة المستندات في بيئة الإنتاج، لا كاستدعاء سريع لمكوّن.

الخطر العملي هو أن metadata is often copied from templates accidentally, causing wrong authors, stale revision labels, missing retention fields, or poor search results. لذلك يحتاج المسار إلى عقد واضح وتشخيص قابل للملاحظة وملفات اختبار واقعية.

قرارات البنية

Own metadata as delivery data. standard properties such as title, subject, author, company, category, and keywords / custom properties needed for customer, job, retention, version, or workflow state

  • standard properties such as title, subject, author, company, category, and keywords
  • custom properties needed for customer, job, retention, version, or workflow state
  • whether metadata can expose personal data, internal IDs, or confidential notes
  • revision, generated-by, and template-version strategy

مسار التنفيذ

Set properties from the business record. The order below keeps the workflow reviewable for Delphi and C++Builder teams.

  1. clear template metadata that should not reach generated output
  2. populate standard and custom properties from the business record
  3. validate required properties before saving or uploading the workbook
  4. include metadata in search or DMS hand-off checks
  5. audit final properties when support bundles are created

أدلة التحقق

Metadata evidence for document management. Keep these fields with the output or support record.

  • standard property values, custom property names, and required-property status
  • template version, generator version, job identifier, and retention category
  • privacy review for metadata fields that may expose sensitive values
  • DMS or search-index acceptance result

Workbook metadata is visible outside Excel

Document properties are consumed by search indexes, records systems, portals, DMS workflows, and support staff. They should be generated deliberately rather than inherited accidentally from a designer's template file.

ملاحظات تنفيذ للإنتاج

اجعل موضوع «HotXLS Component: workbook metadata and document properties في Delphi» عقد خدمة واضحا حول استدعاءات HotXLS، مع فصل التحقق من الإدخال وكتابة المصنف وفحص الخرج وأدلة الدعم

  • حدد مصدر البيانات ونطاقات الخلايا وتنسيق الخرج قبل إنشاء المصنف
  • سجل عدد الصفوف والأوراق والتحذيرات ومسار الخرج في سجل دعم قابل للمراجعة
  • ضع التفاصيل الخاصة بالتطبيق داخل دوال مساعدة قابلة للاختبار بدلا من نشرها داخل حدث واجهة
  • افتح أو افحص الملف المحفوظ قبل تسليمه إلى نظام آخر أو إلى العميل

حالات فشل يجب اختبارها

  • نجاح SaveAs لا يثبت أن العقد التجاري بقي صحيحا
  • قد تختلف الخطوط والأذونات والإعدادات الإقليمية بين الخادم وجهاز التطوير
  • يجب ألا تكشف السجلات كلمات مرور أو بيانات عملاء أو روابط داخلية

مثال Delphi تفصيلي

يوضح المثال التالي حدود خدمة عملية لهذا الموضوع، مع إبقاء السياسات والسجلات والتحقق في طبقة يمكن اختبارها

procedure StampWorkbookMetadata(const InputFile, OutputFile: string; const Props: TWorkbookDocumentProperties);
var
  Wb: TXLSXWorkbook;
  Cover: IXLSWorksheet;
begin
  RequireFileExists(InputFile);
  Wb := TXLSXWorkbook.Create;
  try
    Wb.Open(InputFile);
    ApplyDocumentProperties(Wb, Props);
    Cover := EnsureWorksheet(Wb, 'Document Info');
    Cover.Range['A1'].Value := 'Document owner';
    Cover.Range['B1'].Value := Props.Owner;
    Cover.Range['A2'].Value := 'Classification';
    Cover.Range['B2'].Value := Props.Classification;
    Cover.Range['A3'].Value := 'Retention profile';
    Cover.Range['B3'].Value := Props.RetentionProfile;
    Cover.Range['A1:B3'].ApplyBuiltinStyle(xbsGood);

    AssertMetadataPolicy(Wb, Props);
    WriteMetadataAudit(Wb, Props);

    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

Product documentation

HotXLS Component