ApiDateForm

new ApiDateForm()

Class representing a document date field.

Methods

Name Description
Clear

Clears the current form.

Copy

Copies the current form (copies with the shape if it exists).

GetClassType

Returns a type of the ApiFormBase class.

GetFormat

Gets the date format of the current form.

GetFormKey

Returns the current form key.

GetFormType

Returns a type of the current form.

GetLanguage

Gets the used date language of the current form.

GetText

Returns the text from the current form. Returns the value as a string if possible for the given form type

GetTextPr

Returns the text properties from the current form. Used if possible for this type of form

GetTime

Returns the timestamp of the current form.

GetTipText

Returns the tip text of the current form.

GetWrapperShape

Returns a shape in which the form is placed to control the position and size of the fixed size form frame. The null value will be returned for the inline forms.

IsFixed

Checks if the current form is fixed size.

IsRequired

Checks if the current form is required.

MoveCursorOutside

Places a cursor before/after the current form.

SetBackgroundColor

Sets the background color to the current form.

SetBorderColor

Sets the border color to the current form.

SetFormat

Sets the date format to the current form.

SetFormKey

Sets a key to the current form.

SetLanguage

Sets the date language to the current form.

SetPlaceholderText

Sets the placeholder text to the current form. Can't be set to checkbox or radio button.

SetRequired

Specifies if the current form should be required.

SetTextPr

Sets the text properties to the current form. Used if possible for this type of form

SetTime

Sets the timestamp to the current form.

SetTipText

Sets the tip text to the current form.

ToFixed

Converts the current form to a fixed size form.

ToInline

Converts the current form to an inline form. Picture form can't be converted to an inline form, it's always a fixed size object.

Example

Copy code
builder.CreateFile("pdf");
var oDocument = Api.GetDocument();
var oDateForm = Api.CreateDateForm({"key": "Nowadays", "tip": "Enter current date", "required": true, "placeholder": "Date", "format": "mm.dd.yyyy", "lang": "en-US"});
var oParagraph = oDocument.GetElement(0);
oParagraph.AddElement(oDateForm);
oDateForm.SetFormat("mm/dd/yyyy");
oDateForm.SetLanguage("en-CA");
oDateForm.SetTime(new Date().getTime());
var sFormat = oDateForm.GetFormat();
var sLanguage = oDateForm.GetLanguage();
var nTime = oDateForm.GetTime();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Date format: " + sFormat);
oParagraph.AddLineBreak();
oParagraph.AddText("Date language: " + sLanguage);
oParagraph.AddLineBreak();
oParagraph.AddText("Date: " + new Date(nTime));
oDocument.Push(oParagraph);
builder.SaveFile("pdf", "ApiDateForm.pdf");
builder.CloseFile();

Resulting document