Main Content

Import Requirements from Microsoft Office Documents

You can author requirements in Microsoft® Word and Microsoft Excel® and import them into Requirements Toolbox™. When you import the requirements, you can allow updates from the Microsoft Office documents, or you can import them without allowing updates. To read more about these import modes, see Select an Import Mode.

Note

  • You can only import requirements from Microsoft Office on Microsoft Windows® platforms.

  • MATLAB® Online™ does not support importing requirements from Microsoft Office documents.

To import requirements from a Microsoft Office document:

  1. Open the Requirements Editor. At the MATLAB command line, enter:

    slreq.editor

  2. Click Import.

  3. Set the Document type to Microsoft Word Document or Microsoft Excel Spreadsheet.

  4. Next to the Document Location field, click Browse and select the desired file.

  5. Set the import options. To read more about import options for Microsoft Office documents, see Import Options for Microsoft Word Documents and Import Options for Microsoft Excel Spreadsheets. To read more about importing requirement sets or referenced requirements, see Select an Import Mode.

  6. Click Import to import the requirements.

Import Options for Microsoft Word Documents

You can import requirements in plain and rich text formats from Microsoft Word documents. Use the rich text format to import requirements that contain content such as graphics and tables.

When you import requirements from Microsoft Word documents, the section headers and numbers populate the ID and Summary fields and the section body populates the Description field. To ignore section numbers in the imported requirements, select Ignore outline numbers in section headers. If you select Allow updates from external source, it is recommended to ignore outline numbers to prevent unexpected behavior that can occur if the section numbers change when you make changes to your Microsoft Word document and then update the imported requirements. For example, when you insert a new section in the middle of your document, some of the outline numbers in the section headers change to reflect the new section numbering. When you update the requirement set, Requirements Toolbox deletes the referenced requirements that correspond to sections whose outline numbers changed and re-inserts them with the updated numbering. This can create some unexpected change issues.

The Importing Requirements dialog has Document type set to Microsoft Word Document. Under Content, Plain text is selected, and under Requirement Identification, Use bookmarks to identify items and serve as custom IDs is selected.

The imported requirements hierarchy matches the Microsoft Word document headings hierarchy.

When you import requirements, it is recommended to select Use bookmarks to identify items and serve as custom IDs because the bookmarks are persistently stored in the document and cannot be duplicated.

You can import requirements selectively when you select Identify items by occurrences of search pattern (REGEXP) and enter a regular expression search pattern. To read more about regular expressions, see Regular Expressions.

Note

If you do not have images in your requirements document, consider importing your requirements as plain text to prevent some issues related to font, style, or whitespace differences.

Import Options for Microsoft Excel Spreadsheets

You can import requirements in plain and rich text formats from Microsoft Excel spreadsheets. The plain text format imports only text and associates each column of your spreadsheet to a requirement property. The rich text format imports graphics, layouts, and captures multicell ranges.

Note

If your Excel spreadsheet contains cells that are grouped and the group is collapsed, any requirements in cells that are not visible are not imported.

When you import requirements from Microsoft Excel files, you can identify requirements by specifying rows and columns, or you use a regular expression search pattern. You can also append the custom ID of each imported requirement with the sheet name by selecting Use worksheet name as item ID prefix.

The Importing Requirements dialog has Microsoft Excel Spreadsheet selected. Under content, Text only (better graphics) is selected. Under Requirement Identification, Specify rows and columns is selected.

Identify Requirements by Specifying Rows and Columns

To identify requirements by specifying rows and columns, in the Importing Requirements dialog, under Requirement Identification, select Specify rows and columns.

Importing requirements with this method allows you to map columns to requirements properties and custom attributes when you click Configure columns. Under each column, you can select an item from the list. You must select a column to map to either Summary or Description. If you select <Custom Attribute>, a custom attribute is registered for the requirement set with the custom attribute name specified by the column name. To read more about custom attributes for requirements, see Add Custom Attributes to Requirements.

Each column is imported as a separate specified property or custom attribute, with the exception of the Description and Rationale properties, which can combine multiple adjacent columns. When you select multiple columns for Description and Rationale, the value from each cell is concatenated into one field.

The Configure columns dialog shows rows 2 through 17 with columns for Requirements, Test Scenario, and Test Description. The Use As row shows how each column maps to properties and custom attributes in Requirements Toolbox.

If you cannot map one of the columns in the spreadsheet to a column that holds unique requirement custom IDs, the import operation automatically generates unique custom IDs based on the rows in the spreadsheet. These custom IDs might not be persistent.

You can exclude contents by ignoring columns and selecting only a range of rows to import. To ignore a column, select <Ignore> from the drop-down menu at the top of that column. To import only a range of rows, under Specify rows to import, enter the row number to start at and end at.

Note

You cannot maintain the hierarchy from your Microsoft Excel file when, under Requirement Identification, you select Specify rows and columns.

Identify Requirements by Regular Expression Search Pattern

To identify requirements by using a regular expression search pattern, in the Importing Requirements dialog, under Requirement Identification, select Use search pattern (REGEXP). To read more about regular expressions, see Regular Expressions.

The main advantage to using a regular expression search pattern is that you can retain the existing hierarchy when you import requirements from an Excel document if the matched requirement IDs are hierarchical. For example, the pattern R[\d\.]+ will match requirements with IDs R1, R1.1, R2, and so on, and R1.1 will be recognized as a child of R1. Additionally, you can selectively import requirements by importing only requirements that match the regular expression.

Maintain Hierarchy During Import

Requirements Toolbox will maintain the hierarchy for imported Excel files that meet the following conditions:

  1. The file contains at least 3 requirements.

  2. In the Unique ID field, children are separated with a single type of non-alphanumeric character. For example, R1.1.1 and R1-1-1 maintain a hierarchy when imported.

Files that do not meet these conditions may experience unexpected behavior when importing. For an example of a well formatted Excel file, see Import Requirements from a Microsoft Excel Document.

See Also

Related Examples

More About