incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1010270 [6/13] - in /websites/staging/odftoolkit/trunk/content: ./ odftoolkit/ odftoolkit/GSoC/ odftoolkit/docs/ odftoolkit/docs/governance/ odftoolkit/odfdom/ odftoolkit/simple/ odftoolkit/simple/demo/ odftoolkit/simple/document/ odftoolk...
Date Tue, 11 Apr 2017 23:13:31 GMT
Modified: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo4.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo4.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo4.html Tue Apr 11 23:13:30 2017
@@ -50,7 +50,18 @@
   <div id="clear"></div>
   
   <div id="sidenav">
-    <h1 id="general">General</h1>
+    <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<h1 id="general">General<a class="headerlink" href="#general" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/index.html">About</a></li>
 <li><a href="/odftoolkit/downloads.html">Downloads</a></li>
@@ -58,21 +69,21 @@
 <li><a href="/odftoolkit/license.html">License</a></li>
 <li><a href="/odftoolkit/privacy.html">Privacy Policy</a></li>
 </ul>
-<h1 id="components">Components</h1>
+<h1 id="components">Components<a class="headerlink" href="#components" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/odfdom/index.html">ODFDOM</a></li>
 <li><a href="/odftoolkit/simple/index.html">Simple API</a></li>
 <li><a href="/odftoolkit/conformance/ODFValidator.html">ODF Validator</a></li>
 <li><a href="/odftoolkit/xsltrunner/ODFXSLTRunner.html">XSLT Runner</a></li>
 </ul>
-<h1 id="community">Community</h1>
+<h1 id="community">Community<a class="headerlink" href="#community" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/get-involved.html">Get Involved</a></li>
 <li><a href="/odftoolkit/mailing-lists.html">Mailing Lists</a></li>
 <li><a href="/odftoolkit/people.html">People</a></li>
 <li><a href="/odftoolkit/community-faqs.html">Community FAQs</a></li>
 </ul>
-<h1 id="development">Development</h1>
+<h1 id="development">Development<a class="headerlink" href="#development" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/source.html">Source Code</a></li>
 <li><a href="https://issues.apache.org/jira/browse/ODFTOOLKIT">Bug Tracker</a></li>
@@ -80,13 +91,12 @@
 <li><a href="/odftoolkit/website-local.html">Website</a></li>
 <li><a href="/odftoolkit/developer-faqs.html">Developer FAQs</a></li>
 </ul>
-<h1 id="ppmc">PPMC</h1>
+<h1 id="ppmc">PPMC<a class="headerlink" href="#ppmc" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/ppmc-faqs.html">PPMC FAQs</a></li>
-<li><a href="/odftoolkit/odftoolkit-release-guide.html">Release Guide</a> <br />
-</li>
+<li><a href="/odftoolkit/odftoolkit-release-guide.html">Release Guide</a>   </li>
 </ul>
-<h1 id="asf">ASF</h1>
+<h1 id="asf">ASF<a class="headerlink" href="#asf" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="http://www.apache.org">Apache Software Foundation</a></li>
 <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
@@ -96,82 +106,83 @@
   <div id="contenta">
   
     
-    <p><strong><a href="index.html">Demos</a></strong> &gt; <strong>List and Table Conversion</strong> <br />
-</p>
-<p><strong>Overview</strong><br />
-</p>
-<p>Starting in version 0.4, we have added methods to support bullet, numbered and image lists to the Simple API. This includes frequently used features  for processing lists and list item. This demo is designed to show the power of List API and help you learn how to use it.<br />
-</p>
+    <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<p><strong><a href="index.html">Demos</a></strong> &gt; <strong>List and Table Conversion</strong>   </p>
+<p><strong>Overview</strong>  </p>
+<p>Starting in version 0.4, we have added methods to support bullet, numbered and image lists to the Simple API. This includes frequently used features  for processing lists and list item. This demo is designed to show the power of List API and help you learn how to use it.  </p>
 <p>This demo shows how to convert between a nested List and Table. As you can see in the following two pictures, on the left we have a simple outline of a corporate 
 hierarchy. There are four departments in this company.  Each department has several managers and each manager has several reporting staff.  Now we want 
-to change this list to a table, just like the picture on the right shows.<br />
-</p>
-<p><img alt="image1" src="image/demo4_organization_list.png" /><br />
-</p>
-<p>However, sometimes we want to convert in the opposite direction, from a table to a list. Take the following two pictures as example. The left one is table of country calling codes, which includes the codes of countries from different continents. Suppose you want to convert this table representation into a nested list.  The picture on the right shows the conversion result. The first level list show the continent names and the second level list show the countries and their calling codes.  <br />
-</p>
-<p><img alt="image2" src="image/demo4_code_list.png" />   <br />
-</p>
+to change this list to a table, just like the picture on the right shows.  </p>
+<p><img alt="image1" src="image/demo4_organization_list.png" />  </p>
+<p>However, sometimes we want to convert in the opposite direction, from a table to a list. Take the following two pictures as example. The left one is table of country calling codes, which includes the codes of countries from different continents. Suppose you want to convert this table representation into a nested list.  The picture on the right shows the conversion result. The first level list show the continent names and the second level list show the countries and their calling codes.    </p>
+<p><img alt="image2" src="image/demo4_code_list.png" />     </p>
 <p>You can see similar functionality in office software, such as selective copy and paste. In the next section, I will show how easy to do these kinds of conversions using the Simple API. </p>
 <p><strong>Code Introduction</strong></p>
