none
tblStylePr - not all seem to apply RRS feed

Answers

  • Hi Dave, Word applies the row/column banding and first/last row/column formatting in the reverse order of what is described in ISO/IEC 29500. You are also correct about the order of the corners. This difference in behavior is described in MS-OI29500 in section 2.1.250.

     

    When specified, Office applies conditional formats in the following order (therefore subsequent formats override properties on previous formats):

    • Whole table

    • Banded rows, even row banding

    • Banded columns, even column banding

    • First column, last column

    • First row, last row

    • Top left, top right, bottom left, bottom right

     

     

    With regards to the row banding, here again, the reason that the row banding doesn't appear in the first document, but does in the second, is because Word deviates from the ISO/IEC 29500 specification with respect to the tblStyleRowBandSize element. That element is missing from the style in the table1 document. In ISO/IEC 29500-1 section 17.7.6.7 it states that "If this element is omitted, then the default number of rows in a single row band shall be assumed to be 1." However, in MS-OI29500 section 2.1.251 it states that "Word uses 0 as the default for tblStyleRowBandSize." and also "If tblStyleRowBandSize is set to 0, Word does not apply any banded row conditional formatting."

     

    When faced with problems like this, I find that using the Productivity Tool that comes with the Open XML SDK is very helpful for comparing files and finding small differences.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Monday, March 28, 2016 7:26 PM
    Moderator

All replies

  • Hello Dave:

    Thank you for contacting Microsoft Support. A support engineer will be in touch to assist further.


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Tuesday, March 22, 2016 3:27 PM
  • Hi Dave, I am the engineer who will be working with you on this issue. I am currently researching the problem and will provide you with an update soon. Thank you for your patience.

    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Tuesday, March 22, 2016 3:49 PM
    Moderator
  • Hi Dave, since I'm not sure which parts you manually edited, here is why the table cells aren't being formatted as expected and how to fix it.

     

    I think the source of the confusion is in how the cnfStyle element works. I see in the second table that each cell has the following…

     

    <w:cnfStyle w:val="111111111111"

    w:firstRow="1" w:lastRow="1"

    w:firstColumn="1" w:lastColumn="1"

    w:oddVBand="1" w:evenVBand="1"

    w:oddHBand="1" w:evenHBand="1"

    w:firstRowFirstColumn="1" w:firstRowLastColumn="1"

    w:lastRowFirstColumn="1" w:lastRowLastColumn="1"/>

     

    Without knowing the real purpose of the cnfStyle element, it's easy to assume that this tells it to apply any and all conditional formatting to the cell. However, that's not the case. Per ISO/IEC 29500-1 section 17.4.8, the cnfStyle element only acts as "an optimization which is used by consumers to determine if a given property on a table cell is the result of the table style conditional formatting properties vs. direct formatting on the table cell itself."

     

    But what really controls how the conditional formatting is applied is the tblLook element that is up near the start of the tbl block under the tblPr element.

     

    <w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>

     

    From this you can see that the firstRow, firstColumn, and noVBand attributes are set to true. This is why the only cells that has the formatting applied is the top row, left column, and the top left corner where they overlap. In order to see the bottom row, right column, and the other three corners formatted correctly you need to set the lastRow and lastColumn attributes to 1. The noHBand and noVBand attributes won't have any effect in this scenario.

     

    <w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="1" w:firstColumn="1" w:lastColumn="1" w:noHBand="0" w:noVBand="1"/>

     

    The val attribute (ISO/IEC 29500-4, section 14.3.11) is a bitmask that represents a combination of all the other attributes, and it SHOULD match. It doesn't have to, but any bit(s) from the val attribute will only be used for other  attributes not present in tblLook.

     

    Please let me know if this answers your question.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Thursday, March 24, 2016 9:59 PM
    Moderator
  • Hi Josh;

    First off apologies. I know that cnfStyle is advisory - but forgot.

    Ok, this is now making sense for the first/last row/col, including that the corners are only done if both of the appropriate first/list row/col are set to true.

    I'm still hitting one problem. table1.docx should show horizontal & vertical bands. I then editied it in Word to create table2.docx that does show horizontal bands - but I can't see any difference. 

    Why does it not band table1?

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Sunday, March 27, 2016 2:51 PM
  • One other thing. It looks like it applies each of the conditional formats in order so if odd rows are red text & bold and first row is blue text then it will end up blue (first trumps odd) bold (from odd as first does not set it).

    However, it only does one of the corner formats even if it's a 1x1 cell. Same for first/last if it's just 1 row or column. So it ends up being:

    1. wholeTable
    2. odd/evenRow
    3. odd/evenColumn
    4. left or right column (if first/last)
    5. top or bottom row (if first/last)
    6. single appropriate corner (if in a corner). In the order NW, NE, SW, SE.

    And top/bottom row override left/right column. But banded columns override banded rows.

    ??? - thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Sunday, March 27, 2016 3:07 PM
  • Hi Dave, Word applies the row/column banding and first/last row/column formatting in the reverse order of what is described in ISO/IEC 29500. You are also correct about the order of the corners. This difference in behavior is described in MS-OI29500 in section 2.1.250.

     

    When specified, Office applies conditional formats in the following order (therefore subsequent formats override properties on previous formats):

    • Whole table

    • Banded rows, even row banding

    • Banded columns, even column banding

    • First column, last column

    • First row, last row

    • Top left, top right, bottom left, bottom right

     

     

    With regards to the row banding, here again, the reason that the row banding doesn't appear in the first document, but does in the second, is because Word deviates from the ISO/IEC 29500 specification with respect to the tblStyleRowBandSize element. That element is missing from the style in the table1 document. In ISO/IEC 29500-1 section 17.7.6.7 it states that "If this element is omitted, then the default number of rows in a single row band shall be assumed to be 1." However, in MS-OI29500 section 2.1.251 it states that "Word uses 0 as the default for tblStyleRowBandSize." and also "If tblStyleRowBandSize is set to 0, Word does not apply any banded row conditional formatting."

     

    When faced with problems like this, I find that using the Productivity Tool that comes with the Open XML SDK is very helpful for comparing files and finding small differences.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Monday, March 28, 2016 7:26 PM
    Moderator
  • As always, thank you

    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Monday, March 28, 2016 8:21 PM