# Window Element

Represents an open window in a Microsoft Office Visio instance. This element contains information necessary to exactly re-create a user interface window in the application workspace when the DatadiagramML file is initially opened by Visio.

## Syntax

    <Window
        ID
        WindowType
        [WindowState]
        [Document]
        [WindowLeft]
        [WindowTop]
        [WindowWidth]
        [WindowHeight]
        [Master]
        [ContainerType]
        [Container]
        [Sheet]
        [ReadOnly]
        [ParentWindow]
        [Page]
        [ViewScale]
        [ViewCenterX]
        [ViewCenterY]>
    </Window>

## Attributes

ID

Required int. The unique ID of the element within its parent element.

WindowType

Required enumeration. An enumerated value that may be one of the following: Drawing, Sheet, Stencil, or Icon.

A Window element of WindowType='Stencil' must appear after its parent drawing window (WindowType='Drawing') and before any other drawing window elements.

WindowState

Optional int. An integer specifying bit flags. This attribute can be a sum of the following values.

Value | Description
--- | ---
268435456 | Restored.
1073741824 | Maximized.
536870912 | Minimized.
1 | Docked left.
2 | Docked top.
4 | Docked right.
8 | Docked bottom.
16 | Floating.
32 | Anchor left.
64 | Anchor top.
128 | Anchor right.
256 | Anchor bottom.
1024 | Anchor merged.
67108864 | Active.

Document

Optional string. File path of the document displayed in this window. This attribute is relevant for windows whose WindowType is specified as Stencil.

WindowLeft

Optional int. Left coordinate of the window rectangle.

WindowTop

Optional int. Top coordinate of the window rectangle.

WindowWidth

Optional int. Width of the window rectangle.

WindowHeight

Optional int. Height of the window rectangle.

Master

Optional int. Master ID if this window is displaying a master.

ContainerType

Optional enumeration. May be one of the following values: Document, Page, or Master. Only relevant when WindowType is specified as Drawing or Sheet.

Container

Optional int. ID of container: Page, Sheet, or Master. Only relevant and necessary if ContainerType is specified.

Sheet

Optional int. ID of sheet in container. Relevant only when Container is specified as Sheet.

ReadOnly

Optional boolean. Read-only flag if this stencil is not a document stencil.

ParentWindow

Optional int. ID of window in which this stencil window is contained. Relevant only when WindowType is specified as Stencil.

Page

Optional int. Page ID if this window is displaying a page. Relevant only when WindowType is specified as Drawing and ContainerType is specified as Page.

ViewScale

Optional float.

ViewCenterX

Optional float.

ViewCenterY

Optional float.

## Element properties

Property | Value
--- | ---
Name | Window
Minimum Occurrences | 0
Maximum Occurrences | Unbounded

## Element information

Parent elements

Windows

Child elements

StencilGroup

StencilGroupPos

ShowRulers

ShowGrid

ShowPageBreaks

ShowGuides

ShowConnectionPoints

GlueSettings

SnapSettings

SnapExtensions

SnapAngles

DynamicGridEnabled

TabSplitterPos

## Remarks

The Window element is only relevant for windows that relate to the drawing. This element is used to preserve exact window settings when roundtripping DatadiagramML files. If this element is not specified, Visio applies default window settings when opening a DatadiagramML file.

## Example

The following example is from a document containing three window elements: the drawing page and two stencils.

The example has been excerpted for clarity.

    <Windows ClientWidth="1024" ClientHeight="625">
      <Window ID="0" WindowType="Drawing" WindowState="1073741824" WindowLeft="-4" WindowTop="-23" WindowWidth="1032" WindowHeight="652" ContainerType="Page" Page="2" ViewScale="1" ViewCenterX="4.25" ViewCenterY="8.390625">
       …
      </Window>
      <Window ID="1" WindowType="Stencil" WindowState="67109889" WindowLeft="-195" WindowTop="-1" WindowWidth="187" WindowHeight="623" Document="C:\Program Files\Microsoft Office\Visio11\\BASKGR_U.vss" ParentWindow="0">
       …
      </Window>
      <Window ID="2" WindowType="Stencil" WindowState="1025" WindowLeft="-195" WindowTop="-1" WindowWidth="187" WindowHeight="623" Document="C:\Program Files\Microsoft Office\Visio11\\BORDER_U.vss" ParentWindow="0">
       …
      </Window>
    </Windows>

## See also

Window object

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp