Skip to main content
All docs
V26.1
  • Row

    Workbook.Inspect(WorkbookInspectOptions) Method

    Inspects the workbook for potential issues and returns the results.

    Namespace: DevExpress.Spreadsheet

    Assembly: DevExpress.Docs.v26.1.dll

    Declaration

    public WorkbookInspectResult Inspect(
        WorkbookInspectOptions options
    )

    Parameters

    Name Type Description
    options WorkbookInspectOptions

    The options that specify which aspects of the workbook to inspect.

    Returns

    Type Description
    WorkbookInspectResult

    The result of the workbook inspection.

    Remarks

    Call the WorkbookSanitizeOptions.FromInspectResult(WorkbookInspectResult) method to build a WorkbookSanitizeOptions instance that targets only detected types. Pass the resulting options to the Workbook.Sanitize() method.

    Example

    How to: Inspect a Spreadsheet and Sanitize It Based on the Inspection Results

    The following code snippet inspects a spreadsheet, creates sanitize options based on the inspection results, and then sanitizes the spreadsheet:

    using DevExpress.Spreadsheet;
    
    using (Workbook workbook = new Workbook())
    {
        workbook.LoadDocument("Documents\\Sample.xlsx");
    
        WorkbookInspectResult inspectResult = workbook.Inspect(new WorkbookInspectOptions());
        WorkbookSanitizeOptions sanitizeOptions = inspectResult.CreateSanitizeOptions();
    
        var results = workbook.Sanitize(sanitizeOptions);
    
        foreach (var result in results)
        {
            Console.WriteLine($"Content type: {result.Type}, Action taken: {result.Action}");
        }
    }
    
    See Also