Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenXml: What is the difference between SdtBlock and SdtCell?

SdtCell and SdtBlock in OpenXml.Wordprocessing both serialize into <w:sdt> so what is the difference? I assume one is a table cell, which is what the Microsoft documentation appears to imply. The details provided are sparse at best, please clarify.

like image 473
emd Avatar asked Dec 06 '11 17:12

emd


1 Answers

From the MSDN pages for sdtcell and sdtblock, emphasis mine below

The main difference is what type of content <w:sdtContent> you will have within the <w:sdt>

SDTCELL

This element specifies the presence of a structured document tag around a single table cell. The two child elements of this element shall be used to specify the properties and content of the current structured document tag via the sdtPr and sdtContent elements, respectively.

[Example: Consider a structured document tag with the friendly name company that must be located around a single table cell in a WordprocessingML document. This requirement would be specified as follows in the WordprocessingML:

<w:tr>
<w:sdt>
<w:sdtPr>
<w:alias w:val="company"/>
</w:sdtPr>
<w:sdtContent>
<w:tc>
…
</w:tc>
</w:sdtContent>
</w:sdt>
…
</w:tr>

The sdt element specifies the structured document tag, the child sdtPr element contains the friendly name property set to company, and the sdtContent element contains a single table cell (it is a cell-level structured document tag).

SDTBLOCK

This element specifies the presence of a structured document tag around one or more block-level structures (paragraphs, tables, etc.). The two child elements of this element shall be used to specify the properties and content of the current structured document tag via the sdtPr and sdtContent elements, respectively.

[Example: Consider a structured document tag with the friendly name address that must be located around a single paragraph in a WordprocessingML document. This requirement would be specified as follows in the WordprocessingML:

<w:body>
<w:sdt>
<w:sdtPr>
<w:alias w:val="address"/>
</w:sdtPr>
<w:sdtContent>
<w:p>
…
</w:p>
</w:sdtContent>
</w:sdt>
…
</w:body>

The sdt element specifies the structured document tag, the child sdtPr element contains the friendly name property set to address, and the sdtContent element contains a single paragraph (it is a block-level structured document tag).

like image 134
curtisk Avatar answered Oct 31 '22 23:10

curtisk