Nevron Open Vision Documentation
Rich Text Editor / Working With Text Documents / Document Validation
In This Topic
    Document Validation
    In This Topic

    Nevron Text supports the editing of hierarchically organized text documents. During the editing process information in the document tree can become redundant, for example, consider haveing two text inlines next to each other that have local formatting and style. To resolve these and other cases the the control automatically performs document validation and cleanup which is based on the following rules:

    1. Remove all group blocks which do not have child blocks.

    2. Remove all bullet list item blocks which do not have child blocks.

    3. Remove all bullet list blocks which do not have bullet list item or bullet list child blocks.

    4. Remove all sections which do not have child blocks except the first one.

    5. Add an empty paragraph to the first section of a document if it is the only section of the document.

    6. Add an empty paragraph to each table cell that does not have child blocks.

    7. Merge all text inlines with equal formatting.

    Those rules help to maintain the integrity of the document and are automatically validated when you perform text editing from the selection object on each text root block.

     Performing Text Integrity Validation

    You can invoke the validation of a text editing root by calling the ValidateTextIntegrity method of that block - for example, the following line of code validates the document root block text integrity:

    Validate Document Block Text Integrity
    Copy Code
    m_RichText.Content.ValidateTextIntegrity();
    
     Controlling Text Integrity Validation

    You can control text integrity validation at two levels - selection and per inline.

    Controlling Text Integrity Validation at Selection Level

    The Selection object attached to each root text element has a property called EnableTextIntegrityValidation which allows you to turn off automatically performed text validation when you perform operations with the selection object:

    Turn Off Automatic Text Integrity Validation
    Copy Code
    m_RichText.Content.Selection.EnableTextIntegrityValidation = false;
    

    Controlling Text Integrity Validation at Text Inline Level

    The text inline element has a property called AllowMerge which controls whether the inline allows merging with other inlines.

    Disable Text Inline Merge
    Copy Code
    someTextInline.AllowMerge = false;
    

     

     

    See Also