GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / GetFormFieldDoNotSpellCheck Method
A unique form field identifier specifying a required form field object. You can obtain this identifier using methods like GetFormFieldId, GetFormFieldChildID or methods intended to add form fields.
Example





In This Topic
GetFormFieldDoNotSpellCheck Method (GdPicturePDF)
In This Topic
Returns, if the DoNotSpellCheck flag of a required form field, hereabout a text field or an editable combo box, is set. The required form field object is specified by its unique form field's identifier and it is related to the currently loaded PDF document. As stated, this flag is only specific to text fields and editable combo boxes, so this method is explicitly applicable to text and combo box form field objects.

If this flag is set, then text entered in the form field is not spell-checked.

Syntax
'Declaration
 
Public Function GetFormFieldDoNotSpellCheck( _
   ByVal FieldId As Integer _
) As Boolean
public bool GetFormFieldDoNotSpellCheck( 
   int FieldId
)
public function GetFormFieldDoNotSpellCheck( 
    FieldId: Integer
): Boolean; 
public function GetFormFieldDoNotSpellCheck( 
   FieldId : int
) : boolean;
public: bool GetFormFieldDoNotSpellCheck( 
   int FieldId
) 
public:
bool GetFormFieldDoNotSpellCheck( 
   int FieldId
) 

Parameters

FieldId
A unique form field identifier specifying a required form field object. You can obtain this identifier using methods like GetFormFieldId, GetFormFieldChildID or methods intended to add form fields.

Return Value

true if the DoNotSpellCheck flag of the specified form field is set, otherwise false. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only allowed for use with non-encrypted documents.

It is recommend to use the GetStat method to identify the specific reason for the method's failure, if any.

Just to remind you that this method is only meaningful for text fields and editable combo boxes, otherwise it will fail.

Example
How to determine if the DoNotSpellCheck flag is set for the text form fields in the current document.
Dim caption As String = "Example: GetFormFieldDoNotSpellCheck"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
'Please use the PDF document created using the example from the SetFormFieldDoNotSpellCheck() method.
If gdpicturePDF.LoadFromFile("forms_textfield.pdf", False) = GdPictureStatus.OK Then
    Dim count As Integer = gdpicturePDF.GetFormFieldsCount()
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim message As String = ""
        If count = 0 Then message = "This document does not contain any forms."
        Dim formID As Integer = 0, j As Integer = 0
        Dim scroll As Boolean = False, spell As Boolean = False, multiline As Boolean = False
        Dim type As PdfFormFieldType = PdfFormFieldType.PdfFormFieldTypeUnknown
        For i As Integer = 0 To count - 1
            formID = gdpicturePDF.GetFormFieldId(i)
            If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                type = gdpicturePDF.GetFormFieldType(formID)
                If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                    If type = PdfFormFieldType.PdfFormFieldTypeText Then
                        j += 1
                        message = message + j.ToString() + ".text field:" + vbCrLf
            
                        scroll = gdpicturePDF.GetFormFieldDoNotScroll(formID)
                        message = message + "  DoNotScroll = "
                        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                            message = message + scroll.ToString()
                        Else
                            message = message + gdpicturePDF.GetStat().ToString()
                        End If
            
                        spell = gdpicturePDF.GetFormFieldDoNotSpellCheck(formID)
                        message = message + "    DoNotSpellCheck = "
                        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                            message = message + spell.ToString()
                        Else
                            message = message + gdpicturePDF.GetStat().ToString()
                        End If
            
                        multiline = gdpicturePDF.GetFormFieldMultiLine(formID)
                        message = message + "    MultiLine = "
                        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
                            message = message + multiline.ToString()
                        Else
                            message = message + gdpicturePDF.GetStat().ToString()
                        End If
                        message += vbCrLf
                    End If
                Else
                    message = message + "The GetFormFieldType() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
                    Exit For
                End If
            Else
                message = message + "The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString()
                Exit For
            End If
        Next
        MessageBox.Show(message, caption)
    Else
        MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: GetFormFieldDoNotSpellCheck";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
//Please use the PDF document created using the example from the SetFormFieldDoNotSpellCheck() method.
if (gdpicturePDF.LoadFromFile("forms_textfield.pdf", false) == GdPictureStatus.OK)
{
    int count = gdpicturePDF.GetFormFieldsCount();
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        string message = "";
        if (count == 0)
            message = "This document does not contain any forms.";
        int formID = 0, j = 0;
        bool scroll = false, spell = false, multiline = false;
        PdfFormFieldType type = PdfFormFieldType.PdfFormFieldTypeUnknown;
        for (int i = 0; i < count; i++)
        {
            formID = gdpicturePDF.GetFormFieldId(i);
            if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            {
                type = gdpicturePDF.GetFormFieldType(formID);
                if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
                {
                    if (type == PdfFormFieldType.PdfFormFieldTypeText)
                    {
                        j++;
                        message = message + j.ToString() + ".text field:\n";
            
                        scroll = gdpicturePDF.GetFormFieldDoNotScroll(formID);
                        message = message + "  DoNotScroll = ";
                        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
                            message = message + scroll.ToString();
                        else
                            message = message + gdpicturePDF.GetStat().ToString();
            
                        spell = gdpicturePDF.GetFormFieldDoNotSpellCheck(formID);
                        message = message + "    DoNotSpellCheck = ";
                        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
                            message = message + spell.ToString();
                        else
                            message = message + gdpicturePDF.GetStat().ToString();
            
                        multiline = gdpicturePDF.GetFormFieldMultiLine(formID);
                        message = message + "    MultiLine = ";
                        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
                            message = message + multiline.ToString();
                        else
                            message = message + gdpicturePDF.GetStat().ToString();
            
                        message += "\n";
                    }
                }
                else
                {
                    message = message + "The GetFormFieldType() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
                    break;
                }
            }
            else
            {
                message = message + "The GetFormFieldId() method has failed with the status: " + gdpicturePDF.GetStat().ToString();
                break;
            }
        }
        MessageBox.Show(message, caption);
    }
    else
        MessageBox.Show("The GetFormFieldsCount() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
    MessageBox.Show("The file can't be loaded.", caption);
gdpicturePDF.Dispose();
See Also