Main Content

slreq.callback.MSWordImportOptions Class

Namespace: slreq.callback

Microsoft Word import options

Since R2022a

Description

Use objects of the slreq.callback.MSWordImportOptions class to adjust the options to use when import requirements. When you import requirements from a Microsoft® Word file, slreq.getCurrentImportOptions generates an slreq.callback.MSWordImportOptions object that you can use to adjust the options to use when you import requirements. You can only access this object in the PreImportFcn callback.

The slreq.callback.MSWordImportOptions class is a handle class.

Creation

options = slreq.getCurrentImportOptions returns an slreq.callback.MSWordImportOptions object if you are importing requirements from a Microsoft Word file.

Properties

expand all

Option to ignore outline numbers in section headers, specified as a 1 or 0 of data type logical.

Attributes:

GetAccess
public
SetAccess
public

Option to import requirements content using user-defined bookmarks, specified as a 1 or 0 of data type logical.

By default, Requirements Toolbox™ sets the value to 1 for Microsoft Word documents and 0 for Microsoft Excel® spreadsheets.

Attributes:

GetAccess
public
SetAccess
public

Regular expression pattern, specified as a string scalar or character vector. Use this expression to search for matches in Microsoft Office documents.

Attributes:

GetAccess
public
SetAccess
public

Option to import as slreq.Reference objects, specified as a 1 or 0 of data type logical. If 0, requirements import as slreq.Requirement objects.

Attributes:

GetAccess
public
SetAccess
public

Option to import requirements with rich text, specified as a 1 or 0 of data type logical.

Attributes:

GetAccess
public
SetAccess
public

Resource identifier for external requirements document, specified as a string scalar or character vector.

Attributes:

GetAccess
public
SetAccess
public

Requirements document custom link type, returned as a string scalar or character vector.

Attributes:

GetAccess
public
SetAccess
private

Requirement set name, returned as a character vector.

Attributes:

GetAccess
public
SetAccess
private

Contents of the PreImportFcn callback for the current Import node, specified as a string scalar or a character vector.

Attributes:

GetAccess
public
SetAccess
public

Contents of the PostImportFcn callback for the current Import node, specified as a string scalar or a character vector.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This example shows how to customize Microsoft® Word import options by using the PreImportFcn callback.

Use slreq.import to import the Word document Reject_Double_Button_Press_Model_Requirements.docx into Requirements Toolbox™. Name the imported requirement set myReqSet and register the script wordPreImport as the PreImportFcn callback to use during import. Return a handle to the requirement set.

[~,~,rs] = slreq.import("Reject_Double_Button_Press_Model_Requirements.docx", ...
    ReqSet="myReqSet",preImportFcn="wordPreImport");

The script wordPreImport uses slreq.getCurrentImportOptions to get the import options, then sets the Bookmark property to 1 to use bookmarks to identify items and serve as custom IDs.

type wordPreImport.m
importOptions = slreq.getCurrentImportOptions;
importOptions.Bookmarks = 1;

Return the importOptions object.

importOptions
importOptions = 
  MSWordImportOptions with properties:

    IgnoreOutlineNumbers: 0
               Bookmarks: 1
                   Match: []
             AsReference: 1
                RichText: 1
                  DocUri: 'C:\Users\jdoe\MATLAB\Examples\slrequirements-ex48179482\Reject_Double_Button_Press_Model_Requirements.docx'
                 DocType: 'linktype_rmi_word'
                  ReqSet: 'myReqSet'
            PreImportFcn: 'wordPreImport'
           PostImportFcn: ''

Version History

Introduced in R2022a