question

ConnorShore-6101 avatar image
1 Vote"
ConnorShore-6101 asked ConnorShore-6101 commented

Why are styles for the table first row being applied to additional rows?

I have 2 documents a template and then a document where data has been applied and generated. The issue is that there is a table with the the firstRow style having bold in it and then all additional rows are not bolded. This is correct in the template. However, when output is ran the style.xml still has only the firstRow having the bold property, but the document does not reflect that accurately, the entire table is bold.

Here is a picture of the template:
107648-image.png


Here is a picture of the output:
107715-image.png

The style element for the table is as follows (it is the same in the output and the template):

     <w:style w:type="table" w:customStyle="1" w:styleId="OWTable">
         <w:name w:val="OW Table"/>
         <w:basedOn w:val="TableNormal"/>
         <w:rsid w:val="006D7790"/>
         <w:pPr>
             <w:spacing w:before="40" w:after="40" w:line="240" w:lineRule="auto"/>
         </w:pPr>
         <w:rPr>
             <w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:cstheme="minorHAnsi"/>
             <w:color w:val="000000" w:themeColor="text1"/>
             <w:sz w:val="20"/>
             <w:szCs w:val="24"/>
             <w:lang w:val="en-US"/>
         </w:rPr>
         <w:tblPr>
             <w:tblBorders>
                 <w:bottom w:val="single" w:sz="6" w:space="0" w:color="FFC000" w:themeColor="accent4"/>
                 <w:insideH w:val="single" w:sz="6" w:space="0" w:color="FFC000" w:themeColor="accent4"/>
             </w:tblBorders>
         </w:tblPr>
         <w:trPr>
             <w:tblHeader/>
         </w:trPr>
         <w:tblStylePr w:type="firstRow">
             <w:pPr>
                 <w:spacing w:before="40" w:after="40" w:line="240" w:lineRule="auto"/>
             </w:pPr>
             <w:rPr>
                 <w:rFonts w:asciiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:hAnsiTheme="majorHAnsi"/>
                 <w:b/>
                 <w:i w:val="0"/>
                 <w:sz w:val="20"/>
             </w:rPr>
             <w:tblPr/>
             <w:tcPr>
                 <w:vAlign w:val="bottom"/>
             </w:tcPr>
         </w:tblStylePr>
     </w:style>

If I comment out the <w:b/> line and save it, the output no longer is bolded on the 2nd row or the 1st row:

107610-image.png

Here is a link to the template and output documents to view inner xml's if needed: DOCUMENTS


openspecs-office
image.png (9.9 KiB)
image.png (62.8 KiB)
image.png (58.8 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ConnorShore-6101 ,

Thank you for your question. One of our engineers will respond soon to assist.

Mike Bowen
Microsoft Open Specifications

0 Votes 0 ·

Hi @ConnorShore-6101 ,

Thanks for the file downloads I've downloaded them and I'm inspecting them now. I'll let you know what I find.

Best,

Mike Bowen
Microsoft Open Specifications

0 Votes 0 ·

1 Answer

MikeBowen-1599 avatar image
0 Votes"
MikeBowen-1599 answered ConnorShore-6101 commented

Hi @ConnorShore-6101 ,

In the styles.xml part from output.docx there is a <w:trPr... element with a <w:tblHeader/> child element. This element should be in the header rows in the document.xml part. Adding it in the styles.xml applies the table header style to all rows, in this case bolding them.

From ISO/IEC 29500-1:2016(E) 17.4.49 tblHeader (Repeat Table Row on Every New Page) :

"This element specifies that the current table row shall be repeated at the top of each new page on which part of this table is displayed. This gives this table row the behavior of a 'header' row on each of these pages. This element can be applied to any number of rows at the top of the table structure in order to generate multi-row table headers."

If you remove the <w:tblHeader/> element from the styles.xml part then only the first row will bold. If an <w:tblHeader/> element is then added as a child element of the <w:trPr... element for the first row (i.e. the header row) in the document.xml part then that row will repeat as a header row that matches the style and content of the header row on subsequent pages.

Please let me know if that answers your question.

-Mike

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@MikeBowen-1599 Thanks changing that gave the desired output. I appreciate the help!

Connor

0 Votes 0 ·