Main Content

slreq.callback.MSExcelImportOptions Class

Namespace: slreq.callback

Microsoft Excel import options

Since R2022a

Description

Use objects of the slreq.callback.MSExcelImportOptions class to adjust the options to use when import requirements. When you import requirements from a Microsoft® Excel® file, slreq.getCurrentImportOptions generates an slreq.callback.MSExcelImportOptions 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.MSExcelImportOptions class is a handle class.

Creation

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

Properties

expand all

Name of Microsoft Excel worksheet, specified as a string scalar or a character vector.

Attributes:

GetAccess
public
SetAccess
public

Option to prepend the sheet name in the CustomId property of the imported requirements, specified as a 1 or 0 of data type logical.

Tip

If requirements from multiple sheets import with the same custom ID, set this property to 1 to generate unique custom IDs.

Attributes:

GetAccess
public
SetAccess
public

Range of rows to import from the Microsoft Excel spreadsheet, specified as a double array.

Example: myImportOptions.Rows = [3 35];

Attributes:

GetAccess
public
SetAccess
public

Range of columns to import from the Microsoft Excel spreadsheet, specified as a double array.

Example: myImportOptions.Columns = [1 6];

Attributes:

GetAccess
public
SetAccess
public

External attributes to import as custom attributes, specified as a cell array.

The length of this cell array must match the number of columns specified by the AttributeColumn property.

Example: myImportOptions.Attributes = {'Test Status','Test Procedure'};

Attributes:

GetAccess
public
SetAccess
public

Column in the Microsoft Excel spreadsheet to map to the Id property of the requirements in your requirement set, specified as a double.

Example: myImportOptions.IdColumn = 1;

Attributes:

GetAccess
public
SetAccess
public

Column in the Microsoft Excel spreadsheet to map to the Summary property of the requirements in your requirement set, specified as a double.

Example: myImportOptions.SummaryColumn = 2;

Attributes:

GetAccess
public
SetAccess
public

Column in the Microsoft Excel spreadsheet to map to the Description property of the requirements in your requirement set, specified as a double.

Example: myImportOptions.DescriptionColumn = 3;

Attributes:

GetAccess
public
SetAccess
public

Column in the Microsoft Excel spreadsheet to map to the Rationale property of the requirements in your requirement set, specified as a double.

Example: myImportOptions.RationaleColumn = 4;

Attributes:

GetAccess
public
SetAccess
public

Column in the Microsoft Excel spreadsheet to map to the Keywords property of the requirements in your requirement set, specified as a double.

Example: myImportOptions.KeywordsColumn = 5;

Attributes:

GetAccess
public
SetAccess
public

Columns in the Microsoft Excel spreadsheet to map as custom attributes of the requirements in your requirement set, specified as a double array.

Example: myImportOptions.AttributeColumn = [4 6];

Attributes:

GetAccess
public
SetAccess
public

Import from Microsoft Excel spreadsheets specified in the Universal Specification Describing Manner (USDM) standard format. Specify values as string scalars or character vectors with the ID prefix optionally followed by a separator character.

Example: myImportOptions.USDM = "RQ -" will match entries with IDs similar to RQ01, RQ01-2, RQ01-2-1 etc.

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® Excel® import options by using the PreImportFcn callback.

Use slreq.import to import the Excel file ExampleRequirements.xlsx into Requirements Toolbox™. Name the imported requirement set myReqSet and register the script excelPreImport as the PreImportFcn callback. Return a handle to the requirement set.

[~,~,rs] = slreq.import("ExampleRequirements.xlsx", ...
    ReqSet="myReqSet",preImportFcn="excelPreImport");

The script excelPreImport uses slreq.getCurrentImportOptions to get the import options, then maps columns 2, 4, and 5 to the built-in slreq.Reference properties ID, Summary, and Description. The script also maps columns 3, 6, and 7 to custom attributes orig_Type, Remark, and Status.

type excelPreImport.m
importOptions = slreq.getCurrentImportOptions;
importOptions.Columns = 1:7;
importOptions.IdColumn = 2;
importOptions.SummaryColumn = 4;
importOptions.DescriptionColumn = 5;
importOptions.Attributes = {'orig_type','Remark','Status'};
importOptions.AttributeColumn = [3 6 7];

Return the importOptions object.

importOptions
importOptions = 
  MSExcelImportOptions with properties:

            Worksheet: []
         SubDocPrefix: 0
                 Rows: []
              Columns: [1 2 3 4 5 6 7]
           Attributes: {'orig_type'  'Remark'  'Status'}
             IdColumn: 2
        SummaryColumn: 4
    DescriptionColumn: 5
      RationaleColumn: []
       KeywordsColumn: []
      AttributeColumn: [3 6 7]
      CreatedByColumn: []
     ModifiedByColumn: []
                 USDM: ''
            Bookmarks: 0
                Match: []
          AsReference: 1
             RichText: 0
               DocUri: 'C:\Users\jdoe\MATLAB\Examples\CustomizeExcelImportOptionsExample\ExampleRequirements.xlsx'
              DocType: 'linktype_rmi_excel'
               ReqSet: 'myReqSet'

  Show all accessible properties of MSExcelImportOptions

Version History

Introduced in R2022a