FieldDateUseLunarCalendar Property |
Namespace: Aspose.Words.Fields
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // One way of putting dates into our documents is inserting DATE fields with document builder FieldDate fieldDate = (FieldDate)builder.InsertField(FieldType.FieldDate, true); // Set the field's date to the current date of the Islamic Lunar Calendar fieldDate.UseLunarCalendar = true; Assert.AreEqual(" DATE \\h", fieldDate.GetFieldCode()); builder.Writeln(); // Insert a date field with the current date of the Umm al-Qura calendar fieldDate = (FieldDate)builder.InsertField(FieldType.FieldDate, true); fieldDate.UseUmAlQuraCalendar = true; Assert.AreEqual(" DATE \\u", fieldDate.GetFieldCode()); builder.Writeln(); // Insert a date field with the current date of the Indian national calendar fieldDate = (FieldDate)builder.InsertField(FieldType.FieldDate, true); fieldDate.UseSakaEraCalendar = true; Assert.AreEqual(" DATE \\s", fieldDate.GetFieldCode()); builder.Writeln(); // Insert a date field with the current date of the calendar used in the (Insert > Date and Time) dialog box fieldDate = (FieldDate)builder.InsertField(FieldType.FieldDate, true); fieldDate.UseLastFormat = true; Assert.AreEqual(" DATE \\l", fieldDate.GetFieldCode()); builder.Writeln(); doc.UpdateFields(); doc.Save(ArtifactsDir + "Field.DATE.docx");