slreq.callback.MSExcelImportOptions Class
Namespace: slreq.callback
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
Worksheet
— Worksheet name
string scalar | character vector
Name of Microsoft Excel worksheet, specified as a string scalar or a character vector.
Attributes:
GetAccess | public |
SetAccess | public |
SubDocPrefix
— Option to prepend sheet name in custom ID
0
(default) | 1
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 |
Rows
— Range of rows
double
array
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 |
Columns
— Range of columns
double
array
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 |
Attributes
— External attributes to import
cell array
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 |
DescriptionColumn
— Column to map to the Description
property
double
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 |
AttributeColumn
— Columns to map to custom attributes
double
array
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 |
USDM
— USDM format
string scalar | character vector
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 |
Bookmarks
— Option to import requirements using bookmarks
0
(default) | 1
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 |
Match
— Regular expression pattern
string scalar | character vector
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 |
AsReference
— Option to import as references
1
(default) | 0
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 |
RichText
— Option to import with rich text
0
(default) | 1
Option to import requirements with rich text, specified as a 1
or
0
of data type logical
.
Attributes:
GetAccess | public |
SetAccess | public |
DocUri
— Resource identifier for requirements document
string scalar | character vector
Resource identifier for external requirements document, specified as a string scalar or character vector.
Attributes:
GetAccess | public |
SetAccess | public |
DocType
— Requirements document custom link type
string scalar | character vector
Requirements document custom link type, returned as a string scalar or character vector.
Attributes:
GetAccess | public |
SetAccess | private |
ReqSet
— Requirement set name
character vector
Requirement set name, returned as a character vector.
Attributes:
GetAccess | public |
SetAccess | private |
PreImportFcn
— Contents of PreImportFcn
callback
string scalar | character vector
Contents of the PreImportFcn
callback for the current Import node, specified as a string scalar or a character vector.
Attributes:
GetAccess | public |
SetAccess | public |
PostImportFcn
— Contents of PostImportFcn
callback
string scalar | character vector
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
Customize Excel Import Options
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)