Skip to main content
All docs
V26.1
  • RichEditDocumentServerOptions.SecurityLoadingOptions Property

    Gets the security loading options for a document.

    Namespace: DevExpress.XtraRichEdit

    Assembly: DevExpress.RichEdit.v26.1.Core.dll

    Declaration

    public WordProcessingSecurityLoadingOptions SecurityLoadingOptions { get; }

    Property Value

    Type Description
    WordProcessingSecurityLoadingOptions

    An object that contains the security loading options for a document.

    Property Paths

    You can access this nested property as listed below:

    Object Type Path to SecurityLoadingOptions
    RichEditDocumentServer
    .Options .SecurityLoadingOptions

    Remarks

    The SecurityLoadingOptions property instructs the API to detect specific threats during a file loading operation. If matching content is located, the RichEditDocumentServer.SecurityLoadingOptionsViolation event fires. Set e.Handled = false in the event handler to remove the detected content, or leave it set to true to retain the content (useful for audit-only modes).

    Example

    How to: Set Security Loading Options and Handle Violations

    The following code snippet sets SecurityLoadingOptions and handles the SecurityLoadingOptionsViolation event:

    using DevExpress.XtraRichEdit;
    
    var wordProcessor = new RichEditDocumentServer();
    WordProcessingSecurityLoadingOptions securityLoadingOptions = wordProcessor.Options.SecurityLoadingOptions;
    
    securityLoadingOptions.RestrictedHyperlinkRemovalMode = RestrictedHyperlinkRemovalMode.Full;
    securityLoadingOptions.RemoveRestrictedLinks = true;
    securityLoadingOptions.RemoveExternalImages = true;
    securityLoadingOptions.RemoveOleObjects = true;
    securityLoadingOptions.RemoveActiveXContent = true;
    securityLoadingOptions.RemoveMacros = true;
    securityLoadingOptions.RemoveDDEFields = true;
    securityLoadingOptions.RemoveIncludePictureFields = true;
    securityLoadingOptions.RemoveCustomXMLParts = true;
    
    wordProcessor.SecurityLoadingOptionsViolation += (sender, e) => {
        Console.WriteLine($"Dangerous content found: {e.PropertyName}");
        e.Handled = false; // false = remove the content
    };
    
    wordProcessor.LoadDocument("external_submission.docm")
    
    See Also