« OOXML has poor XML Element names | Main | ODF Alliance Newsletter 19 January 2007 »

Monday, 22 January 2007

Use of Percentage as a measurement unit in MSOOXML is inconsistent

Percentages are defined and used inconsistently throughout the MSOOXML specification. This will cause significant confusion and does not leverage on the widely known and accepted HTML type definition.

Defined as a decimal number

The most logical use of a percentage unit is defined in Section 2.15.1.95 page 2053, "zoom" has a "percent" attribute, defined as a "ST_DecimalNumber" which has the usage:

<w:zoom w:percent="71" />

However we can easily improve this to remove ambiguities and promote better readability.

<w:zoom w:factor="71%" />

Unfortunately this “correct” usage of percentage is used only once in the entire 6039 page specification, and the others are far more confusing, as described below.

Defined inconsistently as a enumerated type

There is a strange definition of shadings in section 2.18.85 page 2583, "ST_Shd" (Shading Patterns). This section has an example where a horizontal or diagonal or vertical shading pattern has a 10% coverage is defined as:

<w:shd w:val="pct10" .../>

This is predefined and not adjustable as the shading density is fixed as an enumerated type.

pct5, pct10, pct12, pct15, pct20, pct25, pct30, pct35, pct37 (actually 37.5% coverage), pct40, pct45, pct50, pct55, pct60, pct62 (actually 62.5%), pct65, pct70, pct75, pct80, pct85, pct87 (actually 87.5%) pct90, pct95

In todays modern computer, where the optimum density and patterns can be created on-the-fly, a better and more generalised design of the specification could be

<w:shd w:type="diagonalPattern" w:coverage="63.5%" />

Defined as an abitrary unit

Here is where things get weird. Section 2.18.97 page 2608, "ST_TblWidth" (Table Width Units) define "pct" as fiftieths of a percent, e.g. 4975 = 99.5%.

This is extremely cryptic and not consistent with the rest of the specifications. For example, if we wanted to define the bottom width of a table as a percentage, the current Ecma 376 specifications demand that we use this:

<w:bottom w:w="525" w:type="pct" />

When a more logical and readable specification should read:

<w:bottom w:width="10.5%">

Defined as a thousandth of a percent.

As if modern computers now do not have Floating Point processors, section 5.1.12.41 page 4505, "ST_Percentage" specifies that we denote 1 unit as a 1000ths of a percent. e.g., a value of 54678 represents 54.678%. This is used almost all the other percentage data types in PresentationML and VML. For example in page 4207

<a:p> 
   <a:rPr baseline="30230"/> 
   <a:t>Some Text</a:t> 
</a:p>

A more intuitive usage would be:

<a:p> 
   <a:rPr baselineWidth="30.23%"/>
   <a:t>Some Text</a:t> 
</a:p>

It becomes quite evident that the usage of Percentage units within MSOOXML  is inconsistent, immature, hard to read and contradictory within itself and with well established W3C HTML4 standards.



yk

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d8341c01ba53ef00d83572afb869e2

Listed below are links to weblogs that reference Use of Percentage as a measurement unit in MSOOXML is inconsistent :

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Welcome to
Open Malaysia blog!

  • Bloggers @ Open Malaysia
    We are a group of individual bloggers working to build openness in Malaysia's ICT culture. Most of us have day jobs and a couple of us are students. Those with a job work for companies ranging from large international enterprises to self-run Malaysian start-ups.
    Email us at this address:
    open -AT- openmalaysiablog -DOT- com

Disclaimer...

  • We declare our independence of opinions from our employers, institutions, associations and clients, past and present. Thoughts and expressions in the Open Malaysia blog are rightly each blogger's own and each of us stand by what we individually write. Views by readers who post comments and others whose writings we link to in this blog are theirs.

May 2009

Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            

Subscribe to this site
- FeedBurner Feed

Subscribe to this site
- email alert options

Your email address:


Powered by FeedBlitz

Enter your email address:

Delivered by FeedBurner

Blog powered by TypePad

.

  • .