public class SdtCalendarType
extends java.lang.Object
StructuredDocumentTag.getCalendarType() / StructuredDocumentTag.setCalendarType(int) in an Office Open XML document.
Examples:
Shows how to prompt the user to enter a date with a structured document tag.
Document doc = new Document();
// Insert a structured document tag that prompts the user to enter a date.
// In Microsoft Word, this element is known as a "Date picker content control".
// When we click on the arrow on the right end of this tag in Microsoft Word,
// we will see a pop up in the form of a clickable calendar.
// We can use that popup to select a date that the tag will display.
StructuredDocumentTag sdtDate = new StructuredDocumentTag(doc, SdtType.DATE, MarkupLevel.INLINE);
// Display the date, according to the Saudi Arabian Arabic locale.
sdtDate.setDateDisplayLocale(1025);
// Set the format with which to display the date.
sdtDate.setDateDisplayFormat("dd MMMM, yyyy");
sdtDate.setDateStorageFormat(SdtDateStorageFormat.DATE_TIME);
// Display the date according to the Hijri calendar.
sdtDate.setCalendarType(SdtCalendarType.HIJRI);
// Before the user chooses a date in Microsoft Word, the tag will display the text "Click here to enter a date.".
// According to the tag's calendar, set the "FullDate" property to get the tag to display a default date.
Calendar cal = Calendar.getInstance();
cal.set(1440, 10, 20);
sdtDate.setFullDate(cal.getTime());
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertNode(sdtDate);
doc.save(getArtifactsDir() + "StructuredDocumentTag.Date.docx");
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT
Used as default value in OOXML.
|
static int |
GREGORIAN
Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used.
|
static int |
GREGORIAN_ARABIC
Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used.
|
static int |
GREGORIAN_ME_FRENCH
Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used.
|
static int |
GREGORIAN_US
Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used.
|
static int |
GREGORIAN_XLIT_ENGLISH
Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used.
|
static int |
GREGORIAN_XLIT_FRENCH
Specifies that the Gregorian calendar, as defined in ISO 8601, shall be used.
|
static int |
HEBREW
Specifies that the Hebrew lunar calendar, as described by the Gauss formula for Passover [CITATION] and The Complete Restatement of Oral Law (Mishneh Torah),shall be used.
|
static int |
HIJRI
Specifies that the Hijri lunar calendar, as described by the Kingdom of Saudi Arabia, Ministry of Islamic Affairs, Endowments, Da‘wah and Guidance, shall be used.
|
static int |
JAPAN
Specifies that the Japanese Emperor Era calendar, as described by Japanese Industrial Standard JIS X 0301, shall be used.
|
static int |
KOREA
Specifies that the Korean Tangun Era calendar, as described by Korean Law Enactment No.
|
static int |
length |
static int |
NONE
Specifies that no calendar should be used.
|
static int |
SAKA
Specifies that the Saka Era calendar, as described by the Calendar Reform Committee of India, as part of the Indian Ephemeris and Nautical Almanac, shall be used.
|
static int |
TAIWAN
Specifies that the Taiwanese calendar, as defined by the Chinese National Standard CNS 7648, shall be used.
|
static int |
THAI
Specifies that the Thai calendar, as defined by the Royal Decree of H.M.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String sdtCalendarTypeName) |
static java.lang.String |
getName(int sdtCalendarType) |
static int[] |
getValues() |
static java.lang.String |
toString(int sdtCalendarType) |
public static int DEFAULT
GREGORIAN.public static int GREGORIAN
public static int GREGORIAN_ARABIC
public static int GREGORIAN_ME_FRENCH
public static int GREGORIAN_US
public static int GREGORIAN_XLIT_ENGLISH
public static int GREGORIAN_XLIT_FRENCH
public static int HEBREW
public static int HIJRI
public static int JAPAN
public static int KOREA
public static int NONE
Remarks:
Usually in AW, None is the first and default value for enums, but not in this case. None is not default for OOXML, instead GREGORIAN is default and is first member of this enum.
public static int SAKA
public static int TAIWAN
public static int THAI
public static int length