UpdateCreatedTimeProperty

SaveOptions.UpdateCreatedTimeProperty property

يحصل على قيمة أو يعينها لتحديد ما إذا كانCreatedTime يتم تحديث الخاصية قبل الحفظ. القيمة الافتراضية هيخطأ شنيع ;

public bool UpdateCreatedTimeProperty { get; set; }

أمثلة

يوضح كيفية تحديث خاصية “CreatedTime” الخاصة بالمستند عند الحفظ.

Document doc = new Document();

DateTime createdTime = new DateTime(2019, 12, 20);
doc.BuiltInDocumentProperties.CreatedTime = createdTime;

// يحدد هذا العلم ما إذا كان الوقت الذي تم إنشاؤه، والذي يعد خاصية مضمنة، سيتم تحديثه.
// إذا كان الأمر كذلك، فسيتم تحديد تاريخ أحدث عملية حفظ للمستند
// مع هذا الكائن SaveOptions الذي تم تمريره كمعلمة يتم استخدامه كوقت الإنشاء.
DocSaveOptions saveOptions = new DocSaveOptions();
saveOptions.UpdateCreatedTimeProperty = isUpdateCreatedTimeProperty;

doc.Save(ArtifactsDir + "DocSaveOptions.UpdateCreatedTimeProperty.docx", saveOptions);

// افتح المستند المحفوظ، ثم تحقق من قيمة الخاصية.
doc = new Document(ArtifactsDir + "DocSaveOptions.UpdateCreatedTimeProperty.docx");

if (isUpdateCreatedTimeProperty)
    Assert.AreNotEqual(createdTime, doc.BuiltInDocumentProperties.CreatedTime);
else
    Assert.AreEqual(createdTime, doc.BuiltInDocumentProperties.CreatedTime);

أنظر أيضا