You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2015/11/23 16:22:43 UTC

svn commit: r1715842 - in /poi/site: publish/spreadsheet/quick-guide.html src/documentation/content/xdocs/spreadsheet/quick-guide.xml

Author: onealj
Date: Mon Nov 23 15:22:43 2015
New Revision: 1715842

URL: http://svn.apache.org/viewvc?rev=1715842&view=rev
Log:
bug 58365: add example code for getting all comments on a sheet

Modified:
    poi/site/publish/spreadsheet/quick-guide.html
    poi/site/src/documentation/content/xdocs/spreadsheet/quick-guide.xml

Modified: poi/site/publish/spreadsheet/quick-guide.html
URL: http://svn.apache.org/viewvc/poi/site/publish/spreadsheet/quick-guide.html?rev=1715842&r1=1715841&r2=1715842&view=diff
==============================================================================
--- poi/site/publish/spreadsheet/quick-guide.html (original)
+++ poi/site/publish/spreadsheet/quick-guide.html Mon Nov 23 15:22:43 2015
@@ -2060,6 +2060,21 @@ Examples:
     //  alternatively you can retrieve cell comments by (row, column)
     comment = sheet.getCellComment(3, 1);
   </pre>
+
+  
+<p>To get all the comments on a sheet:</p>
+  
+<pre class="code">
+    Map&lt;CellAddress, Comment&gt; comments = sheet.getCellComments();
+    Comment commentA1 = comments.get(new CellAddress(0, 0));
+    Comment commentB1 = comments.get(new CellAddress(0, 1));
+    for (Entry&lt;CellAddress, ? extends Comment&gt; e : comments.entrySet()) {
+      CellAddress loc = e.getKey();
+      Comment comment = e.getValue();
+      System.out.println("Comment at " + loc + ": " +
+          "[" + comment.getAuthor() + "] " + comment.getString().getString());
+    }
+  </pre>
      
 
      

Modified: poi/site/src/documentation/content/xdocs/spreadsheet/quick-guide.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/spreadsheet/quick-guide.xml?rev=1715842&r1=1715841&r2=1715842&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/spreadsheet/quick-guide.xml (original)
+++ poi/site/src/documentation/content/xdocs/spreadsheet/quick-guide.xml Mon Nov 23 15:22:43 2015
@@ -1459,6 +1459,19 @@ Examples:
     //  alternatively you can retrieve cell comments by (row, column)
     comment = sheet.getCellComment(3, 1);
   </source>
+
+  <p>To get all the comments on a sheet:</p>
+  <source>
+    Map&lt;CellAddress, Comment&gt; comments = sheet.getCellComments();
+    Comment commentA1 = comments.get(new CellAddress(0, 0));
+    Comment commentB1 = comments.get(new CellAddress(0, 1));
+    for (Entry&lt;CellAddress, ? extends Comment&gt; e : comments.entrySet()) {
+      CellAddress loc = e.getKey();
+      Comment comment = e.getValue();
+      System.out.println("Comment at " + loc + ": " +
+          "[" + comment.getAuthor() + "] " + comment.getString().getString());
+    }
+  </source>
      </section>
 
      <anchor id="Autofit"/>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org