none
Why does a sdt not need to be in a p? RRS feed

  • Question

  • This strikes me as weird - but it is legal (the top of the document.xml in a docx file):

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    
    <w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
    
    	<w:body>
    
    		<w:sdt>
    
    			<w:sdtPr>
    
    ...
    
    
    Why is this ok? ie, why doesn't it have to be document/body/p/sdt? I know the spec allows it - but why?

    thanks - dave
    Windward Reports - World's Greatest SharePoint Reporting & DocGen
    Saturday, January 30, 2010 11:51 PM

Answers

  • Hi Dave,

    Thanks for your feedback.

    I think it is a little subtle to distinguish these two types of <w:sdt> in Word UI, but their definitions are clear. If you are clear about the differences of definition and create them by SDK, I don't think there will be confusion.

    Thanks,

    Lu
    Monday, February 1, 2010 8:39 AM

All replies

  • Hi Dave,

    Thanks for your question.

    I think you may have mixed SdtBlock and SdtRun. The tag names of SdtBlock and SdtRun are both <w:sdt>. By spec, <w:sdt> for SdtBlock is Block-Level Structured Document Tag, which is the parent of Paragraph; <w:sdt> for SdtRun is Inline-Level Structured Document Tag, which is the child of Paragraph.

    For more detailed information, you could refer to this thread: http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/56f5e288-0d3c-4edd-a23e-b6e447b15915

    Hope this helps. If you have any questions, please let me know.

    Thanks,

    Lu
    Sunday, January 31, 2010 1:50 AM
  • Hi;

    I see that, but it still seems weird to me. If I have text in a para with the content control, then the <w:r> and <w:sdt> are inside a <w:p>. But if the content control is the only thing int he para - then it just uses what's inside the sdtContent.

    I can see how it does work - but it strikes me as inconsistent (or maybe weired is a better word).

    thanks - dave
    Windward Reports - World's Greatest SharePoint Reporting & DocGen
    Sunday, January 31, 2010 6:22 PM
  • Hi Dave,

    Thanks for your feedback.

    I think it is a little subtle to distinguish these two types of <w:sdt> in Word UI, but their definitions are clear. If you are clear about the differences of definition and create them by SDK, I don't think there will be confusion.

    Thanks,

    Lu
    Monday, February 1, 2010 8:39 AM