Taslim A. Khan
Taslim A. Khan

Reputation: 526

What is the unit of measurement of Shapes.AddShape method in Microsoft Office Interop Word?

I am trying to create shapes using

Microsoft.Office.Interop.Word.Shape

For example,

Microsoft.Office.Interop.Word.Shape rect = document.Shapes.AddShape((int)Microsoft.Office.Core.MsoAutoShapeType.msoShapeRectangle,
    10, 10, 15, 15);

The second and third parameters say that my rectangle's top-left point is 10 points away from the top-left corner of the page. The fourth and fifth parameters specify 15 units of width and height to the rectangle.

I am precisely interested in knowing the unit of measurement used in each of the parameters mentioned above. This link from msdn did not help much as it says this measurement is in points. It would have been helpful if I got some clue in centi-meters or inches as I am printing these shapes in a MS Word document and shapes should scale to requirements in any of the units.

Any idea what these units are or how to convert points to any defined units (cm. or in.)? TIA

Upvotes: 0

Views: 1657

Answers (1)

Eugene Astafiev
Eugene Astafiev

Reputation: 49395

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

The Application class from the Word object model provides the following methods for converting one to another:

You can read about points in Wikipedia.

Upvotes: 1

Related Questions