wordpress hit counter
Comments in WordprocessingML, SpreadsheetML and PresentationML - OpenXML Developer - Blog - OpenXML Developer
Goodbye and Hello

OpenXmlDeveloper.org is Shutting Down

There is a time for all good things to come to an end, and the time has come to shut down OpenXmlDeveloper.org.

Screen-casts and blog posts: Content on OpenXmlDeveloper.org will be moving to EricWhite.com.

Forums: We are moving the forums to EricWhite.com and StackOverflow.com. Please do not post in the forums on OpenXmlDeveloper.org. Instead, please post in the forums at EricWhite.com or at StackOverflow.com.

Please see this blog post for more information about my plans moving forward.  Cheers, Eric

Comments in WordprocessingML, SpreadsheetML and PresentationML

Comments in WordprocessingML, SpreadsheetML and PresentationML

  • Comments 20

Article By - Sheela E.N, Sonata Software Limited


In a lot of instances, we, as reviewers would like to add comments to the information or content present in Open XML documents. A note that an author or reviewer attaches to a piece of text in a document is called a Comment. A comment includes the text of the comment, the comment author's name and initials, and date of creation and other details.


Since comments are stored and handled differently in WordprocessingML, SpreadsheetML and PresentationML, this articles explains how comments are saved and referenced in these MLs.


Comments in WordprocessingML



The comment, “Nice feature has been given to the test, “comment featurein the paragraph of the Word document. The comment text will be marked with comment range like this,

<w:commentRangeStart w:id="0"/>

      <w:r>

            <w:t xml:space="preserve">comment feature </w:t>

      </w:r>

<w:commentRangeEnd w:id="0"/>


And the comment reference will also be added to the document main part like this,

<w:commentReference w:id="0"/>

The w:id="0" refers to the first comment in the comment part’s collection.


The other comment information like comment text, author and the date are stored in the comment part (comment1.xml) by default.

<w:comments xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w=http://schemas.openxmlformats.org/wordprocessingml/2006/main ……….. >

      <w:comment w:id="0" w:author="sheela.en" w:date="2007-07-05T11:01:00Z" w:initials="s">

<w:p w:rsidR="00F619DD" w:rsidRPr="00F619DD" w:rsidRDefault="00F619DD">

  <w:r w:rsidRPr="00F619DD">

      <w:rPr>

            <w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>

      </w:rPr>

      <w:t>Nice feature</w:t>

  </w:r>

</w:p>

      </w:comment>

</w:comments>

The relationship from the main document to the comment part is in the document part relationship (document.xml.rels file) and has an implicit relationship to it.


For example, this relationship refers to the comment part

<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" Target="comments.xml"/>


If the document has multiple comments, all the comments are stored in a comment1.xml file. The styles for the comment text are applied implictly by styles part (styles.xml) by default.

 

Comments in SpreadsheetML




The comment “Why sales is low here?” is given to cell D5. The comment details like cell address to which comment is given and the comment text are stored in comment part (comments1.xml) by default. The comment part also contains unique list of author’s names for all the comments for the work sheet. Each comment definition references the author’s collection by zero-based index.

For Example,

<comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">

      <authors>

            <author>Sheela.en</author>

      </authors>

      <commentList>

<comment ref="D5" authorId="0">

            <text>

                  <r>

                        <rPr>

                              <b/>

                              <sz val="8"/>

                              <color indexed="81"/>

                              <rFont val="Tahoma"/>

                              <charset val="1"/>

                        </rPr>

                        <t>xyz</t>

                  </r>

                  <r>

                        <rPr>

                              <sz val="8"/>

                              <color indexed="81"/>

                              <rFont val="Tahoma"/>

                              <charset val="1"/>

                        </rPr>

                        <t xml:space="preserve">Why sales is low here?</t>

                  </r>

            </text>

      </comment>

      </commentList>

</comments>

The worksheet has an implicit relationship to comment part in the sheet part relationship.

<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" Target="../comments1.xml"/>

 

The worksheet will not contain any data regarding the comment, but it holds drawing information (legacyDrawing1) for the object containing comment text.


For example,

<legacyDrawing r:id="rId1"/>


The relationship details will be present in the sheet part relationship file. It uses VML to draw the object as shown above.

<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing" Target="../drawings/vmlDrawing1.vml"/>


The vmlDrawing1.vml will be containing the information on the details of how the rectangle should drawn around the comment.


If a sheet has multiple comments, then all the comments are stored in the comment1.xml file. If multiple sheets have comments contained in them, then separate comment parts will be created for each of the sheets and they are referenced via their part relationship (e.g. - sheet2.xml.rels).


Comments in PresentationML



The comment “please change this title” is given to subtitle. The comment details like comment text, date, author etc are stored in two separate parts called comment1.xml (by default) and commentAuthors.xml (by default) part. The comment1.xml part will contain information regarding position and text of the comment. The commentAuthors.xml will contain author details such as name, initials, id etc. This file is commonly referred as Comment Author List (CAL). The CAL contains one entry for each author.

 

Example for comment1.xml—which references author by authored in <p:cm> element like this,

 

<p:cmLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">

      <p:cm authorId="1" dt="2007-07-05T14:46:21.264" idx="1">

<!—this is the location of the comment in the slide -->

            <p:pos x="3559" y="2476"/>

            <p:text>Please change this title.</p:text>

      </p:cm>

</p:cmLst>

 

In the commentAuthors.xml, the list of authors will be stored like this,

 

<p:cmAuthorLst xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">

      <p:cmAuthor id="0" name="sheela.en" initials="s" lastIdx="1" clrIdx="0"/>

      <p:cmAuthor id="1" name="Godha.n" initials="s" lastIdx="1" clrIdx="0"/>

</p:cmAuthorLst>

 


The relationship from the main document part to the comment part is in slide part relationship and has an implicit relationship to it.

<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" Target="../comments/comment1.xml"/>

The relationship to commentAuthors part is in presentation part relationship which is of type implicit.

<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors" Target="commentAuthors.xml"/>


If a slide has multiple comments, then all the comments are stored in the comment1.xml file.  If multiple slides have comments contained in them, then separate comment parts will be created for each of the slide and they are referenced via their part relationship (slide2.xml.rels). All the comment parts refer to single instance of commentAuthors part.

Page 1 of 2 (20 items) 12