Main Content

createReferences

Class: slreq.ReqSet
Package: slreq

Create read-only references to requirement items in third-party documents

Syntax

createReferences(rs, pathToFile, Name, Value)
createReferences(rs, reqFormat, Name, Value)

Description

createReferences(rs, pathToFile, Name, Value) creates read-only references to requirements content in an external document at pathToFile by using additional Name, Value arguments to specify import options.

createReferences(rs, reqFormat, Name, Value) creates read-only references to requirements content in an external document corresponding to the specified registered document type specified by reqFormat by using additional Name, Value arguments to specify import options.

Input Arguments

expand all

Requirements set file, specified as a slreq.ReqSet object.

Path to the requirements document.

Example: 'C:\MATLAB\System_Requirements.docx'

Custom registered document type label that you create by using a Custom Document Type extension API.

Example: 'linktype_rmi_doors'

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'columns', '[1 8]', 'RichText', true

The name of the existing requirements set that you import references to requirements into, specified as the comma-separated pair of 'ReqSet' and a valid requirements set file name.

Example: 'ReqSet', 'My_Requirements_Set'

Option to import requirements content as rich text, specified as the comma-separated pair consisting of 'RichText' and true or false.

Example: 'RichText', true

Option to use custom bookmarks in Microsoft Word documents and Microsoft Excel spreadsheets to import requirements content, specified as the comma-separated pair consisting of 'bookmarks' and true or false.

Example: 'bookmarks', false

Import requirements by using regular expression pattern matching, specified as the comma-separated pair consisting of 'match' and a regular expression pattern.

Example: 'match', '^REQ\d+'

Range of columns to import. This option is applicable only for Microsoft Excel spreadsheets.

Example: 'columns', [1 6]

Range of rows to import. This option is applicable only for Microsoft Excel spreadsheets.

Example: 'rows', [3 35]

Attribute names to import, specified as a cell array.

Note

When importing requirements from a Microsoft Excel spreadsheet, the length of this cell array must match the number of columns that you specified for import by using the 'columns' option.

Example: 'attributes', {'Test Status', 'Test Procedure'}

Column in the Microsoft Excel spreadsheet that you want to correspond to the ID field in the requirements set.

Example: 'idColumn', 1

Column in the Microsoft Excel spreadsheet that you want to correspond to the Summary field in the requirements set.

Example: 'summaryColumn', 4

Column in the Microsoft Excel spreadsheet that you want to correspond to the Keywords field in the requirements set.

Example: 'keywordsColumn', 3

Column in the Microsoft Excel spreadsheet that you want to correspond to the Description field in the requirements set.

Example: 'descriptionColumn', 2

Column in the Microsoft Excel spreadsheet that you want to correspond to the Rationale field in the requirements set.

Example: 'rationaleColumn', 5

Examples

Create Read-Only References to Requirements in Microsoft Office Documents

% Create a new requirements set and save it

rs = slreq.new('newReqSet');
save(rs);

% Create read-only rich text references to requirements 
% in a Word document
createReferences(rs, 'C:\Work\Requirements_Spec.docx', ...
'RichText', true);

% Create read-only plain text references to requirements 
% in an Excel spreadsheet
createReferences(rs, 'C:\Work\Design_Spec.xlsx', ...
'columns', [2 6], 'rows', [3 32], 'idColumn', 2, ...
'summaryColumn', 3);

Introduced in R2018a