When you export shape properties, you can choose the custom properties and ShapeSheet cells to export either from selected shapes or all the shapes on a drawing page. The Export To Database command on the Tools menu works with the ODBC Data Source Administrator, which is part of the operating system, to connect you to a data source or create a new one. After you have established an ODBC connection, you can export shape properties to an existing database table or to a new table in an existing database, as Figure 24-3 shows.
By default, Visio exports all the custom properties and ShapeSheet cells for each shape. At a minimum, Visio exports approximately 30 built-in size, position, and formatting properties. If you want to export only a subset of these properties, you can remove properties from the list in the Export To Database dialog box. Removing properties from the list doesn't delete them from the shape.
Figure 24-3. When you export shape properties, Visio creates a new table in an existing database or a NewTable worksheet in an existing Excel file, as shown here.
Follow these steps to export shape properties:
If you select Excel Files, the Select Workbook dialog box appears. Locate the file (.xls) that you want to use, and then click OK.
For details about creating a data source, see "Connecting to an ODBC Data Source."
The Add button is not available in the Export To Database dialog box.
By default, Visio lists all the exportable shape properties in the Cells To Export table of the Export To Database dialog box. The Add button appears dimmed because there are no other properties you can export—they're all listed. However, if you delete properties from the list, you can click Add to add them back. In the Add dialog box, the Name list under Cell Details lists the available shape properties. The options under Field Details indicate how to map the property to the data source. For details about these options, see the next section.
When you export shape properties, you can specify a field in an existing database table into which Visio writes property values. You can also change how Visio maps data when it exports shape properties and specify a data type to use. In the Export To Database dialog box, you can click the Modify button to display options for changing exported properties and specifying database fields, as Figure 24-4 shows. The next sections describe how to use the options in the Modify dialog box.
Figure 24-4. When you export shape properties, you can change how Visio maps property names and values to database fields.
The way that Visio exports a shape property reflects the way that data is stored in the ShapeSheet. In the Modify dialog box, you can specify how you want a value to be exported in the Evaluate As list, which provides a long list of options that boil down to three choices:
When you export shape properties to an existing database table, you can map the property values to existing fields. In the Modify dialog box, under Field Details, you can type the name of a field in the Name box, and then specify the field's data type by selecting an option in the Type list. Visio writes the value of the shape property you select in the Export To Database dialog box to the field you specify in the Modify dialog box.
If the existing field is of variable length, type the size in bytes in the Length box. If the selected type supports decimal numbers, you can specify the precision by typing a number to indicate the number of decimal places in the Decimal box.
When you specify an Excel file as the data source, Visio can create a new "table" with the Table option in the Export To Database dialog box. Visio uses this option to add a new worksheet to an Excel file (if you're connecting to Excel 5 or later). Visio marks the records as a named range. If you want to export shape properties to an existing worksheet in an Excel file, ODBC requires that you create a named range in the Excel file that includes all of the rows and columns in the worksheet. Visio can then use the text in the first row of the named range as the table's column names.