-<p>Let's have a look at the main method. It will help us get an overview of this demo. First, the list data text document, "ListTable.odt" and table data spreadsheet document "TableList.ods" are loaded. Secondly, we use the list iteration function to get all of the lists in the text document and invoke the method <code>convertFromListToTable</code> to convert each of them to a table. Finally, we get the data table from "TableList.ods" and invoke the method <code>convertFromTableToList</code> to convert this table to a list. All of the updated documents are saved as new files. You can open them and see the conversion results. <br />
-</p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">static</span> <span class="n">void</span> <span class="n">main</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span>
-    <span class="n">try</span> <span class="p">{</span>
-        <span class="n">TextDocument</span> <span class="n">textDoc</span> <span class="o">=</span> <span class="n">TextDocument</span><span class="o">.</span><span class="n">loadDocument</span><span class="p">(</span><span class="s">&quot;ListTable.odt&quot;</span><span class="p">);</span>
-        <span class="n">SpreadsheetDocument</span> <span class="n">spreadsheetDoc</span> <span class="o">=</span> <span class="n">SpreadsheetDocument</span><span class="o">.</span><span class="n">loadDocument</span><span class="p">(</span><span class="s">&quot;TableList.ods&quot;</span><span class="p">);</span>
-        <span class="sr">//</span> <span class="n">covert</span> <span class="n">list</span> <span class="n">in</span> <span class="n">text</span> <span class="n">document</span> <span class="n">to</span> <span class="n">spreadsheet</span> <span class="n">table</span>
-        <span class="n">Iterator</span><span class="sr">&lt;list&gt;</span> <span class="n">listIterator</span> <span class="o">=</span> <span class="n">textDoc</span><span class="o">.</span><span class="n">getListIterator</span><span class="p">();</span>
-        <span class="nb">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
-        <span class="n">String</span><span class="o">[]</span> <span class="n">tableLabel</span> <span class="o">=</span> <span class="p">{</span> <span class="s">&quot;DEPARTMENT&quot;</span><span class="p">,</span> <span class="s">&quot;MANAGER&quot;</span><span class="p">,</span> <span class="s">&quot;EMPLOYEE&quot;</span> <span class="p">};</span>
-        <span class="k">while</span> <span class="p">(</span><span class="n">listIterator</span><span class="o">.</span><span class="n">hasNext</span><span class="p">())</span> <span class="p">{</span>
-            <span class="n">List</span> <span class="n">list</span> <span class="o">=</span> <span class="n">listIterator</span><span class="o">.</span><span class="k">next</span><span class="p">();</span>
-            <span class="n">Table</span> <span class="n">newTable</span> <span class="o">=</span> <span class="n">Table</span><span class="o">.</span><span class="n">newTable</span><span class="p">(</span><span class="n">spreadsheetDoc</span><span class="p">);</span>
-            <span class="k">for</span> <span class="p">(</span><span class="nb">int</span> <span class="n">columnIndex</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">columnIndex</span> <span class="o">&lt;</span> <span class="n">tableLabel</span><span class="o">.</span><span class="nb">length</span><span class="p">;</span> <span class="n">columnIndex</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
-                <span class="n">newTable</span><span class="o">.</span><span class="n">getCellByPosition</span><span class="p">(</span><span class="n">columnIndex</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">setStringValue</span><span class="p">(</span><span class="n">tableLabel</span><span class="p">[</span><span class="n">columnIndex</span><span class="p">]);</span>
+<p>Let's have a look at the main method. It will help us get an overview of this demo. First, the list data text document, "ListTable.odt" and table data spreadsheet document "TableList.ods" are loaded. Secondly, we use the list iteration function to get all of the lists in the text document and invoke the method <code>convertFromListToTable</code> to convert each of them to a table. Finally, we get the data table from "TableList.ods" and invoke the method <code>convertFromTableToList</code> to convert this table to a list. All of the updated documents are saved as new files. You can open them and see the conversion results.   </p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">static</span> <span class="n">void</span> <span class="n">main</span><span class="p">(</span><span class="n">String</span><span class="p">[]</span> <span class="n">args</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">try</span> <span class="p">{</span>
+        <span class="n">TextDocument</span> <span class="n">textDoc</span> <span class="p">=</span> <span class="n">TextDocument</span><span class="p">.</span><span class="n">loadDocument</span><span class="p">(</span>&quot;<span class="n">ListTable</span><span class="p">.</span><span class="n">odt</span>&quot;<span class="p">);</span>
+        <span class="n">SpreadsheetDocument</span> <span class="n">spreadsheetDoc</span> <span class="p">=</span> <span class="n">SpreadsheetDocument</span><span class="p">.</span><span class="n">loadDocument</span><span class="p">(</span>&quot;<span class="n">TableList</span><span class="p">.</span><span class="n">ods</span>&quot;<span class="p">);</span>
+        <span class="o">//</span> <span class="n">covert</span> <span class="n">list</span> <span class="n">in</span> <span class="n">text</span> <span class="n">document</span> <span class="n">to</span> <span class="n">spreadsheet</span> <span class="n">table</span>
+        <span class="n">Iterator</span><span class="o">&lt;</span><span class="n">list</span><span class="o">&gt;</span> <span class="n">listIterator</span> <span class="p">=</span> <span class="n">textDoc</span><span class="p">.</span><span class="n">getListIterator</span><span class="p">();</span>
+        <span class="n">int</span> <span class="nb">i</span> <span class="p">=</span> 1<span class="p">;</span>
+        <span class="n">String</span><span class="p">[]</span> <span class="n">tableLabel</span> <span class="p">=</span> <span class="p">{</span> &quot;<span class="n">DEPARTMENT</span>&quot;<span class="p">,</span> &quot;<span class="n">MANAGER</span>&quot;<span class="p">,</span> &quot;<span class="n">EMPLOYEE</span>&quot; <span class="p">};</span>
+        <span class="k">while</span> <span class="p">(</span><span class="n">listIterator</span><span class="p">.</span><span class="n">hasNext</span><span class="p">())</span> <span class="p">{</span>
+            <span class="n">List</span> <span class="n">list</span> <span class="p">=</span> <span class="n">listIterator</span><span class="p">.</span><span class="n">next</span><span class="p">();</span>
+            <span class="n">Table</span> <span class="n">newTable</span> <span class="p">=</span> <span class="n">Table</span><span class="p">.</span><span class="n">newTable</span><span class="p">(</span><span class="n">spreadsheetDoc</span><span class="p">);</span>
+            <span class="k">for</span> <span class="p">(</span><span class="n">int</span> <span class="n">columnIndex</span> <span class="p">=</span> 0<span class="p">;</span> <span class="n">columnIndex</span> <span class="o">&lt;</span> <span class="n">tableLabel</span><span class="p">.</span><span class="nb">length</span><span class="p">;</span> <span class="n">columnIndex</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
+                <span class="n">newTable</span><span class="p">.</span><span class="n">getCellByPosition</span><span class="p">(</span><span class="n">columnIndex</span><span class="p">,</span> 0<span class="p">).</span><span class="n">setStringValue</span><span class="p">(</span><span class="n">tableLabel</span><span class="p">[</span><span class="n">columnIndex</span><span class="p">]);</span>
             <span class="p">}</span>
-            <span class="n">newTable</span><span class="o">.</span><span class="n">setTableName</span><span class="p">(</span><span class="s">&quot;ListTable&quot;</span> <span class="o">+</span> <span class="p">(</span><span class="n">i</span><span class="o">++</span><span class="p">));</span>
-            <span class="n">convertFromListToTable</span><span class="p">(</span><span class="n">list</span><span class="p">,</span> <span class="n">newTable</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
+            <span class="n">newTable</span><span class="p">.</span><span class="n">setTableName</span><span class="p">(</span>&quot;<span class="n">ListTable</span>&quot; <span class="o">+</span> <span class="p">(</span><span class="nb">i</span><span class="o">++</span><span class="p">));</span>
+            <span class="n">convertFromListToTable</span><span class="p">(</span><span class="n">list</span><span class="p">,</span> <span class="n">newTable</span><span class="p">,</span> 0<span class="p">,</span> 1<span class="p">);</span>
         <span class="p">}</span>
-        <span class="n">spreadsheetDoc</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s">&quot;TableListUpdate.ods&quot;</span><span class="p">);</span>
-        <span class="sr">//</span> <span class="n">covert</span> <span class="n">table</span> <span class="n">in</span> <span class="n">spreadsheet</span> <span class="n">to</span> <span class="n">list</span> <span class="n">in</span> <span class="n">text</span> <span class="n">document</span>
-        <span class="n">Table</span> <span class="n">sheet1</span> <span class="o">=</span> <span class="n">spreadsheetDoc</span><span class="o">.</span><span class="n">getTableByName</span><span class="p">(</span><span class="s">&quot;Sheet1&quot;</span><span class="p">);</span>
-        <span class="n">textDoc</span><span class="o">.</span><span class="n">newParagraph</span><span class="p">(</span><span class="s">&quot;ListConvertedFromTable&quot;</span><span class="p">);</span>
-        <span class="n">List</span> <span class="n">newList</span> <span class="o">=</span> <span class="n">textDoc</span><span class="o">.</span><span class="n">addList</span><span class="p">();</span>
-        <span class="n">convertFromTableToList</span><span class="p">(</span><span class="n">sheet1</span><span class="p">,</span> <span class="n">newList</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">sheet1</span><span class="o">.</span><span class="n">getColumnCount</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">sheet1</span><span class="o">.</span><span class="n">getRowCount</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span>
-        <span class="n">textDoc</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s">&quot;ListTableUpdate.odt&quot;</span><span class="p">);</span>
-    <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">Exception</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
-        <span class="n">e</span><span class="o">.</span><span class="n">printStackTrace</span><span class="p">();</span>
+        <span class="n">spreadsheetDoc</span><span class="p">.</span><span class="n">save</span><span class="p">(</span>&quot;<span class="n">TableListUpdate</span><span class="p">.</span><span class="n">ods</span>&quot;<span class="p">);</span>
+        <span class="o">//</span> <span class="n">covert</span> <span class="n">table</span> <span class="n">in</span> <span class="n">spreadsheet</span> <span class="n">to</span> <span class="n">list</span> <span class="n">in</span> <span class="n">text</span> <span class="n">document</span>
+        <span class="n">Table</span> <span class="n">sheet1</span> <span class="p">=</span> <span class="n">spreadsheetDoc</span><span class="p">.</span><span class="n">getTableByName</span><span class="p">(</span>&quot;<span class="n">Sheet1</span>&quot;<span class="p">);</span>
+        <span class="n">textDoc</span><span class="p">.</span><span class="n">newParagraph</span><span class="p">(</span>&quot;<span class="n">ListConvertedFromTable</span>&quot;<span class="p">);</span>
+        <span class="n">List</span> <span class="n">newList</span> <span class="p">=</span> <span class="n">textDoc</span><span class="p">.</span><span class="n">addList</span><span class="p">();</span>
+        <span class="n">convertFromTableToList</span><span class="p">(</span><span class="n">sheet1</span><span class="p">,</span> <span class="n">newList</span><span class="p">,</span> 0<span class="p">,</span> 0<span class="p">,</span> <span class="n">sheet1</span><span class="p">.</span><span class="n">getColumnCount</span><span class="p">()</span> <span class="o">-</span> 1<span class="p">,</span> <span class="n">sheet1</span><span class="p">.</span><span class="n">getRowCount</span><span class="p">()</span> <span class="o">-</span> 1<span class="p">);</span>
+        <span class="n">textDoc</span><span class="p">.</span><span class="n">save</span><span class="p">(</span>&quot;<span class="n">ListTableUpdate</span><span class="p">.</span><span class="n">odt</span>&quot;<span class="p">);</span>
+    <span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="n">Exception</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">e</span><span class="p">.</span><span class="n">printStackTrace</span><span class="p">();</span>
     <span class="p">}</span>
 <span class="p">}</span>
 </pre></div>
 
 
-<p>In the following two sections, I will review the implementation of the methods <code>convertFromListToTable</code> and <code>convertFromTableToList</code>.  <br />
-</p>
+<p>In the following two sections, I will review the implementation of the methods <code>convertFromListToTable</code> and <code>convertFromTableToList</code>.    </p>
 <p><strong><em>Convert from List to Table</em></strong></p>
-<p>This is a recursive method, similar to a depth-first tree traversal. You determine the paste cell address by <code>startColumn</code> and <code>startRow</code>. First, all of the items in the list are retrieved. Second, each list item is converted to table cell. Its text content is extracted and set as the cell's display text. If the item has a sub list, its sub list is also handled the same as the parent list. After all of the items are converted to cells, we invoke <code>CellRange.merge()</code> to merge the blank cells. The generation document appears just like the picture shown earlier.  <br />
-</p>
-<div class="codehilite"><pre><span class="n">private</span> <span class="n">static</span> <span class="nb">int</span> <span class="n">convertFromListToTable</span><span class="p">(</span><span class="n">List</span> <span class="n">list</span><span class="p">,</span> <span class="n">Table</span> <span class="n">table</span><span class="p">,</span> <span class="nb">int</span> <span class="n">startColumn</span><span class="p">,</span> <span class="nb">int</span> <span class="n">startRow</span><span class="p">)</span> <span class="p">{</span>
-    <span class="n">java</span><span class="o">.</span><span class="n">util</span><span class="o">.</span><span class="n">List</span><span class="sr">&lt;listitem&gt;</span> <span class="n">items</span> <span class="o">=</span> <span class="n">list</span><span class="o">.</span><span class="n">getItems</span><span class="p">();</span>
-    <span class="nb">int</span> <span class="n">newItemCount</span> <span class="o">=</span> <span class="n">startRow</span><span class="p">;</span>
+<p>This is a recursive method, similar to a depth-first tree traversal. You determine the paste cell address by <code>startColumn</code> and <code>startRow</code>. First, all of the items in the list are retrieved. Second, each list item is converted to table cell. Its text content is extracted and set as the cell's display text. If the item has a sub list, its sub list is also handled the same as the parent list. After all of the items are converted to cells, we invoke <code>CellRange.merge()</code> to merge the blank cells. The generation document appears just like the picture shown earlier.    </p>
+<div class="codehilite"><pre><span class="n">private</span> <span class="n">static</span> <span class="n">int</span> <span class="n">convertFromListToTable</span><span class="p">(</span><span class="n">List</span> <span class="n">list</span><span class="p">,</span> <span class="n">Table</span> <span class="n">table</span><span class="p">,</span> <span class="n">int</span> <span class="n">startColumn</span><span class="p">,</span> <span class="n">int</span> <span class="n">startRow</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">java</span><span class="p">.</span><span class="n">util</span><span class="p">.</span><span class="n">List</span><span class="o">&lt;</span><span class="n">listitem</span><span class="o">&gt;</span> <span class="n">items</span> <span class="p">=</span> <span class="n">list</span><span class="p">.</span><span class="n">getItems</span><span class="p">();</span>
+    <span class="n">int</span> <span class="n">newItemCount</span> <span class="p">=</span> <span class="n">startRow</span><span class="p">;</span>
     <span class="k">for</span> <span class="p">(</span><span class="n">ListItem</span> <span class="n">item</span> <span class="p">:</span> <span class="n">items</span><span class="p">)</span> <span class="p">{</span>
-        <span class="n">Cell</span> <span class="n">cell</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">getCellByPosition</span><span class="p">(</span><span class="n">startColumn</span><span class="p">,</span> <span class="n">newItemCount</span><span class="p">);</span>
-        <span class="n">cell</span><span class="o">.</span><span class="n">setStringValue</span><span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">getTextContent</span><span class="p">());</span>
-        <span class="n">cell</span><span class="o">.</span><span class="n">setVerticalAlignment</span><span class="p">(</span><span class="n">VerticalAlignmentType</span><span class="o">.</span><span class="n">MIDDLE</span><span class="p">);</span>
-        <span class="n">Iterator</span><span class="sr">&lt;list&gt;</span> <span class="n">listIterator</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">listIterator</span><span class="p">();</span>
-        <span class="n">startRow</span> <span class="o">=</span> <span class="n">newItemCount</span><span class="p">;</span>
-        <span class="k">while</span> <span class="p">(</span><span class="n">listIterator</span><span class="o">.</span><span class="n">hasNext</span><span class="p">())</span> <span class="p">{</span>
-            <span class="n">List</span> <span class="n">subList</span> <span class="o">=</span> <span class="n">listIterator</span><span class="o">.</span><span class="k">next</span><span class="p">();</span>
-            <span class="n">newItemCount</span> <span class="o">=</span> <span class="n">convertFromListToTable</span><span class="p">(</span><span class="n">subList</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="n">startColumn</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="n">newItemCount</span><span class="p">);</span>
+        <span class="n">Cell</span> <span class="n">cell</span> <span class="p">=</span> <span class="n">table</span><span class="p">.</span><span class="n">getCellByPosition</span><span class="p">(</span><span class="n">startColumn</span><span class="p">,</span> <span class="n">newItemCount</span><span class="p">);</span>
+        <span class="n">cell</span><span class="p">.</span><span class="n">setStringValue</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">getTextContent</span><span class="p">());</span>
+        <span class="n">cell</span><span class="p">.</span><span class="n">setVerticalAlignment</span><span class="p">(</span><span class="n">VerticalAlignmentType</span><span class="p">.</span><span class="n">MIDDLE</span><span class="p">);</span>
+        <span class="n">Iterator</span><span class="o">&lt;</span><span class="n">list</span><span class="o">&gt;</span> <span class="n">listIterator</span> <span class="p">=</span> <span class="n">item</span><span class="p">.</span><span class="n">listIterator</span><span class="p">();</span>
+        <span class="n">startRow</span> <span class="p">=</span> <span class="n">newItemCount</span><span class="p">;</span>
+        <span class="k">while</span> <span class="p">(</span><span class="n">listIterator</span><span class="p">.</span><span class="n">hasNext</span><span class="p">())</span> <span class="p">{</span>
+            <span class="n">List</span> <span class="n">subList</span> <span class="p">=</span> <span class="n">listIterator</span><span class="p">.</span><span class="n">next</span><span class="p">();</span>
+            <span class="n">newItemCount</span> <span class="p">=</span> <span class="n">convertFromListToTable</span><span class="p">(</span><span class="n">subList</span><span class="p">,</span> <span class="n">table</span><span class="p">,</span> <span class="n">startColumn</span> <span class="o">+</span> 1<span class="p">,</span> <span class="n">newItemCount</span><span class="p">);</span>
         <span class="p">}</span>
-        <span class="sr">//</span> <span class="n">merge</span>
-        <span class="n">CellRange</span> <span class="n">cellRange</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">getCellRangeByPosition</span><span class="p">(</span><span class="n">startColumn</span><span class="p">,</span> <span class="n">startRow</span><span class="p">,</span> <span class="n">startColumn</span><span class="p">,</span> <span class="n">newItemCount</span><span class="p">);</span>
-        <span class="n">cellRange</span><span class="o">.</span><span class="n">merge</span><span class="p">();</span>
+        <span class="o">//</span> <span class="n">merge</span>
+        <span class="n">CellRange</span> <span class="n">cellRange</span> <span class="p">=</span> <span class="n">table</span><span class="p">.</span><span class="n">getCellRangeByPosition</span><span class="p">(</span><span class="n">startColumn</span><span class="p">,</span> <span class="n">startRow</span><span class="p">,</span> <span class="n">startColumn</span><span class="p">,</span> <span class="n">newItemCount</span><span class="p">);</span>
+        <span class="n">cellRange</span><span class="p">.</span><span class="n">merge</span><span class="p">();</span>
         <span class="n">newItemCount</span><span class="o">++</span><span class="p">;</span>
     <span class="p">}</span>
-    <span class="k">if</span> <span class="p">(</span><span class="n">list</span><span class="o">.</span><span class="n">size</span><span class="p">()</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
-        <span class="k">return</span> <span class="n">newItemCount</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">list</span><span class="p">.</span><span class="nb">size</span><span class="p">()</span> <span class="o">&gt;</span> 0<span class="p">)</span> <span class="p">{</span>
+        <span class="k">return</span> <span class="n">newItemCount</span> <span class="o">-</span> 1<span class="p">;</span>
     <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
         <span class="k">return</span> <span class="n">startRow</span><span class="p">;</span>
     <span class="p">}</span>
@@ -180,45 +191,42 @@ to change this list to a table, just lik
 
 
 <p><strong><em>Convert from Table to List</em></strong></p>
-<p>This is also a recursive method. You determine the conversion range of the table by <code>startColumn</code>, <code>startRow</code>, <code>endColumn</code> and <code>endRow</code>. First, every cell in the selected range is retrieved by <code>Table.getCellByPosition</code>. Next, a list item is created to store the cell display text. If the <code>rowSpannedNumber &gt; 1</code>, that means this item has a sub list. Parts of the cells in the right columns of this cell become the items of the sub list. They are also determined by recursive calls to <code>convertFromTableToList</code>. If the <code>rowSpannedNumber = 1</code>, there is no need to create a sub list, all of the content in the right cells is just added to this item. <br />
-</p>
-<div class="codehilite"><pre><span class="n">private</span> <span class="n">static</span> <span class="n">void</span> <span class="n">convertFromTableToList</span><span class="p">(</span><span class="n">Table</span> <span class="n">table</span><span class="p">,</span> <span class="n">List</span> <span class="n">list</span><span class="p">,</span> <span class="nb">int</span> <span class="n">startColumn</span><span class="p">,</span> <span class="nb">int</span> <span class="n">startRow</span><span class="p">,</span> <span class="nb">int</span> <span class="n">endColumn</span><span class="p">,</span> <span class="nb">int</span> <span class="n">endRow</span><span class="p">)</span> <span class="p">{</span>
-    <span class="k">while</span> <span class="p">(</span><span class="n">startRow</span> <span class="o">&lt;=</span> <span class="n">endRow</span><span class="p">)</span> <span class="p">{</span>
-        <span class="n">Cell</span> <span class="n">cell</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">getCellByPosition</span><span class="p">(</span><span class="n">startColumn</span><span class="p">,</span> <span class="n">startRow</span><span class="p">);</span>
-        <span class="nb">int</span> <span class="n">rowSpannedNumber</span> <span class="o">=</span> <span class="n">cell</span><span class="o">.</span><span class="n">getRowSpannedNumber</span><span class="p">();</span>
-        <span class="n">String</span> <span class="n">cellText</span> <span class="o">=</span> <span class="n">cell</span><span class="o">.</span><span class="n">getDisplayText</span><span class="p">();</span>
-        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="s">&quot;&quot;</span><span class="o">.</span><span class="n">equals</span><span class="p">(</span><span class="n">cellText</span><span class="p">))</span> <span class="p">{</span>
-            <span class="n">ListItem</span> <span class="n">item</span> <span class="o">=</span> <span class="n">list</span><span class="o">.</span><span class="n">addItem</span><span class="p">(</span><span class="n">cellText</span><span class="p">);</span>
-            <span class="nb">int</span> <span class="n">columnSpannedNumber</span> <span class="o">=</span> <span class="n">cell</span><span class="o">.</span><span class="n">getColumnSpannedNumber</span><span class="p">();</span>
-            <span class="nb">int</span> <span class="n">newStartColumn</span> <span class="o">=</span> <span class="n">startColumn</span> <span class="o">+</span> <span class="n">columnSpannedNumber</span><span class="p">;</span>
-            <span class="k">if</span> <span class="p">(</span><span class="n">newStartColumn</span> <span class="o">&lt;=</span> <span class="n">endColumn</span><span class="p">)</span> <span class="p">{</span>
-                <span class="k">if</span> <span class="p">(</span><span class="n">rowSpannedNumber</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
-                    <span class="n">List</span> <span class="n">subList</span> <span class="o">=</span> <span class="n">item</span><span class="o">.</span><span class="n">addList</span><span class="p">();</span>
-                    <span class="n">convertFromTableToList</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">subList</span><span class="p">,</span> <span class="n">newStartColumn</span><span class="p">,</span> <span class="n">startRow</span><span class="p">,</span> <span class="n">endColumn</span><span class="p">,</span> <span class="n">startRow</span> <span class="o">+</span> <span class="n">rowSpannedNumber</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span>
+<p>This is also a recursive method. You determine the conversion range of the table by <code>startColumn</code>, <code>startRow</code>, <code>endColumn</code> and <code>endRow</code>. First, every cell in the selected range is retrieved by <code>Table.getCellByPosition</code>. Next, a list item is created to store the cell display text. If the <code>rowSpannedNumber &gt; 1</code>, that means this item has a sub list. Parts of the cells in the right columns of this cell become the items of the sub list. They are also determined by recursive calls to <code>convertFromTableToList</code>. If the <code>rowSpannedNumber = 1</code>, there is no need to create a sub list, all of the content in the right cells is just added to this item.   </p>
+<div class="codehilite"><pre><span class="n">private</span> <span class="n">static</span> <span class="n">void</span> <span class="n">convertFromTableToList</span><span class="p">(</span><span class="n">Table</span> <span class="n">table</span><span class="p">,</span> <span class="n">List</span> <span class="n">list</span><span class="p">,</span> <span class="n">int</span> <span class="n">startColumn</span><span class="p">,</span> <span class="n">int</span> <span class="n">startRow</span><span class="p">,</span> <span class="n">int</span> <span class="n">endColumn</span><span class="p">,</span> <span class="n">int</span> <span class="n">endRow</span><span class="p">)</span> <span class="p">{</span>
+    <span class="k">while</span> <span class="p">(</span><span class="n">startRow</span> <span class="o">&lt;</span><span class="p">=</span> <span class="n">endRow</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">Cell</span> <span class="n">cell</span> <span class="p">=</span> <span class="n">table</span><span class="p">.</span><span class="n">getCellByPosition</span><span class="p">(</span><span class="n">startColumn</span><span class="p">,</span> <span class="n">startRow</span><span class="p">);</span>
+        <span class="n">int</span> <span class="n">rowSpannedNumber</span> <span class="p">=</span> <span class="n">cell</span><span class="p">.</span><span class="n">getRowSpannedNumber</span><span class="p">();</span>
+        <span class="n">String</span> <span class="n">cellText</span> <span class="p">=</span> <span class="n">cell</span><span class="p">.</span><span class="n">getDisplayText</span><span class="p">();</span>
+        <span class="k">if</span> <span class="p">(</span>!&quot;&quot;<span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">cellText</span><span class="p">))</span> <span class="p">{</span>
+            <span class="n">ListItem</span> <span class="n">item</span> <span class="p">=</span> <span class="n">list</span><span class="p">.</span><span class="n">addItem</span><span class="p">(</span><span class="n">cellText</span><span class="p">);</span>
+            <span class="n">int</span> <span class="n">columnSpannedNumber</span> <span class="p">=</span> <span class="n">cell</span><span class="p">.</span><span class="n">getColumnSpannedNumber</span><span class="p">();</span>
+            <span class="n">int</span> <span class="n">newStartColumn</span> <span class="p">=</span> <span class="n">startColumn</span> <span class="o">+</span> <span class="n">columnSpannedNumber</span><span class="p">;</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">newStartColumn</span> <span class="o">&lt;</span><span class="p">=</span> <span class="n">endColumn</span><span class="p">)</span> <span class="p">{</span>
+                <span class="k">if</span> <span class="p">(</span><span class="n">rowSpannedNumber</span> <span class="o">&gt;</span> 1<span class="p">)</span> <span class="p">{</span>
+                    <span class="n">List</span> <span class="n">subList</span> <span class="p">=</span> <span class="n">item</span><span class="p">.</span><span class="n">addList</span><span class="p">();</span>
+                    <span class="n">convertFromTableToList</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="n">subList</span><span class="p">,</span> <span class="n">newStartColumn</span><span class="p">,</span> <span class="n">startRow</span><span class="p">,</span> <span class="n">endColumn</span><span class="p">,</span> <span class="n">startRow</span> <span class="o">+</span> <span class="n">rowSpannedNumber</span> <span class="o">-</span> 1<span class="p">);</span>
                 <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
-                    <span class="nb">int</span> <span class="n">tmpStartColumn</span> <span class="o">=</span> <span class="n">newStartColumn</span><span class="p">;</span>
-                    <span class="k">while</span> <span class="p">(</span><span class="n">tmpStartColumn</span> <span class="o">&lt;=</span> <span class="n">endColumn</span><span class="p">)</span> <span class="p">{</span>
-                        <span class="n">cell</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">getCellByPosition</span><span class="p">(</span><span class="n">tmpStartColumn</span><span class="p">,</span> <span class="n">startRow</span><span class="p">);</span>
-                        <span class="n">cellText</span> <span class="o">=</span> <span class="n">cell</span><span class="o">.</span><span class="n">getDisplayText</span><span class="p">();</span>
-                        <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="s">&quot;&quot;</span><span class="o">.</span><span class="n">equals</span><span class="p">(</span><span class="n">cellText</span><span class="p">))</span> <span class="p">{</span>
-                            <span class="n">item</span><span class="o">.</span><span class="n">setTextContent</span><span class="p">(</span><span class="n">item</span><span class="o">.</span><span class="n">getTextContent</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;|&quot;</span> <span class="o">+</span> <span class="n">cellText</span><span class="p">);</span>
+                    <span class="n">int</span> <span class="n">tmpStartColumn</span> <span class="p">=</span> <span class="n">newStartColumn</span><span class="p">;</span>
+                    <span class="k">while</span> <span class="p">(</span><span class="n">tmpStartColumn</span> <span class="o">&lt;</span><span class="p">=</span> <span class="n">endColumn</span><span class="p">)</span> <span class="p">{</span>
+                        <span class="n">cell</span> <span class="p">=</span> <span class="n">table</span><span class="p">.</span><span class="n">getCellByPosition</span><span class="p">(</span><span class="n">tmpStartColumn</span><span class="p">,</span> <span class="n">startRow</span><span class="p">);</span>
+                        <span class="n">cellText</span> <span class="p">=</span> <span class="n">cell</span><span class="p">.</span><span class="n">getDisplayText</span><span class="p">();</span>
+                        <span class="k">if</span> <span class="p">(</span>!&quot;&quot;<span class="p">.</span><span class="n">equals</span><span class="p">(</span><span class="n">cellText</span><span class="p">))</span> <span class="p">{</span>
+                            <span class="n">item</span><span class="p">.</span><span class="n">setTextContent</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">getTextContent</span><span class="p">()</span> <span class="o">+</span> &quot;<span class="o">|</span>&quot; <span class="o">+</span> <span class="n">cellText</span><span class="p">);</span>
                         <span class="p">}</span>
-                        <span class="n">tmpStartColumn</span> <span class="o">+=</span> <span class="n">cell</span><span class="o">.</span><span class="n">getColumnSpannedNumber</span><span class="p">();</span>
+                        <span class="n">tmpStartColumn</span> <span class="o">+</span><span class="p">=</span> <span class="n">cell</span><span class="p">.</span><span class="n">getColumnSpannedNumber</span><span class="p">();</span>
                     <span class="p">}</span>
                 <span class="p">}</span>
             <span class="p">}</span>
         <span class="p">}</span>
-        <span class="n">startRow</span> <span class="o">+=</span> <span class="n">rowSpannedNumber</span><span class="p">;</span>
+        <span class="n">startRow</span> <span class="o">+</span><span class="p">=</span> <span class="n">rowSpannedNumber</span><span class="p">;</span>
     <span class="p">}</span>
 <span class="p">}</span>
 </pre></div>
 
 
-<p><strong>Download</strong> <br />
-</p>
+<p><strong>Download</strong>   </p>
 <p>Powered by Simple API version <a href="../downloads.html">0.4</a>.  <br />
-You can download the code of this demo from <a href="table_list_convertion.zip">here</a>. <br />
-</p>
+You can download the code of this demo from <a href="table_list_convertion.zip">here</a>.   </p>
   </div>
 
   <div id="footera">

Modified: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html Tue Apr 11 23:13:30 2017
@@ -50,7 +50,18 @@
   <div id="clear"></div>
   
   <div id="sidenav">
-    <h1 id="general">General</h1>
+    <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<h1 id="general">General<a class="headerlink" href="#general" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/index.html">About</a></li>
 <li><a href="/odftoolkit/downloads.html">Downloads</a></li>
@@ -58,21 +69,21 @@
 <li><a href="/odftoolkit/license.html">License</a></li>
 <li><a href="/odftoolkit/privacy.html">Privacy Policy</a></li>
 </ul>
-<h1 id="components">Components</h1>
+<h1 id="components">Components<a class="headerlink" href="#components" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/odfdom/index.html">ODFDOM</a></li>
 <li><a href="/odftoolkit/simple/index.html">Simple API</a></li>
 <li><a href="/odftoolkit/conformance/ODFValidator.html">ODF Validator</a></li>
 <li><a href="/odftoolkit/xsltrunner/ODFXSLTRunner.html">XSLT Runner</a></li>
 </ul>
-<h1 id="community">Community</h1>
+<h1 id="community">Community<a class="headerlink" href="#community" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/get-involved.html">Get Involved</a></li>
 <li><a href="/odftoolkit/mailing-lists.html">Mailing Lists</a></li>
 <li><a href="/odftoolkit/people.html">People</a></li>
 <li><a href="/odftoolkit/community-faqs.html">Community FAQs</a></li>
 </ul>
-<h1 id="development">Development</h1>
+<h1 id="development">Development<a class="headerlink" href="#development" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/source.html">Source Code</a></li>
 <li><a href="https://issues.apache.org/jira/browse/ODFTOOLKIT">Bug Tracker</a></li>
@@ -80,13 +91,12 @@
 <li><a href="/odftoolkit/website-local.html">Website</a></li>
 <li><a href="/odftoolkit/developer-faqs.html">Developer FAQs</a></li>
 </ul>
-<h1 id="ppmc">PPMC</h1>
+<h1 id="ppmc">PPMC<a class="headerlink" href="#ppmc" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="/odftoolkit/ppmc-faqs.html">PPMC FAQs</a></li>
-<li><a href="/odftoolkit/odftoolkit-release-guide.html">Release Guide</a> <br />
-</li>
+<li><a href="/odftoolkit/odftoolkit-release-guide.html">Release Guide</a>   </li>
 </ul>
-<h1 id="asf">ASF</h1>
+<h1 id="asf">ASF<a class="headerlink" href="#asf" title="Permanent link">&para;</a></h1>
 <ul>
 <li><a href="http://www.apache.org">Apache Software Foundation</a></li>
 <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
@@ -96,82 +106,79 @@
   <div id="contenta">
   
     
-    <p><strong><a href="index.html">Demos</a></strong> &gt;  <strong>Multiple Presentations Assembler</strong>  <br />
-</p>
-<p><strong>Overview</strong> <br />
-</p>
-<p>If you make a lot of presentations in your daily work, you  know that you don't always create a presentation from scratch.<br />
-</p>
+    <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<p><strong><a href="index.html">Demos</a></strong> &gt;  <strong>Multiple Presentations Assembler</strong>    </p>
+<p><strong>Overview</strong>   </p>
+<p>If you make a lot of presentations in your daily work, you  know that you don't always create a presentation from scratch.  </p>
 <p>Assembling several different presentations together to make a new presentation, e.g. copying several pages from presentation A and copying another several pages from presentation B, is a common activity for the presentation author.
-This demo provides a Java application that can assemble  specific pages of presentations together and make one presentation from the command line.   <br />
-</p>
-<p>Here is an example. I want to make a presentation with the first page from presentation A, the first page from presentation B and  the first page from presentation C. I can call the following command: <br />
-</p>
-<p><code>java PresentationAssembler -in PresentationA.odp(1) -in PresentationB.odp(1) -in PresentationC.odp(1-2) -out newPresentation.odp</code>   <br />
-</p>
-<p>A new presentation will be generated which is showed in the following picture. You can see, the pictures, the styles and master pages are copied too.<br />
-</p>
-<p><img alt="alt text" src="image/demo5_doc.jpg" /> <br />
-</p>
-<p>In the next section, I will show how easy it is to create this assembling application using the Simple API.<br />
-</p>
+This demo provides a Java application that can assemble  specific pages of presentations together and make one presentation from the command line.     </p>
+<p>Here is an example. I want to make a presentation with the first page from presentation A, the first page from presentation B and  the first page from presentation C. I can call the following command:   </p>
+<p><code>java PresentationAssembler -in PresentationA.odp(1) -in PresentationB.odp(1) -in PresentationC.odp(1-2) -out newPresentation.odp</code>     </p>
+<p>A new presentation will be generated which is showed in the following picture. You can see, the pictures, the styles and master pages are copied too.  </p>
+<p><img alt="alt text" src="image/demo5_doc.jpg" />   </p>
+<p>In the next section, I will show how easy it is to create this assembling application using the Simple API.  </p>
 <p><strong>Code Introduction</strong></p>
 <p><code>assemble</code> is the method that accepts the command line parameters, analyzes them, and assembles presentations with the Simple API. In this method, a new presentation is created, and then, pages from other presentation documents are attached while the command line is being analyzed. Simple API provides very simple methods to copy pages from other presentations:
 <code>PresentationDocument.copyForeignSlide(int destIndex, PresentationDocument srcDoc, int srcIndex)</code> and
-<code>PresentationDocument.appendPresentation(PresentationDocument srcDoc)</code>.  <br />
-</p>
-<p>After the slides are attached, the first slide of the new presentation is deleted by invoking method <code>PresentationDocument.deleteSlideByIndex(int index)</code>.  <br />
-</p>
-<p>This is because the first slide is an empty slide which was created when the new presentation was created with method <code>PresentationDocument.newPresentationDocument()</code> <br />
-</p>
-<p>Below is the source code of method <code>assemble</code>. Most of the code is used to analyze the command line parameters. Only a few statements are used to attach slides to the new presentation. So you can see how powerful functions Simple API provides.<br />
-</p>
-<div class="codehilite"><pre><span class="n">public</span> <span class="n">void</span> <span class="n">assemble</span><span class="p">(</span><span class="n">String</span><span class="o">[]</span> <span class="n">args</span><span class="p">)</span> <span class="n">throws</span> <span class="n">Exception</span>
+<code>PresentationDocument.appendPresentation(PresentationDocument srcDoc)</code>.    </p>
+<p>After the slides are attached, the first slide of the new presentation is deleted by invoking method <code>PresentationDocument.deleteSlideByIndex(int index)</code>.    </p>
+<p>This is because the first slide is an empty slide which was created when the new presentation was created with method <code>PresentationDocument.newPresentationDocument()</code>   </p>
+<p>Below is the source code of method <code>assemble</code>. Most of the code is used to analyze the command line parameters. Only a few statements are used to attach slides to the new presentation. So you can see how powerful functions Simple API provides.  </p>
+<div class="codehilite"><pre><span class="n">public</span> <span class="n">void</span> <span class="n">assemble</span><span class="p">(</span><span class="n">String</span><span class="p">[]</span> <span class="n">args</span><span class="p">)</span> <span class="n">throws</span> <span class="n">Exception</span>
 <span class="p">{</span>
-    <span class="n">String</span> <span class="n">outputFileName</span><span class="o">=</span><span class="s">&quot;default.odp&quot;</span><span class="p">;</span>
-    <span class="nb">int</span> <span class="n">pageIndex</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
-    <span class="n">PresentationDocument</span> <span class="n">doc</span> <span class="o">=</span> <span class="n">PresentationDocument</span><span class="o">.</span><span class="n">newPresentationDocument</span><span class="p">();</span>
-    <span class="nb">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span>
-    <span class="k">while</span> <span class="p">(</span><span class="n">i</span> <span class="o">&lt;</span> <span class="n">args</span><span class="o">.</span><span class="nb">length</span><span class="p">)</span>
+    <span class="n">String</span> <span class="n">outputFileName</span><span class="p">=</span>&quot;<span class="n">default</span><span class="p">.</span><span class="n">odp</span>&quot;<span class="p">;</span>
+    <span class="n">int</span> <span class="n">pageIndex</span> <span class="p">=</span> 1<span class="p">;</span>
+    <span class="n">PresentationDocument</span> <span class="n">doc</span> <span class="p">=</span> <span class="n">PresentationDocument</span><span class="p">.</span><span class="n">newPresentationDocument</span><span class="p">();</span>
+    <span class="n">int</span> <span class="nb">i</span><span class="p">=</span>0<span class="p">;</span>
+    <span class="k">while</span> <span class="p">(</span><span class="nb">i</span> <span class="o">&lt;</span> <span class="n">args</span><span class="p">.</span><span class="nb">length</span><span class="p">)</span>
     <span class="p">{</span>
-        <span class="n">String</span> <span class="n">param</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="n">i</span><span class="p">];</span>
-        <span class="k">if</span> <span class="p">(</span><span class="n">param</span><span class="o">.</span><span class="n">equals</span><span class="p">(</span><span class="s">&quot;-out&quot;</span><span class="p">))</span> <span class="sr">//g</span><span class="n">et</span> <span class="n">the</span> <span class="n">output</span> <span class="n">file</span> <span class="n">name</span>
-            <span class="n">outputFileName</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="o">++</span><span class="n">i</span><span class="p">];</span>
-        <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">param</span><span class="o">.</span><span class="n">equals</span><span class="p">(</span><span class="s">&quot;-in&quot;</span><span class="p">))</span> <span class="sr">//g</span><span class="n">et</span> <span class="n">the</span> <span class="n">input</span> <span class="n">file</span> <span class="n">name</span> 
+        <span class="n">String</span> <span class="n">param</span> <span class="p">=</span> <span class="n">args</span><span class="p">[</span><span class="nb">i</span><span class="p">];</span>
+        <span class="k">if</span> <span class="p">(</span><span class="n">param</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span>&quot;<span class="o">-</span><span class="n">out</span>&quot;<span class="p">))</span> <span class="o">//</span><span class="n">get</span> <span class="n">the</span> <span class="n">output</span> <span class="n">file</span> <span class="n">name</span>
+            <span class="n">outputFileName</span> <span class="p">=</span> <span class="n">args</span><span class="p">[</span><span class="o">++</span><span class="nb">i</span><span class="p">];</span>
+        <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">param</span><span class="p">.</span><span class="n">equals</span><span class="p">(</span>&quot;<span class="o">-</span><span class="n">in</span>&quot;<span class="p">))</span> <span class="o">//</span><span class="n">get</span> <span class="n">the</span> <span class="n">input</span> <span class="n">file</span> <span class="n">name</span> 
         <span class="p">{</span>
-            <span class="n">String</span> <span class="n">pageDesc</span> <span class="o">=</span> <span class="n">args</span><span class="p">[</span><span class="o">++</span><span class="n">i</span><span class="p">];</span>
-            <span class="n">String</span> <span class="n">filename</span> <span class="o">=</span> <span class="n">pageDesc</span><span class="p">,</span> <span class="n">pagelist</span><span class="p">;</span>
-            <span class="nb">int</span> <span class="n">indexStart</span> <span class="o">=</span> <span class="n">pageDesc</span><span class="o">.</span><span class="n">indexOf</span><span class="p">(</span><span class="s">&#39;(&#39;</span><span class="p">);</span> <span class="sr">//g</span><span class="n">et</span> <span class="n">the</span> <span class="n">page</span> <span class="n">numbers</span>
-            <span class="nb">int</span><span class="o">[]</span> <span class="n">srcPages</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span>
-            <span class="k">if</span> <span class="p">(</span><span class="n">indexStart</span> <span class="o">&gt;</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
+            <span class="n">String</span> <span class="n">pageDesc</span> <span class="p">=</span> <span class="n">args</span><span class="p">[</span><span class="o">++</span><span class="nb">i</span><span class="p">];</span>
+            <span class="n">String</span> <span class="n">filename</span> <span class="p">=</span> <span class="n">pageDesc</span><span class="p">,</span> <span class="n">pagelist</span><span class="p">;</span>
+            <span class="n">int</span> <span class="n">indexStart</span> <span class="p">=</span> <span class="n">pageDesc</span><span class="p">.</span><span class="n">indexOf</span><span class="p">(</span><span class="s">&#39;(&#39;</span><span class="p">);</span> <span class="o">//</span><span class="n">get</span> <span class="n">the</span> <span class="n">page</span> <span class="n">numbers</span>
+            <span class="n">int</span><span class="p">[]</span> <span class="n">srcPages</span> <span class="p">=</span> <span class="n">null</span><span class="p">;</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">indexStart</span> <span class="o">&gt;</span> <span class="o">-</span>1<span class="p">)</span>
             <span class="p">{</span>
-                <span class="n">filename</span> <span class="o">=</span> <span class="n">pageDesc</span><span class="o">.</span><span class="n">substring</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">indexStart</span><span class="p">);</span>
-                <span class="n">pagelist</span> <span class="o">=</span> <span class="n">pageDesc</span><span class="o">.</span><span class="n">substring</span><span class="p">(</span><span class="n">indexStart</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">pageDesc</span><span class="o">.</span><span class="nb">length</span><span class="p">()</span><span class="o">-</span><span class="mi">1</span><span class="p">);</span>
-                <span class="n">srcPages</span> <span class="o">=</span> <span class="n">getPageNumbers</span><span class="p">(</span><span class="n">pagelist</span><span class="p">);</span> <span class="sr">//</span><span class="n">analysis</span> <span class="n">the</span> <span class="n">page</span> <span class="n">number</span> <span class="n">description</span> 
-                                                     <span class="sr">//</span><span class="ow">and</span> <span class="k">return</span> <span class="n">all</span> <span class="n">page</span> <span class="n">numbers</span> <span class="n">that</span> <span class="n">need</span> <span class="n">to</span> <span class="n">be</span> <span class="n">copied</span>
+                <span class="n">filename</span> <span class="p">=</span> <span class="n">pageDesc</span><span class="p">.</span><span class="n">substring</span><span class="p">(</span>0<span class="p">,</span> <span class="n">indexStart</span><span class="p">);</span>
+                <span class="n">pagelist</span> <span class="p">=</span> <span class="n">pageDesc</span><span class="p">.</span><span class="n">substring</span><span class="p">(</span><span class="n">indexStart</span><span class="o">+</span>1<span class="p">,</span> <span class="n">pageDesc</span><span class="p">.</span><span class="nb">length</span><span class="p">()</span><span class="o">-</span>1<span class="p">);</span>
+                <span class="n">srcPages</span> <span class="p">=</span> <span class="n">getPageNumbers</span><span class="p">(</span><span class="n">pagelist</span><span class="p">);</span> <span class="o">//</span><span class="n">analysis</span> <span class="n">the</span> <span class="n">page</span> <span class="n">number</span> <span class="n">description</span> 
+                                                     <span class="o">//</span><span class="n">and</span> <span class="k">return</span> <span class="n">all</span> <span class="n">page</span> <span class="n">numbers</span> <span class="n">that</span> <span class="n">need</span> <span class="n">to</span> <span class="n">be</span> <span class="n">copied</span>
             <span class="p">}</span>
-            <span class="n">PresentationDocument</span> <span class="n">sourceDoc</span> <span class="o">=</span> <span class="n">PresentationDocument</span><span class="o">.</span><span class="n">loadDocument</span><span class="p">(</span><span class="k">new</span> <span class="n">File</span><span class="p">(</span><span class="n">filename</span><span class="p">));</span>
+            <span class="n">PresentationDocument</span> <span class="n">sourceDoc</span> <span class="p">=</span> <span class="n">PresentationDocument</span><span class="p">.</span><span class="n">loadDocument</span><span class="p">(</span><span class="n">new</span> <span class="n">File</span><span class="p">(</span><span class="n">filename</span><span class="p">));</span>
             <span class="k">if</span> <span class="p">(</span><span class="n">srcPages</span><span class="o">==</span><span class="n">null</span><span class="p">)</span>
             <span class="p">{</span>
-                <span class="n">doc</span><span class="o">.</span><span class="n">appendPresentation</span><span class="p">(</span><span class="n">sourceDoc</span><span class="p">);</span>
-                <span class="n">pageIndex</span> <span class="o">+=</span> <span class="n">sourceDoc</span><span class="o">.</span><span class="n">getSlideCount</span><span class="p">();</span>
-            <span class="p">}</span> <span class="k">else</span> <span class="k">for</span><span class="p">(</span><span class="nb">int</span> <span class="n">j</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span><span class="n">j</span> <span class="o">&lt;</span> <span class="n">srcPages</span><span class="o">.</span><span class="nb">length</span><span class="p">;</span><span class="n">j</span><span class="o">++</span><span class="p">)</span>
+                <span class="n">doc</span><span class="p">.</span><span class="n">appendPresentation</span><span class="p">(</span><span class="n">sourceDoc</span><span class="p">);</span>
+                <span class="n">pageIndex</span> <span class="o">+</span><span class="p">=</span> <span class="n">sourceDoc</span><span class="p">.</span><span class="n">getSlideCount</span><span class="p">();</span>
+            <span class="p">}</span> <span class="k">else</span> <span class="k">for</span><span class="p">(</span><span class="n">int</span> <span class="nb">j</span><span class="p">=</span>0<span class="p">;</span><span class="nb">j</span> <span class="o">&lt;</span> <span class="n">srcPages</span><span class="p">.</span><span class="nb">length</span><span class="p">;</span><span class="nb">j</span><span class="o">++</span><span class="p">)</span>
             <span class="p">{</span>
-                <span class="n">doc</span><span class="o">.</span><span class="n">copyForeignSlide</span><span class="p">(</span><span class="n">pageIndex</span><span class="p">,</span> <span class="n">sourceDoc</span><span class="p">,</span> <span class="n">srcPages</span><span class="p">[</span><span class="n">j</span><span class="p">]);</span>
+                <span class="n">doc</span><span class="p">.</span><span class="n">copyForeignSlide</span><span class="p">(</span><span class="n">pageIndex</span><span class="p">,</span> <span class="n">sourceDoc</span><span class="p">,</span> <span class="n">srcPages</span><span class="p">[</span><span class="nb">j</span><span class="p">]);</span>
                 <span class="n">pageIndex</span><span class="o">++</span><span class="p">;</span>
             <span class="p">}</span>
         <span class="p">}</span>
-        <span class="n">i</span><span class="o">++</span><span class="p">;</span>
+        <span class="nb">i</span><span class="o">++</span><span class="p">;</span>
     <span class="p">}</span>
-    <span class="n">doc</span><span class="o">.</span><span class="n">deleteSlideByIndex</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
-    <span class="n">doc</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">outputFileName</span><span class="p">);</span>
-    <span class="n">doc</span><span class="o">.</span><span class="nb">close</span><span class="p">();</span>
+    <span class="n">doc</span><span class="p">.</span><span class="n">deleteSlideByIndex</span><span class="p">(</span>0<span class="p">);</span>
+    <span class="n">doc</span><span class="p">.</span><span class="n">save</span><span class="p">(</span><span class="n">outputFileName</span><span class="p">);</span>
+    <span class="n">doc</span><span class="p">.</span><span class="n">close</span><span class="p">();</span>
 <span class="p">}</span>
 </pre></div>
 
 
-<p><strong>Download</strong><br />
-</p>
+<p><strong>Download</strong>  </p>
 <p>Powered by the Simple Java API for ODF version  <a target="_new" href="../downloads.html">0.4.5</a>.<br />
 You can download the code of this demo from <a href="PresentationAssembler.zip">here</a>.</p>
   </div>



Mime
View raw message