Share via


Units of measure

Units of measure

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

In general, the formulas of cell elements that represent some numeric value (for example, shape position, a dimension, or an angle) require a number-unit pair that consists of a number and the qualifying units needed to interpret the number. In XML for Visio, however, unit information is stored but the value of an element is always expressed in internal units.

For example, values representing units that are a measurement of length are expressed as floating point numbers in inches (internal units). If an element has a value of "2 feet", its Unit attribute is 'FT' for feet and its value is the number 24.

Other units, such as date/time, are expressed as formatted strings. In the case of date/time, it is a string like "2000-12-20T23:00:00".

If a unit of measure is explicitly set, and is different from the default unit for the cell, Microsoft Visio writes out the Unit attribute in XML for Visio files. If no Unit attribute is present in an element that represents a cell, Visio will use the default unit for that element.

For more information about how units of measure work in Visio, see About units of measure in the Microsoft Visio ShapeSheet Reference.

Values of these unit types are expressed as a floating point value in inches (internal units). Therefore, a value of "2 feet" would be expressed as:

  <Width Unit='FT'>24</Width>

A value of "12 Points" would be expressed as:

  <Size>0.16666666666667</Size>

The following tables describe valid units of measure along with information about internal units and how they are expressed in an XML for Visio file.

Note Units of measure that represent an area (acre and hectare) are expressed in square inches.

Unit

Description

AC

Acre

C

Ciceros

C_D

Ciceros/didots

CM

Centimeters

D

Didots

DL

Default length units

DP

Default page units

DT

Default type units

F_I

Feet/inches

FT

Feet

HA

Hectare

IN

Inches

IN_F

Inches Fractional

KM

Kilometers

M

Meters

MI

Miles

MI_F

Miles Fractional

MM

Millimeters

NM

Nautical Miles

P

Picas

PT

Points

P_PT

Picas/points

YD

Yards

Angle values are expressed as floating point values in radians (internal units).

Therefore, 180 DEG appears as the following:

  <Angle Unit='DEG'>3.1415926535898</Angle>

Unit

Description

AD

Degrees

AM

Minutes

AS

Seconds

DA

Default angle units

DEG

Fractional degrees

RAD

Radians

Values of this unit type are expressed as a floating point value in elapsed days (internal units). For example, the C element below contains the elapsed days between the dates stored in the A and B elements.

  <A Unit='DATE' F='Date(1969,9,12)'>1969-09-12T00:00:00</A>
<B Unit='DATE' F='Date(1969,9,13)'>1969-09-13T00:00:00</B>
<C Unit='ED' F='Scratch.A1-Scratch.B1'>-1</C>

Unit

Description

DE

Default duration units

ED

Elapsed Day

EH

Elapsed Hour

EM

Elapsed Minute

ES

Elapsed Second

EW

Elapsed Week

Values of this unit type are expressed as a string value written out in the ISO 8601 format:

yyyy-mm-ddThh:mm[:ss[.ss]]

The uppercase letter T is a required delimiter between the date portion and the time portion.

The date portion must be complete: four-digit year, a dash, two-digit month, a dash, and a two-digit day.

The time portion must include a two-digit hour, a colon, and a two-digit minute. The time can optionally include another colon and two-digit seconds. After the optional seconds, there can be a dot and followed by digits representing fractional seconds. Fractional seconds can be as precise as nanoseconds.

For example:

  <A Unit='DATE'>2000-09-12T12:34:12.0543</A>

Unit

Description

DATE

Date and time

Values of these unit types are expressed as strings. The following table provides an example of each unit type.

Unit

Description

Example

BOOL

Boolean

An integer that can be 0 or 1. For example:

<A Unit='BOOL'>1</A>

COLOR

A color value

A color value is specified by its red, green, and blue components or its index within the document color table. The value can appear as a hash (#) followed by a 6-digit hexadecimal number, or as an int value between 0 and 23.

For example, the color green would appear as follows:

<A Unit='COLOR'>>#00FF00</A>

A color at ColorEntry index 3 would appear as follows:

<A Unit='COLOR'>>3</A>

CY

Currency

####.####xxx

Where xxx is the ISO currency symbol. For example, $234.45 in US Dollars would appear as follows:

<A Unit='CY'>234.4500USD</A>

GUID

A globally unique identifier

A string that represents a globally unique identifier (GUID). For example:

<A Unit='GUID'>{4A1A0046-7A0D-4395-99CA-9939AD2D567E}</A>

MULTIDIM

Multi dimensional value

<A>### unit^pow</A>

where ### is a floating point value, unit is one of the floating point units of measure (distance, duration, or typographical) as previously described, and pow is a power. For example, 12 cubic feet would appear as:

<A Unit='MULTIDIM'>12 FT^3</A>

NUM

Number

Expressed as a floating point value.

NURBS

NURBS curve data

Expressed in the same format as a formula with a NURBS function:

NURBS(knotLast, degree, xType, yType, x1, y1, knot1, weight1, ...)

For example,

<E Unit='NURBS'>NURBS(2.3,2,0,0,0.6,-1.1,0,1)</E>

PER

Percent

Expressed as a floating point value between 0 and 1. For example, 50% would appear as

<A>0.5</A>

PNT

2-D coordinate

<A>PNT( xunit, y unit )</A>

Where x and y are floating point values and unit is one of the floating point units of measure (distance, duration, or typographical) described earlier.

For example,

<A Unit='PNT'>PNT(2,3)</A>

POLYLINE

Polyline point data

Expressed in the same format as a formula with a POLYLINE function:

POLYLINE(xType, yType, x1, y1...)

For example,

<E>POLYLINE(0,0,0,1)</E>

STR

String

<A Unit='STR'>some string</A>

where some string is a PCDATA string.