Page 1 of 1

Insert Column in a tab

PostPosted: Wed Jul 07, 2010 2:25 am
by slucky31
Hey,

Is there a way to insert a column into a table ?

Cheers,

Slucky31

Re: Insert Column in a table

PostPosted: Wed Jul 07, 2010 7:19 pm
by jason
Word doesn't allow that: columns are added via sections, and although the added sectPr lives in a paragraph, Word doesn't allow such a paragraph inside a table cell.

This is an example of a structure which would be valid according to the XSD, but which is disallowed at a "semantic" level. I'm not sure whether the specification prohibits it, or the notes on the document interop website say Microsoft's implementation doesn't support it. It would be interesting to know: if you can find any references, please report back here.

If it is allowed by the spec, maybe it could be of use in some mythical non-MS implementation ;-) But obviously you are better off exploring alternative structures, such as two table cells with an invisible border between them.

FWIW, here is an example of the structure we are discussing:
Code: Select all

         <w:tbl>
            <w:tblPr>
              <w:tblStyle w:val="TableGrid"/>
              <w:tblW w:w="0" w:type="auto"/>
              <w:tblLook w:val="04A0"/>
            </w:tblPr>
            <w:tblGrid>
              <w:gridCol w:w="4621"/>
              <w:gridCol w:w="4621"/>
            </w:tblGrid>
            <w:tr>
              <w:tc>
                <w:tcPr>
                  <w:tcW w:w="4621" w:type="dxa"/>
                </w:tcPr>
                <w:p>
                  <w:r>
                    <w:t>col1</w:t>
                  </w:r>
                </w:p>
                <w:p>
                  <w:r>
                    <w:br w:type="column"/>
                  </w:r>
                  <w:r>
                    <w:t>col2</w:t>
                  </w:r>
                </w:p>
                <w:p/>
                <w:p>
                  <w:pPr>
                    <w:sectPr>
<!--
                      <w:pgSz w:w="11906" w:h="16838"/>
                      <w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="708" w:footer="708" w:gutter="0"/> -->
                      <w:cols w:num="2" w:space="708"/>
                      <w:docGrid w:linePitch="360"/>
                    </w:sectPr>
                  </w:pPr>
                </w:p>
              </w:tc>
              <w:tc>
                <w:tcPr>
                  <w:tcW w:w="4621" w:type="dxa"/>
                </w:tcPr>
                <w:p/>
              </w:tc>
            </w:tr>
            <w:tr>
              <w:tc>
                <w:tcPr>
                  <w:tcW w:w="4621" w:type="dxa"/>
                </w:tcPr>
                <w:p/>
              </w:tc>
              <w:tc>
                <w:tcPr>
                  <w:tcW w:w="4621" w:type="dxa"/>
                </w:tcPr>
                <w:p/>
              </w:tc>
            </w:tr>
          </w:tbl>