AddSection method

Microsoft Visio Developer Reference

AddSection method

       

Adds a new section to a ShapeSheet spreadsheet.

Version added

2.0

Syntax

intRet = object.AddSection (section)

intRet

Integer. The index of the section that was added.

object

Required. An expression that returns a Shape object.

section

Required Integer. The type of section to add.

Remarks

The AddSection method is frequently used to add one or more Geometry sections to a shape. You can also use AddSection to add other sections to a shape such as Scratch, Controls, Connection Points, Actions, User-Defined Cells and Custom Properties. The AddSection method returns the logical index of the added section.

The sections that you can add to a shape correspond to the choices shown by the Insert Section dialog box when the shape is displayed in a ShapeSheet window.

If you try to add a non-Geometry section to a shape that already has that section, the AddSection method raises an exception. Use the SectionExists property to determine if a shape already has a section with a given logical index.

A new section has no rows. Use the AddRow method to add rows to the new section.

The GeometryCount property returns the number of Geometry sections included in a shape. Use the following code to add a Geometry section to a shape:

Shape.AddSection(visSectionFirstComponent+i)

where 0 <= i < visSectionLastComponent - visSectionFirstComponent. The new section precedes the present i'th Geometry section for 0 <= i < Shape.GeometryCount. It is the last section for Shape.GeometryCount <= i < visSectionLastComponent - visSectionFirstComponent.

The Visio type library declares the constants for sections in VisSectionIndices.

Click to show or hide information.Valid section constants

Constant

Value

Description

visSectionFirst

0

Index whose value is less than any other section index.

visSectionObject

1

Stores general non-repeating properties of an object.

visSectionCharacter

3

Stores character properties, for example, font.

visSectionParagraph

4

Stores paragraph properties, for example, indentation.

visSectionTab

5

Stores position and alignment of tab stops.

visSectionScratch

6

Holds scratch cells.

visSectionConnectionPts

7

Stores an object's connection points.

visSectionTextField

8

Stores an object's text fields.

visSectionControls

9

Stores an object's control handles.

visSectionFirstComponent

10

An object's first Geometry section. Additional sections have indices visSectionComponentFirst + i.

visSectionLastComponent

239

An object's last Geometry section.

visSectionAction

240

Stores the actions that appear on the shortcut menu.

visSectionLayer

241

Stores a page or master's layer properties.

visSectionUser

242

Stores cells created and used by an external solution.

visSectionProp

243

Stores custom properties.

visSectionHyperlink

244

Stores hyperlinks.

visSectionLast

252

Index whose value is greater than any other section index.

visSectionNone

255

Unspecified section.