incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r795089 [1/3] - in /websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo: demo10.html demo2.html demo3.html demo4.html demo5.html demo6.html demo7.html demo8.html demo9.html index.html
Date Thu, 01 Sep 2011 10:05:27 GMT
Author: buildbot
Date: Thu Sep  1 10:05:27 2011
New Revision: 795089

Log:
Staging update by buildbot

Modified:
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo10.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo2.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo3.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo4.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo5.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo6.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo7.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo8.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo9.html
    websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/index.html

Modified: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo10.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo10.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo10.html Thu Sep  1 10:05:27 2011
@@ -21,38 +21,8 @@
 
 <link href="/odftoolkit/css/odf.css" rel="stylesheet" type="text/css">
 
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="stylesheet" href="../images/style.css" type="text/css" />
-<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
-<title>Demos - SimpleODF</title>
-<style type="text/css">
-<!--

-.STYLE1 {

-	color: #FFFFFF;

-	font-size: 24px;

-}

-.STYLE2 {font-size: 32px}

-.STYLE3 {font-size: 16px}

-.STYLE4 {font-size: 36px}

--->
-</style>
-<script type="text/javascript" src="scripts/shCore.js"></script>  
-<script type="text/javascript" src="scripts/shBrushJava.js"></script>  
-<script type="text/javascript"> SyntaxHighlighter.all();</script>
-<script type="text/javascript">
-  var _gaq = _gaq || [];

-  _gaq.push(['_setAccount', 'UA-22366020-1']);

-  _gaq.push(['_trackPageview']);

-

-  (function() {

-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

-  })();

-

-</script>
-
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
 </head>
 
@@ -66,124 +36,218 @@
   </div>
   <div id="clear"></div>
   
-  <div id="content">
+  <div id="sidenav">
+    <h1 id="general">General</h1>
+<ul>
+<li><a href="/odftoolkit/index.html">About</a></li>
+<li><a href="http://incubator.apache.org/projects/odftoolkit.html">Incubator page</a></li>
+<li><a href="/odftoolkit/license.html">License</a></li>
+</ul>
+<h1 id="components">Components</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">Conformance Tools</a></li>
+<li><a href="/odftoolkit/xsltrunner/ODFXSLTRunner.html">XSLT Runner</a></li>
+</ul>
+<h1 id="community">Community</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>
+<ul>
+<li><a href="/odftoolkit/source.html">Source Code</a></li>
+<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>
+<ul>
+<li><a href="/odftoolkit/ppmc-faqs.html">PPMC FAQs</a><br />
+</li>
+</ul>
+<h1 id="asf">ASF</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>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+</ul>
+  </div>
+  <div id="contenta">
   
     
-    
-<div id="page" align="center">
-<div id="content" style="width:920px" class="contentpanel">
-<div id="topheader">
-    <div class="topright"> </div>
-</div>
-<div id="menu">
-<div align="left" class="smallwhitetext"> <a href="../index.html" class="home"> </a> <a href="../downloads.html" class="download"></a> <a href="../documents.html" class="document"></a> <a href="../demo/index.html" class="sample"> </a> </div>
-</div>
-<div id="subcontent" align ="left">
-        <div align="left" class="titletext"> <span>
-		<a href="index.html">Simple Demos<a> > 
-		<a href="demo10.html">Demo 9: Automatically Formatting a Document<a>
-	</span> 
-</div>
-<!---------------------------------------------------------------------------------------------------->	
-<div class="contenttitle">
-    <a name="overview">Overview</a>
-</div>
-<div class="bodytext">
-    <p>
	The Simple Java API for ODF has enhanced features to support document formatting in version 0.6.5. It supplies methods for manipulating headings, page breaks, hyperlinks, comments, font and alignment. This demo shows how to use these features to help document formatting.<br/><br/>
	It's a common scenario that we need apply some  styles to plain text to improve its appearance. In this demo, a text document is created using plain text from a text file. While reading content, paragraphs whose  length  is less than 20 characters are changed to headings with a new font style. "Version" and "date" information is  set as right alignment and gray text. Each line which matches an URL  will be applied as a hyperlink. Each heading and its following paragraphs are considered as a chapter. There will be a page break after page line count larger than a predefined value. Then verify word spelling and add comments as tip to those which may have a spelling mistake. The last one is a security check. After these processes, the plain text has been changed into a formatted document.<br/><br/>
	This picture shows part of the generated document. The new document looks orderly and beautiful than before.<br/><br/>
-	<img src="image/demo10.png"></img><br/><br/>
-	</p>
-</div>
-<hr/>
-<div class="contenttitle">
-    <a name="codeintroduction">Code Introduction</a>
-</div>
-<div class="bodytext">
-    <p>
-	There code of this demo is very clear. Firstly, we open the data source and create a text document. Secondly, we create paragraph for each line. Thirdly, we set different style for different content. Then we do spell and security check with the help of Navigation API. Comments are given if suspicious words are found.  Finally, the new created document is saved. <br/><br/>
-    <!--java code-->
-    <pre class="brush:java;">
-	    BufferedReader reader = new BufferedReader(new InputStreamReader(FormatParagraphDemo.class.getResourceAsStream("text.txt")));
-		String in = reader.readLine();
-		TextDocument doc = TextDocument.newTextDocument();
-		int lineCount = 0;
-		int pageLineCount = 0;
-		Paragraph refParagraph = null;
-		while (in != null) {
-			in = in.trim();
-			Paragraph paragraph = doc.addParagraph(in);
-			lineCount++;
-			pageLineCount++;
-			switch (lineCount) {
-			case 1:
-				paragraph
-						.setHorizontalAlignment(HorizontalAlignmentType.CENTER);
-				paragraph.setFont(new Font("Arial", FontStyle.BOLD, 16));
-				paragraph.applyHeading();
-				break;
-			case 2:
-			case 3:
-				paragraph.setHorizontalAlignment(HorizontalAlignmentType.RIGHT);
-				paragraph.setFont(new Font("Tahoma", FontStyle.ITALIC, 10,
-						Color.GRAY));
-				break;
-			default:
-				if (in.startsWith("http://")) {
-					paragraph.applyHyperlink(new URI(in));
-				}
-				if (in.length() < 20) {
-					paragraph.applyHeading();
-					paragraph.setFont(new Font("Arial", FontStyle.BOLD, 12));
-					if (pageLineCount > 16) {
-						doc.addPageBreak(refParagraph);
-						pageLineCount = 0;
-					}
-				}
-			}
-			refParagraph = paragraph;
-			in = reader.readLine();
-
-		}
-		// spell check
-		TextNavigation navigation1 = new TextNavigation("lower-level", doc);
-		while (navigation1.hasNext()) {
-			TextSelection selection = (TextSelection) navigation1
-					.nextSelection();
-			selection.addComment(
-					"Please change 'lower-level' with 'lower level'.",
-					"SpellChecker");
-		}
-		// security check
-		TextNavigation navigation2 = new TextNavigation("confidential", doc);
-		if (navigation2.hasNext()) {
-			TextSelection selection = (TextSelection) navigation2
-					.nextSelection();
-			selection
-					.addComment(
-							"This is a confidential document, please don't redistribute.",
-							"SecurityChecker");
-		}
-		doc.save("format_text.odt");
-    </pre>
-</p>
-</div>
-<hr/>
-<div class="contenttitle">
-    <a name="download">Download</a>
-</div>
-<div class="bodytext">
-  <p>
-    Powered by the Simple Java API for ODF version  <a target="_new" href="../downloads.html"><img src="../images/link.png"></img>0.6.5</a>.
-  </p>
-  <p>
-    You can download the code of this demo from <a href="demo10.zip"><img src="../images/link.png"></img>here</a>.
-  </p>
</div>
-<!---------------------------------------------------------------------------------------------------->		
-</div>
-<div id="footer" class="smallgraytext"> <a href="#">Home</a> | <a href="#">About Us</a> | <a href="#">Contact Us</a> </div>
-</div>
-</div>
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="stylesheet" href="../images/style.css" type="text/css" />
+<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
+<title>Demos - SimpleODF</title>
+<style type="text/css">
+<!--
+
+.STYLE1 {
+
+color: #FFFFFF;
+
+font-size: 24px;
+
+}
+
+.STYLE2 {font-size: 32px}
+
+.STYLE3 {font-size: 16px}
+
+.STYLE4 {font-size: 36px}
+
+-->
+</style>
+<script type="text/javascript" src="scripts/shCore.js"></script>  
+<script type="text/javascript" src="scripts/shBrushJava.js"></script>  
+<script type="text/javascript"> SyntaxHighlighter.all();</script>
+<script type="text/javascript">
+  var _gaq = _gaq || [];
 
+_gaq.push(['_setAccount', 'UA-22366020-1']);
 
+_gaq.push(['_trackPageview']);
+
+(function() {
+
+var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+
+ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+
+var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+
+})();
+
+</script>
+</head>
+<body>
+<div id="page" align="center">
+<div id="content" style="width:920px" class="contentpanel">
+<div id="topheader">
+    <div class="topright"> </div>
+</div>
+<div id="menu">
+<div align="left" class="smallwhitetext"> <a href="../index.html" class="home"> </a> <a href="../downloads.html" class="download"></a> <a href="../documents.html" class="document"></a> <a href="../demo/index.html" class="sample"> </a> </div>
+</div>
+<div id="subcontent" align ="left">
+        <div align="left" class="titletext"> <span>
+        <a href="index.html">Simple Demos<a> > 
+        <a href="demo10.html">Demo 9: Automatically Formatting a Document<a>
+    </span> 
+</div>
+<!----------------------------------------------------------------------------------------------------> 
+<div class="contenttitle">
+    <a name="overview">Overview</a>
+</div>
+<div class="bodytext">
+    <p>
+    The Simple Java API for ODF has enhanced features to support document formatting in version 0.6.5. It supplies methods for manipulating headings, page breaks, hyperlinks, comments, font and alignment. This demo shows how to use these features to help document formatting.<br/><br/>
+    It's a common scenario that we need apply some  styles to plain text to improve its appearance. In this demo, a text document is created using plain text from a text file. While reading content, paragraphs whose  length  is less than 20 characters are changed to headings with a new font style. "Version" and "date" information is  set as right alignment and gray text. Each line which matches an URL  will be applied as a hyperlink. Each heading and its following paragraphs are considered as a chapter. There will be a page break after page line count larger than a predefined value. Then verify word spelling and add comments as tip to those which may have a spelling mistake. The last one is a security check. After these processes, the plain text has been changed into a formatted document.<br/><br/>
+    This picture shows part of the generated document. The new document looks orderly and beautiful than before.<br/><br/>
+    <img src="image/demo10.png"></img><br/><br/>
+    </p>
+</div>
+<hr/>
+<div class="contenttitle">
+    <a name="codeintroduction">Code Introduction</a>
+</div>
+<div class="bodytext">
+    <p>
+    There code of this demo is very clear. Firstly, we open the data source and create a text document. Secondly, we create paragraph for each line. Thirdly, we set different style for different content. Then we do spell and security check with the help of Navigation API. Comments are given if suspicious words are found.  Finally, the new created document is saved. <br/><br/>
+    <!--java code-->
+    <pre class="brush:java;">
+        BufferedReader reader = new BufferedReader(new InputStreamReader(FormatParagraphDemo.class.getResourceAsStream("text.txt")));
+        String in = reader.readLine();
+        TextDocument doc = TextDocument.newTextDocument();
+        int lineCount = 0;
+        int pageLineCount = 0;
+        Paragraph refParagraph = null;
+        while (in != null) {
+            in = in.trim();
+            Paragraph paragraph = doc.addParagraph(in);
+            lineCount++;
+            pageLineCount++;
+            switch (lineCount) {
+            case 1:
+                paragraph
+                        .setHorizontalAlignment(HorizontalAlignmentType.CENTER);
+                paragraph.setFont(new Font("Arial", FontStyle.BOLD, 16));
+                paragraph.applyHeading();
+                break;
+            case 2:
+            case 3:
+                paragraph.setHorizontalAlignment(HorizontalAlignmentType.RIGHT);
+                paragraph.setFont(new Font("Tahoma", FontStyle.ITALIC, 10,
+                        Color.GRAY));
+                break;
+            default:
+                if (in.startsWith("http://")) {
+                    paragraph.applyHyperlink(new URI(in));
+                }
+                if (in.length() < 20) {
+                    paragraph.applyHeading();
+                    paragraph.setFont(new Font("Arial", FontStyle.BOLD, 12));
+                    if (pageLineCount > 16) {
+                        doc.addPageBreak(refParagraph);
+                        pageLineCount = 0;
+                    }
+                }
+            }
+            refParagraph = paragraph;
+            in = reader.readLine();
+
+<div class="codehilite"><pre>    <span class="p">}</span>
+    <span class="sr">//</span> <span class="n">spell</span> <span class="n">check</span>
+    <span class="n">TextNavigation</span> <span class="n">navigation1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TextNavigation</span><span class="p">(</span><span class="s">&quot;lower-level&quot;</span><span class="p">,</span> <span class="n">doc</span><span class="p">);</span>
+    <span class="k">while</span> <span class="p">(</span><span class="n">navigation1</span><span class="o">.</span><span class="n">hasNext</span><span class="p">())</span> <span class="p">{</span>
+        <span class="n">TextSelection</span> <span class="n">selection</span> <span class="o">=</span> <span class="p">(</span><span class="n">TextSelection</span><span class="p">)</span> <span class="n">navigation1</span>
+                <span class="o">.</span><span class="n">nextSelection</span><span class="p">();</span>
+        <span class="n">selection</span><span class="o">.</span><span class="n">addComment</span><span class="p">(</span>
+                <span class="s">&quot;Please change &#39;lower-level&#39; with &#39;lower level&#39;.&quot;</span><span class="p">,</span>
+                <span class="s">&quot;SpellChecker&quot;</span><span class="p">);</span>
+    <span class="p">}</span>
+    <span class="sr">//</span> <span class="n">security</span> <span class="n">check</span>
+    <span class="n">TextNavigation</span> <span class="n">navigation2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">TextNavigation</span><span class="p">(</span><span class="s">&quot;confidential&quot;</span><span class="p">,</span> <span class="n">doc</span><span class="p">);</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">navigation2</span><span class="o">.</span><span class="n">hasNext</span><span class="p">())</span> <span class="p">{</span>
+        <span class="n">TextSelection</span> <span class="n">selection</span> <span class="o">=</span> <span class="p">(</span><span class="n">TextSelection</span><span class="p">)</span> <span class="n">navigation2</span>
+                <span class="o">.</span><span class="n">nextSelection</span><span class="p">();</span>
+        <span class="n">selection</span>
+                <span class="o">.</span><span class="n">addComment</span><span class="p">(</span>
+                        <span class="s">&quot;This is a confidential document, please don&#39;t redistribute.&quot;</span><span class="p">,</span>
+                        <span class="s">&quot;SecurityChecker&quot;</span><span class="p">);</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="s">&quot;format_text.odt&quot;</span><span class="p">);</span>
+<span class="sr">&lt;/pre&gt;</span>
+</pre></div>
+
+
+<p></p>
+</div>
+<hr/>
+<div class="contenttitle">
+    <a name="download">Download</a>
+</div>
+<div class="bodytext">
+  <p>
+    Powered by the Simple Java API for ODF version  <a target="_new" href="../downloads.html"><img src="../images/link.png"></img>0.6.5</a>.
+  </p>
+  <p>
+    You can download the code of this demo from <a href="demo10.zip"><img src="../images/link.png"></img>here</a>.
+  </p>
+</div>
+<!---------------------------------------------------------------------------------------------------->   <br />
+</div>
+<div id="footer" class="smallgraytext"> <a href="#">Home</a> | <a href="#">About Us</a> | <a href="#">Contact Us</a> </div>
+</div>
+</div>
+</body>
+</html> </p>
   </div>
 
   <div id="footera">

Modified: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo2.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo2.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo2.html Thu Sep  1 10:05:27 2011
@@ -21,39 +21,8 @@
 
 <link href="/odftoolkit/css/odf.css" rel="stylesheet" type="text/css">
 
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="stylesheet" href="../images/style.css" type="text/css" />
-
-
-<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
-
-<title>Demos - SimpleODF</title>
-<style type="text/css">
-<!--
-.STYLE1 {
-	color: #FFFFFF;
-	font-size: 24px;
-}
-.STYLE2 {font-size: 32px}
-.STYLE3 {font-size: 16px}
-.STYLE4 {font-size: 36px}
--->
-    </style>
-	<script type="text/javascript">
-
-  var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-22366020-1']);
-  _gaq.push(['_trackPageview']);
-
-  (function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-  })();
-
-</script>
-
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
 </head>
 
@@ -67,390 +36,447 @@
   </div>
   <div id="clear"></div>
   
-  <div id="content">
+  <div id="sidenav">
+    <h1 id="general">General</h1>
+<ul>
+<li><a href="/odftoolkit/index.html">About</a></li>
+<li><a href="http://incubator.apache.org/projects/odftoolkit.html">Incubator page</a></li>
+<li><a href="/odftoolkit/license.html">License</a></li>
+</ul>
+<h1 id="components">Components</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">Conformance Tools</a></li>
+<li><a href="/odftoolkit/xsltrunner/ODFXSLTRunner.html">XSLT Runner</a></li>
+</ul>
+<h1 id="community">Community</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>
+<ul>
+<li><a href="/odftoolkit/source.html">Source Code</a></li>
+<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>
+<ul>
+<li><a href="/odftoolkit/ppmc-faqs.html">PPMC FAQs</a><br />
+</li>
+</ul>
+<h1 id="asf">ASF</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>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+</ul>
+  </div>
+  <div id="contenta">
   
     
-    
-<div id="page" align="center">
-  <div id="content" style="width:920px" class="contentpanel">
-    <div id="topheader">
-      <div class="topright"> </div>
-    </div>
-    <div id="menu">
-      <div align="left" class="smallwhitetext"> <a href="../index.html" class="home"> </a> <a href="../downloads.html" class="download"></a> <a href="../documents.html" class="document"></a> <a href="../demo/index.html" class="sample"> </a> </div>
-    </div>
-    <div id="subcontent" align ="left">
-        <div align="left" class="titletext"> <span >
-		<a href="index.html">Simple Demos<a> > 
-		<a href="demo2.html">Demo 1: Persentation Extraction and Combination<a>
-		</span> 
-		</div>
-		
-		<!---------------------------------------------------------------------------------------------------->	
-<div class="contenttitle">
-
-<a name="overview">Overview of Presentation Combination</a>
-
-</div>
-
-<div class="bodytext">
-
-<p>To show the operation of Presentation in Simple API, the Presentation Codmbination demo 
-
-is used which combine two independent presentation documents together and extract the notes
-
- of each slide out to a Text document. 
-
-</p>
-
-<p>
-
-Here the original presentation documents "Pres1.odp" and "Pres2.odp" are used. Pres1.odp presents some basic concepts of XML and Pres2.odp presents some basic aspects of HTML. Both of them have their own cover page with the same slide name "Cover" at the front and an End page with the same slide name "end" at the end of the document. To combine these two presentation documents together, the following steps are used here.
-
- <ol>
-
- <li>Delete the last page of "Pres1.odp".</li>
-
- <li>Change the slide name of the cover page for each presentation document.</li>
-
- <li>Append "Pres2.odp" to the end of "Pres1.odp".</li>
-
- <li>Add a new slide at the front of the combined presentation document as the new cover page.</li>
-
- <li>Add title and notes to the new cover page.</li>
-
- <li>Extract the notes from each slide in the presentation document and save them into a text document.</li>
-
- <li>Save the combined document and the text document.</li>
-
- </ol>
-
-</p>
-
-<p>
-
-The contents of the text document which contains the notes of the presentation document
-
-is shown in the following picture, where each note is identified by the corresponding slide name.
-
-<br/>
-
-<img src="image/ExtractedNotes.JPG" >
-
-</p>
-
-</div>
-
-<hr/>
-
-<div class="contenttitle">
-
-<a name="codeintroduction">Code Introduction</a>
-
-</div>
-
-<div class="bodytext">
-
-<p> 
-
-To generate this sample, the Presentation and Text package in Simple API 
-
-will be used. The related operations contains: load the existing presentation document, 
-
-append one presentation to the end of another one, delete slide in the presentation, add 
-
-new slide in the presentation, get certain slide in the presentation, add new notes to 
-
-the slide, create a new text document, add new paragraph in the text document, etc.
-
-</p>
-
-
-
-<p>
-
-Seven functions exist in the resource: main(), Getpresentation(), ProcSlide(),
-
- titleofExtractnotes(), ExtractNotes(), FillExtractnotes() and saveDocument(). Each of them
-
- will be explained briefly in the following paragraphs.
-
-</p>
-
-
-
-<p>
-
-First three variables should be used to hold the two presentation document
-
-and the text document.
-
-<!--java code-->
-
-<pre class="brush:java;">
-
-PresentationDocument presentationdoc;
-
-PresentationDocument presentationdoc2;
-
-TextDocument Extractednotes;
-
-</pre>
-
-</p>
-
-
-
-<p>
-
-In function Getpresentation(), the two presentation documents are loaded so that 
-
-they can be operated by Simple API, and the text document is created to save the extracted notes.
-
-The codes are shown below:
-
-<!--java code-->
-
-<pre class="brush:java;">  
-
-public void Getpresentation() {
-
-	try {
-
-		presentationdoc=PresentationDocument.loadDocument("Pres1.odp");		
-
-		presentationdoc2=PresentationDocument.loadDocument("Pres2.odp");  
-
-	} catch (Exception e) {
-
-		System.err.println("Unable to load document.");
-
-		System.err.println(e.getMessage());  
-
-	}
-
-	try{
-
-	Extractednotes=TextDocument.newTextDocument();			
-
-	}
-
-	catch (Exception e) {
-
-		System.err.println("Unable to create text document.");
-
-    	System.err.println(e.getMessage());  
-
-	}
-
-}
-
-</pre> 
-
-</p>
-
-
-
-<p>
-
-In function ProcSlide(), five main operations are used to process the document: 
-
-delete extra slide (deleteSlideByIndex, deleteSlideByName), change slide name (setSlideName),
-
-combine these two presentations together (appendPresentation), add a new cover for the new 
-
-combined document (newSlide), add title and notes for the new slide. Here the function 
-
-getSlideCount() is used to get the slide number of the specified presentation document,
-
-getSlideByName()and getSlideByIndex() are used to get the specified slide, getNotesPage() 
-
-and setTextContent() are used to add notes for the added slide. In order to add text to the 
-
-title frame, a DrawTextBoxElement should be used to get the editable component.
-
-The codes are shown below:
-
-<!--java code-->
-
-<pre class="brush:java;">  
-
-Slide slide;
-
-Notes notes;
-
-int count=presentationdoc.getSlideCount();
-
-presentationdoc.deleteSlideByIndex(count-1);	
-
-//presentationdoc.deleteSlideByName("end");
-
-slide=presentationdoc.getSlideByIndex(0);
-
-slide.setSlideName("XML Cover");
-
-slide=presentationdoc2.getSlideByName("Cover");
-
-slide.setSlideName("HTML Cover");
-
-presentationdoc.appendPresentation(presentationdoc2);
-
-slide=presentationdoc.newSlide(0, "Cover", SlideLayout.TITLE_ONLY);	
-
-notes=slide.getNotesPage();
-
-notes.addText("This is the cover of the new presentation document");
-
-DrawTextBoxElement textbox=(DrawTextBoxElement)slide.getOdfElement().getFirstChild().getFirstChild();
-
-textbox.newTextPElement().setTextContent("Combined Presentation");
-
-</pre> 
-
-</p>
-
-
-
-<p>
-
-In function titleofExtractnotes(), the title of the text document which is used 
-
-to save the notes of each slide is added. And in function ExtractNotes(), the notes of each slide
-
- will be extracted (getTextContent), the function FillExtractnotes() will be called if the 
-
- notes exists. Here function getSlideByIndex() is used to obtain the corresponding slide, 
-
- getSlideName() is used to obtain the name of the specified slide in order to identify the notes.
-
- The codes are shown below:
-
-<!--java code-->
-
-<pre class="brush:java;">  
-
-slide=presentationdoc.getSlideByIndex(i);
-
-String slidename=slide.getSlideName();
-
-notes=slide.getNotesPage();	
-
-if(!notes.getOdfElement().getTextContent().isEmpty())
-
-{
-
-	String notestring=notes.getOdfElement().getTextContent().toString().trim();
-
-	FillExtractnotes(notestring,slidename);
-
-}
-
-
-
-</pre> 
-
-</p>
-
-
-
-<p>
-
-In function FillExtractnotes, the notes will be added to the text document. Here the slide
-
-name is used as the identity and is followed by the corresponding notes, function newParagraph() 
-
-is used to add a new paragraph in the text document. The codes are shown below:
-
-<!--java code-->
-
-<pre class="brush:java;">  
-
-OdfTextParagraph para =Extractednotes.newParagraph();
-
-para.setProperty(OdfParagraphProperties.MarginTop, "0.25cm");
-
-para.setTextContent("Notes of "+slidename+":");				
-
-para=Extractednotes.newParagraph();
-
-para.setProperty(OdfParagraphProperties.TextAlign,"justify");
-
-para.setTextContent("  "+notestext);
-
-</pre> 
-
-</p>
-
-
-
-<p>
-
-In function saveDocument(), the new combined presentation document and the text document
-
-which contains the notes will be saved. The codes are shown below:
-
-<!--java code-->
-
-<pre class="brush:java;">  
-
-public void saveDocument(){ 	
-
-   try
-
-   {
-
-	   presentationdoc.save("Presentationsample.odp");
-
-	   presentationdoc.close();
-
-	   Extractednotes.save("Extractednotes.odt");
-
-	   Extractednotes.close();
-
-   }
-
-   catch(Exception e){
-
-	   System.err.println("Unable to save document.");
-
-       System.err.println(e.getMessage());  
-
-   }	   
-
-}
-
-</pre> 
-
-</p>
-
-
-
-</div>
-
-<hr/>
-
-
-
-<div class="contenttitle"><a name="download">Download</a></div>
-
-<div class="bodytext">
-
-<p> Powered by Simple API version <a target="_new" href="../downloads.html"><img src="../images/link.png"></img>0.3.5</a>.</p>
-
-<p> You can download the code of this sample from <a Href="PresentationCombination.zip"><img src="../images/link.png"></img>here</a>.</p>
-
-</div>
-
-<!---------------------------------------------------------------------------------------------------->		
-		
-		
-     
-    </div>
-    <div id="footer" class="smallgraytext"> <a href="../index.html">Home</a> | <a href="#">About Us</a> | <a href="mailto:Daisy@odftoolkit.org">Contact Us</a> </div>
-  </div>
-</div>
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="stylesheet" href="../images/style.css" type="text/css" />
+
+<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
+
+<title>Demos - SimpleODF</title>
+<style type="text/css">
+<!--
+.STYLE1 {
+    color: #FFFFFF;
+    font-size: 24px;
+}
+.STYLE2 {font-size: 32px}
+.STYLE3 {font-size: 16px}
+.STYLE4 {font-size: 36px}
+-->
+    </style>
+    <script type="text/javascript">
+
+var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-22366020-1']);
+  _gaq.push(['_trackPageview']);
+
+(function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+
+</script>
+</head>
+<body>
+<div id="page" align="center">
+  <div id="content" style="width:920px" class="contentpanel">
+    <div id="topheader">
+      <div class="topright"> </div>
+    </div>
+    <div id="menu">
+      <div align="left" class="smallwhitetext"> <a href="../index.html" class="home"> </a> <a href="../downloads.html" class="download"></a> <a href="../documents.html" class="document"></a> <a href="../demo/index.html" class="sample"> </a> </div>
+    </div>
+    <div id="subcontent" align ="left">
+        <div align="left" class="titletext"> <span >
+        <a href="index.html">Simple Demos<a> > 
+        <a href="demo2.html">Demo 1: Persentation Extraction and Combination<a>
+        </span> 
+        </div>
+
+<!----------------------------------------------------------------------------------------------------> 
+<div class="contenttitle">
+
+<a name="overview">Overview of Presentation Combination</a>
+
+</div>
+
+<div class="bodytext">
+
+<p>To show the operation of Presentation in Simple API, the Presentation Codmbination demo
+
+is used which combine two independent presentation documents together and extract the notes
+
+of each slide out to a Text document.
+
+</p>
+
+<p>
+
+Here the original presentation documents "Pres1.odp" and "Pres2.odp" are used. Pres1.odp presents some basic concepts of XML and Pres2.odp presents some basic aspects of HTML. Both of them have their own cover page with the same slide name "Cover" at the front and an End page with the same slide name "end" at the end of the document. To combine these two presentation documents together, the following steps are used here.
+
+<ol>
+
+<li>Delete the last page of "Pres1.odp".</li>
+
+<li>Change the slide name of the cover page for each presentation document.</li>
+
+<li>Append "Pres2.odp" to the end of "Pres1.odp".</li>
+
+<li>Add a new slide at the front of the combined presentation document as the new cover page.</li>
+
+<li>Add title and notes to the new cover page.</li>
+
+<li>Extract the notes from each slide in the presentation document and save them into a text document.</li>
+
+<li>Save the combined document and the text document.</li>
+
+</ol>
+
+</p>
+
+<p>
+
+The contents of the text document which contains the notes of the presentation document
+
+is shown in the following picture, where each note is identified by the corresponding slide name.
+
+<br/>
+
+<img src="image/ExtractedNotes.JPG" >
+
+</p>
+
+</div>
+
+<hr/>
+
+<div class="contenttitle">
+
+<a name="codeintroduction">Code Introduction</a>
+
+</div>
+
+<div class="bodytext">
+
+<p>
+
+To generate this sample, the Presentation and Text package in Simple API
+
+will be used. The related operations contains: load the existing presentation document,
+
+append one presentation to the end of another one, delete slide in the presentation, add
+
+new slide in the presentation, get certain slide in the presentation, add new notes to
+
+the slide, create a new text document, add new paragraph in the text document, etc.
+
+</p>
+
+<p>
+
+Seven functions exist in the resource: main(), Getpresentation(), ProcSlide(),
+
+titleofExtractnotes(), ExtractNotes(), FillExtractnotes() and saveDocument(). Each of them
+
+will be explained briefly in the following paragraphs.
+
+</p>
+
+<p>
+
+First three variables should be used to hold the two presentation document
+
+and the text document.
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+PresentationDocument presentationdoc;
+
+PresentationDocument presentationdoc2;
+
+TextDocument Extractednotes;
+
+</pre>
+
+</p>
+
+<p>
+
+In function Getpresentation(), the two presentation documents are loaded so that
+
+they can be operated by Simple API, and the text document is created to save the extracted notes.
+
+The codes are shown below:
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+public void Getpresentation() {
+
+try {
+
+presentationdoc=PresentationDocument.loadDocument("Pres1.odp");
+
+presentationdoc2=PresentationDocument.loadDocument("Pres2.odp");
+
+} catch (Exception e) {
+
+System.err.println("Unable to load document.");
+
+System.err.println(e.getMessage());
+
+}
+
+try{
+
+Extractednotes=TextDocument.newTextDocument();
+
+}
+
+catch (Exception e) {
+
+System.err.println("Unable to create text document.");
+
+System.err.println(e.getMessage());
+
+}
+
+}
+
+</pre>
+
+</p>
+
+<p>
+
+In function ProcSlide(), five main operations are used to process the document:
+
+delete extra slide (deleteSlideByIndex, deleteSlideByName), change slide name (setSlideName),
+
+combine these two presentations together (appendPresentation), add a new cover for the new
+
+combined document (newSlide), add title and notes for the new slide. Here the function
+
+getSlideCount() is used to get the slide number of the specified presentation document,
+
+getSlideByName()and getSlideByIndex() are used to get the specified slide, getNotesPage()
+
+and setTextContent() are used to add notes for the added slide. In order to add text to the
+
+title frame, a DrawTextBoxElement should be used to get the editable component.
+
+The codes are shown below:
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+Slide slide;
+
+Notes notes;
+
+int count=presentationdoc.getSlideCount();
+
+presentationdoc.deleteSlideByIndex(count-1);
+
+//presentationdoc.deleteSlideByName("end");
+
+slide=presentationdoc.getSlideByIndex(0);
+
+slide.setSlideName("XML Cover");
+
+slide=presentationdoc2.getSlideByName("Cover");
+
+slide.setSlideName("HTML Cover");
+
+presentationdoc.appendPresentation(presentationdoc2);
+
+slide=presentationdoc.newSlide(0, "Cover", SlideLayout.TITLE_ONLY);
+
+notes=slide.getNotesPage();
+
+notes.addText("This is the cover of the new presentation document");
+
+DrawTextBoxElement textbox=(DrawTextBoxElement)slide.getOdfElement().getFirstChild().getFirstChild();
+
+textbox.newTextPElement().setTextContent("Combined Presentation");
+
+</pre>
+
+</p>
+
+<p>
+
+In function titleofExtractnotes(), the title of the text document which is used
+
+to save the notes of each slide is added. And in function ExtractNotes(), the notes of each slide
+
+will be extracted (getTextContent), the function FillExtractnotes() will be called if the
+
+notes exists. Here function getSlideByIndex() is used to obtain the corresponding slide,
+
+getSlideName() is used to obtain the name of the specified slide in order to identify the notes.
+
+The codes are shown below:
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+slide=presentationdoc.getSlideByIndex(i);
+
+String slidename=slide.getSlideName();
+
+notes=slide.getNotesPage();
+
+if(!notes.getOdfElement().getTextContent().isEmpty())
+
+{
+
+String notestring=notes.getOdfElement().getTextContent().toString().trim();
+
+FillExtractnotes(notestring,slidename);
+
+}
+
+</pre>
+
+</p>
+
+<p>
+
+In function FillExtractnotes, the notes will be added to the text document. Here the slide
+
+name is used as the identity and is followed by the corresponding notes, function newParagraph()
+
+is used to add a new paragraph in the text document. The codes are shown below:
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+OdfTextParagraph para =Extractednotes.newParagraph();
+
+para.setProperty(OdfParagraphProperties.MarginTop, "0.25cm");
+
+para.setTextContent("Notes of "+slidename+":");
+
+para=Extractednotes.newParagraph();
+
+para.setProperty(OdfParagraphProperties.TextAlign,"justify");
+
+para.setTextContent("  "+notestext);
+
+</pre>
+
+</p>
+
+<p>
+
+In function saveDocument(), the new combined presentation document and the text document
+
+which contains the notes will be saved. The codes are shown below:
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+public void saveDocument(){
+
+try
+
+{
+
+presentationdoc.save("Presentationsample.odp");
+
+presentationdoc.close();
+
+Extractednotes.save("Extractednotes.odt");
+
+Extractednotes.close();
+
+}
+
+catch(Exception e){
+
+System.err.println("Unable to save document.");
+
+System.err.println(e.getMessage());
+
+}
+
+}
+
+</pre>
+
+</p>
+
+</div>
+
+<hr/>
+
+<div class="contenttitle"><a name="download">Download</a></div>
+
+<div class="bodytext">
+
+<p> Powered by Simple API version <a target="_new" href="../downloads.html"><img src="../images/link.png"></img>0.3.5</a>.</p>
+
+<p> You can download the code of this sample from <a Href="PresentationCombination.zip"><img src="../images/link.png"></img>here</a>.</p>
+
+</div>
+
+<!---------------------------------------------------------------------------------------------------->
+
+</div>
+    <div id="footer" class="smallgraytext"> <a href="../index.html">Home</a> | <a href="#">About Us</a> | <a href="mailto:Daisy@odftoolkit.org">Contact Us</a> </div>
+  </div>
+</div>
+</body>
+</html>
+
+<script type="text/javascript" src="scripts/shCore.js"></script>
 
+<script type="text/javascript" src="scripts/shBrushJava.js"></script>
 
+<script type="text/javascript"> SyntaxHighlighter.all();</script>
   </div>
 
   <div id="footera">

Modified: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo3.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo3.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo3.html Thu Sep  1 10:05:27 2011
@@ -21,39 +21,8 @@
 
 <link href="/odftoolkit/css/odf.css" rel="stylesheet" type="text/css">
 
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="stylesheet" href="../images/style.css" type="text/css" />
-
-
-<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
-
-<title>Demos - SimpleODF</title>
-<style type="text/css">
-<!--
-.STYLE1 {
-	color: #FFFFFF;
-	font-size: 24px;
-}
-.STYLE2 {font-size: 32px}
-.STYLE3 {font-size: 16px}
-.STYLE4 {font-size: 36px}
--->
-    </style>
-	<script type="text/javascript">
-
-  var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-22366020-1']);
-  _gaq.push(['_trackPageview']);
-
-  (function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-  })();
-
-</script>
-
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
 </head>
 
@@ -67,282 +36,343 @@
   </div>
   <div id="clear"></div>
   
-  <div id="content">
+  <div id="sidenav">
+    <h1 id="general">General</h1>
+<ul>
+<li><a href="/odftoolkit/index.html">About</a></li>
+<li><a href="http://incubator.apache.org/projects/odftoolkit.html">Incubator page</a></li>
+<li><a href="/odftoolkit/license.html">License</a></li>
+</ul>
+<h1 id="components">Components</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">Conformance Tools</a></li>
+<li><a href="/odftoolkit/xsltrunner/ODFXSLTRunner.html">XSLT Runner</a></li>
+</ul>
+<h1 id="community">Community</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>
+<ul>
+<li><a href="/odftoolkit/source.html">Source Code</a></li>
+<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>
+<ul>
+<li><a href="/odftoolkit/ppmc-faqs.html">PPMC FAQs</a><br />
+</li>
+</ul>
+<h1 id="asf">ASF</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>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+</ul>
+  </div>
+  <div id="contenta">
   
     
-    
-<div id="page" align="center">
-  <div id="content" style="width:920px" class="contentpanel">
-    <div id="topheader">
-      <div class="topright"> </div>
-    </div>
-    <div id="menu">
-      <div align="left" class="smallwhitetext"> <a href="../index.html" class="home"> </a> <a href="../downloads.html" class="download"></a> <a href="../documents.html" class="document"></a> <a href="../demo/index.html" class="sample"> </a> </div>
-    </div>
-    <div id="subcontent" align ="left">
-        <div align="left" class="titletext"> <span >
-		<a href="index.html">Simple Demos<a> > 
-		<a href="demo3.html">Demo 2: Navigation API in Hotel Receipt<a>
-		</span> 
-		</div>
-		
-		<!---------------------------------------------------------------------------------------------------->	
-<div class="contenttitle">
-
-<a name="overview">Overview</a>
-
-</div>
-
-<div class="bodytext">
-
-<p>
-
-This demo is a simple template application about hotel receipt. By loading the configuration file "consume-data.properties" and navigating the hotel receipt template, this demo could generate the ODF documents (ODT, ODP, and ODS format). In the generated ODF documents, you can see the concrete information about hotel receipt, such as hotel name, customer name, consume time, consume data, total expense, headcount, and consume item details including the price, quantity, total expense of each item. Taking the ODT document as an example, the ODT document template is shown in the following picture. Please notice the area surrounding by eight small green square, it is a chart. Because this chart is generated by the column ConsumeItem and the column Total Expense($) in the above table and the values of the column Total Expense($) are not numeric type, the template chart might not display correctly in your ODF editor, but it will display correctly after the template is expanded.
-
-<br><img src="image/ODT Templating.jpg">
-
-<br>And the generated ODT document is shown in the following picture.
-
-<br><img src="image/Generated ODT.jpg" >
-
-</p>
-
-<p>
-
-Use the Simple Java API for ODF to complete this simple template application. This demo mainly uses the API of package navigation. In the root directory of this demo project, there are three defined ODF template documents, "Navigation-ODT-Templating.odt", "Navigation-ODP-Templating.odp" and "Navigation-ODS-Templating.ods", and one configuration file, "consume-data.properties". Run NavigationForODF.java, and then in the root directory of this demo project you can find three generated ODF documents, "Navigation-ODT-Generated.odt", "Navigation-ODP-Generated.odp" and "Navigation-ODS-Generated.ods", which contain the information of "consume-data.properties". In these ODF documents, the consume item details are shown as table and chart. 
-
-</p>
-
-<p>
-
-Please notice the differences of ODT, ODP, ODS template document. In ODT and ODS template documents, the chart could be automatically generated by the ODF editor according to the data of table, and in this demo the data of chart comes from the column of ConsumeItem and Total Expense($). But in ODP template documents, the chart can not be automatically generated by the table, in fact, the chart in ODP template document is created manually through the function "insert chart" of openoffice, and the type of second column must be numeric. In addition, please notice the cell value of ODS document, the cell value has character type and numeric type, for example, ‘5,000 represents character type and 5,000 represents numeric type, and we could see that the different point is the single quotation marks before 5,000. 
-
-</p>
-
-</div>
-
-<hr/>
-
-<div class="contenttitle">
-
-<a name="codeintroduction">Code Introduction</a>
-
-</div>
-
-<div class="bodytext">
-
-<p> 
-
-First, load the key-value in the file "consume-data.properties" into the instance of Properties, and put ConsumeItem as key and TotalExpenseOfItem as value to the instance of HashMap for navigating ODP document template.
-
-</p>
-
-<!--java code-->
-
-<pre class="brush:java;">
-
-public void loadConsumeData(String filepath) throws Exception {
-
-		InputStream is = new FileInputStream(filepath);
-
-		properties.load(is);
-
-		is.close();
-
-		// put ConsumeItem as key and TotalExpenseOfItem as value to map
-
-		Enumeration<String> enu = (Enumeration<String>) properties.propertyNames();
-
-		while (enu.hasMoreElements()) {
-
-			String key = (String) enu.nextElement();
-
-			if (key.contains("ConsumeItem")) {
-
-				String consumeItem = properties.getProperty(key);
-
-				String totalExpenseOfItem = properties.getProperty("TotalExpenseOfItem"
-											+ key.charAt(key.length() - 1));
-
-				map.put(consumeItem, totalExpenseOfItem);
-
-			}
-
-		}
-
-}
-
-</pre>
-
-</p>
-
-<p>
-
-Then, introduce how to navigate the template documents and generate the ODF documents. 
-
-<br><b>Ⅰ. Navigate ODT document template</b>
-
-<br>Load "Navigation-ODT-Templating.odt" and get the instance of TextDocument. Then traverse the instance of Properties, use the API of TextNavigation and TextSelection to complete the replacement of template document as the line 10-14. Please notice the line 17 and 18, make sure that the chart is shown rightly when open the generated document, so is navigating ODP and ODS document template. At last, generate "Navigation-ODT-Generated.odt" as the line 19.
-
-
-
-<!--java code-->
-
-<pre class="brush:java;">
-
-
-
-public void navigateODT() throws Exception {
-
-		Iterator it = properties.entrySet().iterator();
-
-		System.out.println("Navigate ODT document: Navigation-ODT-Templating.odt");
-
-		TextDocument textdoc = (TextDocument) TextDocument.loadDocument("Navigation-ODT-Templating.odt");
-
-		TextNavigation search;
-
-		while (it.hasNext()) {
-
-			Map.Entry entry = (Map.Entry) it.next();
-
-			String key = (String) entry.getKey();
-
-			String value = (String) entry.getValue();
-
-			search = new TextNavigation(key, textdoc);
-
-			while (search.hasNext()) {
-
-				TextSelection item = (TextSelection) search.nextSelection();
-
-				item.replaceWith(value);
-
-			}
-
-		}
-
-		// remove ObjectReplacements/ and Thumbnails/
-
-		textdoc.getPackage().removePackageDocument("ObjectReplacements/");
-
-		textdoc.getPackage().removePackageDocument("Thumbnails/");
-
-		textdoc.save("Navigation-ODT-Generated.odt");
-
-		System.out.println("...\nNavigation is over, and Navigation-ODT-Generated.odt is generated");
-
-}
-
-</pre> 
-
-</p>
-
-
-
-<p>
-
-<b>Ⅱ. Navigate ODP document template</b>
-
-<br>Unlike the ODT document, the chart of ODP document is an embedded document. Before navigate the chart, get the embedded document as the line 2 and 3. The chart comes from a table, and we could change the chart by setting the cell value of the table as the line 13-15. The line 15 uses the Class DefaultCellValueAdapter to update the cell value and value type. 
-
-
-
-<!--java code-->
-
-<pre class="brush:java;">
-
-		// set the cell value in the table of embedderdocument
-
-		List<Document> embeddedDocuments = pdoc.getEmbeddedDocuments();
-
-		Document embeddedDocument = embeddedDocuments.get(0);
-
-		Table table = embeddedDocument.getTableList().get(0);
-
-		String consumeItem;
-
-		String totalExpenseOfItem;
-
-		int index = 0;
-
-		Iterator<String> it = map.keySet().iterator();
-
-		while (it.hasNext()) {
-
-			index++;
-
-			consumeItem = (String) it.next();
-
-			totalExpenseOfItem = (String) map.get(consumeItem);
-
-			table.getColumnByIndex(0).getCellByIndex(index).setDisplayText(consumeItem);
-
-			table.getColumnByIndex(1).getCellByIndex(index).setDisplayText(
-
-					totalExpenseOfItem, new DefaultCellValueAdapter());
-
-		}
-
-</pre> 
-
-</p>
-
-
-
-<p>
-
-<b>Ⅲ. Navigate ODS document template</b>
-
-<br>Unlike the ODT document, use the Class CellSelection to complete the replacement. Class CellSelection is the subclass of Class TextSelection. Use the method "advancedReplaceWith" to update the cell value and value type. 
-
-<!--java code-->
-
-<pre class="brush:java;">
-
-            search = new TextNavigation(key, ssdoc);
-
-			while (search.hasNext()) {
-
-				CellSelection item = (CellSelection) search.nextSelection();
-
-				item.advancedReplaceWith(value, new DefaultCellValueAdapter());
-
-			}
-
-</pre> 
-
-</p>
-
-
-
-
-
-</div>
-
-<hr/>
-
-
-
-<div class="contenttitle"><a name="download">Download</a></div>
-
-<div class="bodytext">
-
-<p> Powered by Simple API version <a target="_new" href="../downloads.html"><img src="../images/link.png"></img>0.3.5</a>.</p>
-
-<p> You can download the code of this demo from <a Href="Navigation-for-ODF.zip"><img src="../images/link.png"></img>here</a>.</p>
-
-</div>
-<!---------------------------------------------------------------------------------------------------->		
-		
-		
-
-    </div>
-    <div id="footer" class="smallgraytext"> <a href="../index.html">Home</a> | <a href="#">About Us</a> | <a href="mailto:Daisy@odftoolkit.org">Contact Us</a> </div>
-  </div>
-</div>
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="stylesheet" href="../images/style.css" type="text/css" />
+
+<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
+
+<title>Demos - SimpleODF</title>
+<style type="text/css">
+<!--
+.STYLE1 {
+    color: #FFFFFF;
+    font-size: 24px;
+}
+.STYLE2 {font-size: 32px}
+.STYLE3 {font-size: 16px}
+.STYLE4 {font-size: 36px}
+-->
+    </style>
+    <script type="text/javascript">
+
+var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-22366020-1']);
+  _gaq.push(['_trackPageview']);
+
+(function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+
+</script>
+</head>
+<body>
+<div id="page" align="center">
+  <div id="content" style="width:920px" class="contentpanel">
+    <div id="topheader">
+      <div class="topright"> </div>
+    </div>
+    <div id="menu">
+      <div align="left" class="smallwhitetext"> <a href="../index.html" class="home"> </a> <a href="../downloads.html" class="download"></a> <a href="../documents.html" class="document"></a> <a href="../demo/index.html" class="sample"> </a> </div>
+    </div>
+    <div id="subcontent" align ="left">
+        <div align="left" class="titletext"> <span >
+        <a href="index.html">Simple Demos<a> > 
+        <a href="demo3.html">Demo 2: Navigation API in Hotel Receipt<a>
+        </span> 
+        </div>
+
+<!----------------------------------------------------------------------------------------------------> 
+<div class="contenttitle">
+
+<a name="overview">Overview</a>
+
+</div>
+
+<div class="bodytext">
+
+<p>
+
+This demo is a simple template application about hotel receipt. By loading the configuration file "consume-data.properties" and navigating the hotel receipt template, this demo could generate the ODF documents (ODT, ODP, and ODS format). In the generated ODF documents, you can see the concrete information about hotel receipt, such as hotel name, customer name, consume time, consume data, total expense, headcount, and consume item details including the price, quantity, total expense of each item. Taking the ODT document as an example, the ODT document template is shown in the following picture. Please notice the area surrounding by eight small green square, it is a chart. Because this chart is generated by the column ConsumeItem and the column Total Expense($) in the above table and the values of the column Total Expense($) are not numeric type, the template chart might not display correctly in your ODF editor, but it will display correctly after the template is expanded.
+
+<br><img src="image/ODT Templating.jpg">
+
+<br>And the generated ODT document is shown in the following picture.
+
+<br><img src="image/Generated ODT.jpg" >
+
+</p>
+
+<p>
+
+Use the Simple Java API for ODF to complete this simple template application. This demo mainly uses the API of package navigation. In the root directory of this demo project, there are three defined ODF template documents, "Navigation-ODT-Templating.odt", "Navigation-ODP-Templating.odp" and "Navigation-ODS-Templating.ods", and one configuration file, "consume-data.properties". Run NavigationForODF.java, and then in the root directory of this demo project you can find three generated ODF documents, "Navigation-ODT-Generated.odt", "Navigation-ODP-Generated.odp" and "Navigation-ODS-Generated.ods", which contain the information of "consume-data.properties". In these ODF documents, the consume item details are shown as table and chart.
+
+</p>
+
+<p>
+
+Please notice the differences of ODT, ODP, ODS template document. In ODT and ODS template documents, the chart could be automatically generated by the ODF editor according to the data of table, and in this demo the data of chart comes from the column of ConsumeItem and Total Expense($). But in ODP template documents, the chart can not be automatically generated by the table, in fact, the chart in ODP template document is created manually through the function "insert chart" of openoffice, and the type of second column must be numeric. In addition, please notice the cell value of ODS document, the cell value has character type and numeric type, for example, ‘5,000 represents character type and 5,000 represents numeric type, and we could see that the different point is the single quotation marks before 5,000.
+
+</p>
+
+</div>
+
+<hr/>
+
+<div class="contenttitle">
+
+<a name="codeintroduction">Code Introduction</a>
+
+</div>
+
+<div class="bodytext">
+
+<p>
+
+First, load the key-value in the file "consume-data.properties" into the instance of Properties, and put ConsumeItem as key and TotalExpenseOfItem as value to the instance of HashMap for navigating ODP document template.
+
+</p>
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+public void loadConsumeData(String filepath) throws Exception {
+
+InputStream is = new FileInputStream(filepath);
+
+properties.load(is);
+
+is.close();
+
+// put ConsumeItem as key and TotalExpenseOfItem as value to map
+
+Enumeration<String> enu = (Enumeration<String>) properties.propertyNames();
+
+while (enu.hasMoreElements()) {
+
+String key = (String) enu.nextElement();
+
+if (key.contains("ConsumeItem")) {
+
+String consumeItem = properties.getProperty(key);
+
+String totalExpenseOfItem = properties.getProperty("TotalExpenseOfItem"
+                                            + key.charAt(key.length() - 1));
+
+map.put(consumeItem, totalExpenseOfItem);
+
+}
+
+}
+
+}
+
+</pre>
+
+</p>
+
+<p>
+
+Then, introduce how to navigate the template documents and generate the ODF documents.
+
+<br><b>Ⅰ. Navigate ODT document template</b>
+
+<br>Load "Navigation-ODT-Templating.odt" and get the instance of TextDocument. Then traverse the instance of Properties, use the API of TextNavigation and TextSelection to complete the replacement of template document as the line 10-14. Please notice the line 17 and 18, make sure that the chart is shown rightly when open the generated document, so is navigating ODP and ODS document template. At last, generate "Navigation-ODT-Generated.odt" as the line 19.
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+public void navigateODT() throws Exception {
+
+Iterator it = properties.entrySet().iterator();
+
+System.out.println("Navigate ODT document: Navigation-ODT-Templating.odt");
+
+TextDocument textdoc = (TextDocument) TextDocument.loadDocument("Navigation-ODT-Templating.odt");
+
+TextNavigation search;
+
+while (it.hasNext()) {
+
+Map.Entry entry = (Map.Entry) it.next();
+
+String key = (String) entry.getKey();
+
+String value = (String) entry.getValue();
+
+search = new TextNavigation(key, textdoc);
+
+while (search.hasNext()) {
+
+TextSelection item = (TextSelection) search.nextSelection();
+
+item.replaceWith(value);
+
+}
+
+}
+
+// remove ObjectReplacements/ and Thumbnails/
+
+textdoc.getPackage().removePackageDocument("ObjectReplacements/");
+
+textdoc.getPackage().removePackageDocument("Thumbnails/");
+
+textdoc.save("Navigation-ODT-Generated.odt");
+
+System.out.println("...\nNavigation is over, and Navigation-ODT-Generated.odt is generated");
+
+}
+
+</pre>
+
+</p>
+
+<p>
+
+<b>Ⅱ. Navigate ODP document template</b>
+
+<br>Unlike the ODT document, the chart of ODP document is an embedded document. Before navigate the chart, get the embedded document as the line 2 and 3. The chart comes from a table, and we could change the chart by setting the cell value of the table as the line 13-15. The line 15 uses the Class DefaultCellValueAdapter to update the cell value and value type.
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+// set the cell value in the table of embedderdocument
+
+List<Document> embeddedDocuments = pdoc.getEmbeddedDocuments();
+
+Document embeddedDocument = embeddedDocuments.get(0);
+
+Table table = embeddedDocument.getTableList().get(0);
+
+String consumeItem;
+
+String totalExpenseOfItem;
+
+int index = 0;
+
+Iterator<String> it = map.keySet().iterator();
+
+while (it.hasNext()) {
+
+index++;
+
+consumeItem = (String) it.next();
+
+totalExpenseOfItem = (String) map.get(consumeItem);
+
+table.getColumnByIndex(0).getCellByIndex(index).setDisplayText(consumeItem);
+
+table.getColumnByIndex(1).getCellByIndex(index).setDisplayText(
+
+totalExpenseOfItem, new DefaultCellValueAdapter());
+
+}
+
+</pre>
+
+</p>
+
+<p>
+
+<b>Ⅲ. Navigate ODS document template</b>
+
+<br>Unlike the ODT document, use the Class CellSelection to complete the replacement. Class CellSelection is the subclass of Class TextSelection. Use the method "advancedReplaceWith" to update the cell value and value type.
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+search = new TextNavigation(key, ssdoc);
+
+while (search.hasNext()) {
+
+CellSelection item = (CellSelection) search.nextSelection();
+
+item.advancedReplaceWith(value, new DefaultCellValueAdapter());
+
+}
+
+</pre>
+
+</p>
+
+</div>
+
+<hr/>
+
+<div class="contenttitle"><a name="download">Download</a></div>
+
+<div class="bodytext">
+
+<p> Powered by Simple API version <a target="_new" href="../downloads.html"><img src="../images/link.png"></img>0.3.5</a>.</p>
+
+<p> You can download the code of this demo from <a Href="Navigation-for-ODF.zip"><img src="../images/link.png"></img>here</a>.</p>
+
+</div>
+<!---------------------------------------------------------------------------------------------------->
+
+</div>
+    <div id="footer" class="smallgraytext"> <a href="../index.html">Home</a> | <a href="#">About Us</a> | <a href="mailto:Daisy@odftoolkit.org">Contact Us</a> </div>
+  </div>
+</div>
+</body>
+</html>
+
+<script type="text/javascript" src="scripts/shCore.js"></script>
 
+<script type="text/javascript" src="scripts/shBrushJava.js"></script>
 
+<script type="text/javascript"> SyntaxHighlighter.all();</script>
   </div>
 
   <div id="footera">

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 Thu Sep  1 10:05:27 2011
@@ -21,39 +21,8 @@
 
 <link href="/odftoolkit/css/odf.css" rel="stylesheet" type="text/css">
 
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="stylesheet" href="../images/style.css" type="text/css" />
-
-
-<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
-
-<title>Demos - SimpleODF</title>
-<style type="text/css">
-<!--
-.STYLE1 {
-	color: #FFFFFF;
-	font-size: 24px;
-}
-.STYLE2 {font-size: 32px}
-.STYLE3 {font-size: 16px}
-.STYLE4 {font-size: 36px}
--->
-    </style>
-	<script type="text/javascript">
-
-  var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-22366020-1']);
-  _gaq.push(['_trackPageview']);
-
-  (function() {
-    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-  })();
-
-</script>
-
+<title></title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
 </head>
 
@@ -67,391 +36,468 @@
   </div>
   <div id="clear"></div>
   
-  <div id="content">
+  <div id="sidenav">
+    <h1 id="general">General</h1>
+<ul>
+<li><a href="/odftoolkit/index.html">About</a></li>
+<li><a href="http://incubator.apache.org/projects/odftoolkit.html">Incubator page</a></li>
+<li><a href="/odftoolkit/license.html">License</a></li>
+</ul>
+<h1 id="components">Components</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">Conformance Tools</a></li>
+<li><a href="/odftoolkit/xsltrunner/ODFXSLTRunner.html">XSLT Runner</a></li>
+</ul>
+<h1 id="community">Community</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>
+<ul>
+<li><a href="/odftoolkit/source.html">Source Code</a></li>
+<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>
+<ul>
+<li><a href="/odftoolkit/ppmc-faqs.html">PPMC FAQs</a><br />
+</li>
+</ul>
+<h1 id="asf">ASF</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>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+</ul>
+  </div>
+  <div id="contenta">
   
     
-    
-<div id="page" align="center">
-  <div id="content" style="width:920px" class="contentpanel">
-    <div id="topheader">
-      <div class="topright"> </div>
-    </div>
-    <div id="menu">
-      <div align="left" class="smallwhitetext"> <a href="../index.html" class="home"> </a> <a href="../downloads.html" class="download"></a> <a href="../documents.html" class="document"></a> <a href="../demo/index.html" class="sample"> </a> </div>
-    </div>
-    <div id="subcontent" align ="left">
-        <div align="left" class="titletext"> <span >
-		<a href="index.html">Simple Demos<a> > 
-		<a href="demo4.html">Demo 3: List and Table Conversion<a>
-		</span> 
-		</div>
-		
-		<!---------------------------------------------------------------------------------------------------->	
-<div class="contenttitle">
-
-    <a name="overview">Overview</a>
-
-</div>
-
-<div class="bodytext">
-
-    <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/> <br/> 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/> <br/> &nbsp;&nbsp;&nbsp;<img 
-
-    src="image/demo4_organization_list.png"><br/> <br/> 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/> <br/> <img 
-
-    src="image/demo4_code_list.png" ><br/> <br/> 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>
-
-</div>
-
-<hr/>
-
-<div class="contenttitle">
-
-    <a name="codeintroduction">Code Introduction</a>
-
-</div>
-
-<div class="bodytext">
-
-    <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>
-
-    <!--java code-->
-
-    <pre class="brush:java;">
-
-	public static void main(String[] args) {
-
-		try {
-
-			TextDocument textDoc = TextDocument.loadDocument("ListTable.odt");
-
-			SpreadsheetDocument spreadsheetDoc = SpreadsheetDocument.loadDocument("TableList.ods");
-
-			// covert list in text document to spreadsheet table
-
-			Iterator<list> listIterator = textDoc.getListIterator();
-
-			int i = 1;
-
-			String[] tableLabel = { "DEPARTMENT", "MANAGER", "EMPLOYEE" };
-
-			while (listIterator.hasNext()) {
-
-				List list = listIterator.next();
-
-				Table newTable = Table.newTable(spreadsheetDoc);
-
-				for (int columnIndex = 0; columnIndex < tableLabel.length; columnIndex++) {
-
-					newTable.getCellByPosition(columnIndex, 0).setStringValue(tableLabel[columnIndex]);
-
-				}
-
-				newTable.setTableName("ListTable" + (i++));
-
-				convertFromListToTable(list, newTable, 0, 1);
-
-			}
-
-			spreadsheetDoc.save("TableListUpdate.ods");
-
-			// covert table in spreadsheet to list in text document
-
-			Table sheet1 = spreadsheetDoc.getTableByName("Sheet1");
-
-			textDoc.newParagraph("ListConvertedFromTable");
-
-			List newList = textDoc.addList();
-
-			convertFromTableToList(sheet1, newList, 0, 0, sheet1.getColumnCount() - 1, sheet1.getRowCount() - 1);
-
-			textDoc.save("ListTableUpdate.odt");
-
-		} catch (Exception e) {
-
-			e.printStackTrace();
-
-		}
-
-	}
-
-    </pre>
-
-</p>
-
-<p>
-
-In the following two sections, I will review the implementation of the methods 
-
-<code>convertFromListToTable</code> and <code>convertFromTableToList</code>. <br/><br/>
-
-<b>Convert from List to Table</b>
-
-<br/><br/>
-
-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. 
-
-<br/><br/> 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/>
-
-    <!--java code-->
-
-<pre class="brush:java;">
-
-	private static int convertFromListToTable(List list, Table table, int startColumn, int startRow) {
-
-		java.util.List<listitem> items = list.getItems();
-
-		int newItemCount = startRow;
-
-		for (ListItem item : items) {
-
-			Cell cell = table.getCellByPosition(startColumn, newItemCount);
-
-			cell.setStringValue(item.getTextContent());
-
-			cell.setVerticalAlignment(VerticalAlignmentType.MIDDLE);
-
-			Iterator<list> listIterator = item.listIterator();
-
-			startRow = newItemCount;
-
-			while (listIterator.hasNext()) {
-
-				List subList = listIterator.next();
-
-				newItemCount = convertFromListToTable(subList, table, startColumn + 1, newItemCount);
-
-			}
-
-			// merge
-
-			CellRange cellRange = table.getCellRangeByPosition(startColumn, startRow, startColumn, newItemCount);
-
-			cellRange.merge();
-
-			newItemCount++;
-
-		}
-
-		if (list.size() > 0) {
-
-			return newItemCount - 1;
-
-		} else {
-
-			return startRow;
-
-		}
-
-	}
-
-    </pre>
-
-</p>
-
-<br/>
-
-<p>
-
-<b>Convert from Table to List</b>
-
-<br/><br/>
-
-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 > 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/>
-
-    <!--java code-->
-
-<pre class="brush:java;">
-
-    private static void convertFromTableToList(Table table, List list, int startColumn, int startRow, int endColumn,
-
-			int endRow) {
-
-		while (startRow <= endRow) {
-
-			Cell cell = table.getCellByPosition(startColumn, startRow);
-
-			int rowSpannedNumber = cell.getRowSpannedNumber();
-
-			String cellText = cell.getDisplayText();
-
-			if (!"".equals(cellText)) {
-
-				ListItem item = list.addItem(cellText);
-
-				int columnSpannedNumber = cell.getColumnSpannedNumber();
-
-				int newStartColumn = startColumn + columnSpannedNumber;
-
-				if (newStartColumn <= endColumn) {
-
-					if (rowSpannedNumber > 1) {
-
-						List subList = item.addList();
-
-						convertFromTableToList(table, subList, newStartColumn, startRow, endColumn, startRow
-
-								+ rowSpannedNumber - 1);
-
-					} else {
-
-						int tmpStartColumn = newStartColumn;
-
-						while (tmpStartColumn <= endColumn) {
-
-							cell = table.getCellByPosition(tmpStartColumn, startRow);
-
-							cellText = cell.getDisplayText();
-
-							if (!"".equals(cellText)) {
-
-								item.setTextContent(item.getTextContent() + "|" + cellText);
-
-							}
-
-							tmpStartColumn += cell.getColumnSpannedNumber();
-
-						}
-
-					}
-
-				}
-
-			}
-
-			startRow += rowSpannedNumber;
-
-		}
-
-	}
-
-</pre>
-
-</p>
-
-</div>
-
-<hr/>
-
-<div class="contenttitle">
-
-    <a name="download">Download</a>
-
-</div>
-
-<div class="bodytext">
-
-    <p>
-
-    Powered by Simple API version <a target="_new" href="../downloads.html"><img src="../images/link.png"></img>0.4</a>.
-
-    </p>
-
-    <p>
-
-    You can download the code of this demo from <a href="table_list_convertion.zip"><img src="../images/link.png"></img>here</a>.
-
-    </p>
-
-</div>
-<!---------------------------------------------------------------------------------------------------->		
-		
-		
-
-    </div>
-    <div id="footer" class="smallgraytext"> <a href="../index.html">Home</a> | <a href="#">About Us</a> | <a href="mailto:Daisy@odftoolkit.org">Contact Us</a> </div>
-  </div>
-</div>
+    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="stylesheet" href="../images/style.css" type="text/css" />
+
+<link type="text/css" rel="stylesheet" href="styles/shCoreEclipse.css"/>
+
+<title>Demos - SimpleODF</title>
+<style type="text/css">
+<!--
+.STYLE1 {
+    color: #FFFFFF;
+    font-size: 24px;
+}
+.STYLE2 {font-size: 32px}
+.STYLE3 {font-size: 16px}
+.STYLE4 {font-size: 36px}
+-->
+    </style>
+    <script type="text/javascript">
+
+var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-22366020-1']);
+  _gaq.push(['_trackPageview']);
+
+(function() {
+    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+  })();
+
+</script>
+</head>
+<body>
+<div id="page" align="center">
+  <div id="content" style="width:920px" class="contentpanel">
+    <div id="topheader">
+      <div class="topright"> </div>
+    </div>
+    <div id="menu">
+      <div align="left" class="smallwhitetext"> <a href="../index.html" class="home"> </a> <a href="../downloads.html" class="download"></a> <a href="../documents.html" class="document"></a> <a href="../demo/index.html" class="sample"> </a> </div>
+    </div>
+    <div id="subcontent" align ="left">
+        <div align="left" class="titletext"> <span >
+        <a href="index.html">Simple Demos<a> > 
+        <a href="demo4.html">Demo 3: List and Table Conversion<a>
+        </span> 
+        </div>
+
+<!----------------------------------------------------------------------------------------------------> 
+<div class="contenttitle">
+
+<a name="overview">Overview</a>
+
+</div>
+
+<div class="bodytext">
+
+<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/> <br/> 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/> <br/> &nbsp;&nbsp;&nbsp;<img
+
+src="image/demo4_organization_list.png"><br/> <br/> 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/> <br/> <img
+
+src="image/demo4_code_list.png" ><br/> <br/> 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>
+
+</div>
+
+<hr/>
+
+<div class="contenttitle">
+
+<a name="codeintroduction">Code Introduction</a>
+
+</div>
+
+<div class="bodytext">
+
+<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>
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+public static void main(String[] args) {
+
+try {
+
+TextDocument textDoc = TextDocument.loadDocument("ListTable.odt");
+
+SpreadsheetDocument spreadsheetDoc = SpreadsheetDocument.loadDocument("TableList.ods");
+
+// covert list in text document to spreadsheet table
+
+Iterator<list> listIterator = textDoc.getListIterator();
+
+int i = 1;
+
+String[] tableLabel = { "DEPARTMENT", "MANAGER", "EMPLOYEE" };
+
+while (listIterator.hasNext()) {
+
+List list = listIterator.next();
+
+Table newTable = Table.newTable(spreadsheetDoc);
+
+for (int columnIndex = 0; columnIndex < tableLabel.length; columnIndex++) {
+
+newTable.getCellByPosition(columnIndex, 0).setStringValue(tableLabel[columnIndex]);
+
+}
+
+newTable.setTableName("ListTable" + (i++));
+
+convertFromListToTable(list, newTable, 0, 1);
+
+}
+
+spreadsheetDoc.save("TableListUpdate.ods");
+
+// covert table in spreadsheet to list in text document
+
+Table sheet1 = spreadsheetDoc.getTableByName("Sheet1");
+
+textDoc.newParagraph("ListConvertedFromTable");
+
+List newList = textDoc.addList();
+
+convertFromTableToList(sheet1, newList, 0, 0, sheet1.getColumnCount() - 1, sheet1.getRowCount() - 1);
+
+textDoc.save("ListTableUpdate.odt");
+
+} catch (Exception e) {
+
+e.printStackTrace();
+
+}
+
+}
+
+</pre>
+
+</p>
+
+<p>
+
+In the following two sections, I will review the implementation of the methods
+
+<code>convertFromListToTable</code> and <code>convertFromTableToList</code>. <br/><br/>
+
+<b>Convert from List to Table</b>
+
+<br/><br/>
+
+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.
+
+<br/><br/> 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/>
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+private static int convertFromListToTable(List list, Table table, int startColumn, int startRow) {
+
+java.util.List<listitem> items = list.getItems();
+
+int newItemCount = startRow;
+
+for (ListItem item : items) {
+
+Cell cell = table.getCellByPosition(startColumn, newItemCount);
+
+cell.setStringValue(item.getTextContent());
+
+cell.setVerticalAlignment(VerticalAlignmentType.MIDDLE);
+
+Iterator<list> listIterator = item.listIterator();
+
+startRow = newItemCount;
+
+while (listIterator.hasNext()) {
+
+List subList = listIterator.next();
+
+newItemCount = convertFromListToTable(subList, table, startColumn + 1, newItemCount);
+
+}
+
+// merge
+
+CellRange cellRange = table.getCellRangeByPosition(startColumn, startRow, startColumn, newItemCount);
+
+cellRange.merge();
+
+newItemCount++;
+
+}
+
+if (list.size() > 0) {
+
+return newItemCount - 1;
+
+} else {
+
+return startRow;
+
+}
+
+}
+
+</pre>
+
+</p>
+
+<br/>
+
+<p>
+
+<b>Convert from Table to List</b>
+
+<br/><br/>
+
+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 > 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/>
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+private static void convertFromTableToList(Table table, List list, int startColumn, int startRow, int endColumn,
+
+int endRow) {
+
+while (startRow <= endRow) {
+
+Cell cell = table.getCellByPosition(startColumn, startRow);
+
+int rowSpannedNumber = cell.getRowSpannedNumber();
+
+String cellText = cell.getDisplayText();
+
+if (!"".equals(cellText)) {
+
+ListItem item = list.addItem(cellText);
+
+int columnSpannedNumber = cell.getColumnSpannedNumber();
+
+int newStartColumn = startColumn + columnSpannedNumber;
+
+if (newStartColumn <= endColumn) {
+
+if (rowSpannedNumber > 1) {
+
+List subList = item.addList();
+
+convertFromTableToList(table, subList, newStartColumn, startRow, endColumn, startRow
+
++ rowSpannedNumber - 1);
+
+} else {
+
+int tmpStartColumn = newStartColumn;
+
+while (tmpStartColumn <= endColumn) {
+
+cell = table.getCellByPosition(tmpStartColumn, startRow);
+
+cellText = cell.getDisplayText();
+
+if (!"".equals(cellText)) {
+
+item.setTextContent(item.getTextContent() + "|" + cellText);
+
+}
+
+tmpStartColumn += cell.getColumnSpannedNumber();
+
+}
+
+}
+
+}
+
+}
+
+startRow += rowSpannedNumber;
+
+}
+
+}
+
+</pre>
+
+</p>
+
+</div>
+
+<hr/>
+
+<div class="contenttitle">
+
+<a name="download">Download</a>
+
+</div>
+
+<div class="bodytext">
+
+<p>
+
+Powered by Simple API version <a target="_new" href="../downloads.html"><img src="../images/link.png"></img>0.4</a>.
+
+</p>
+
+<p>
+
+You can download the code of this demo from <a href="table_list_convertion.zip"><img src="../images/link.png"></img>here</a>.
+
+</p>
+
+</div>
+<!---------------------------------------------------------------------------------------------------->
+
+</div>
+    <div id="footer" class="smallgraytext"> <a href="../index.html">Home</a> | <a href="#">About Us</a> | <a href="mailto:Daisy@odftoolkit.org">Contact Us</a> </div>
+  </div>
+</div>
+</body>
+</html>
+
+<script type="text/javascript" src="scripts/shCore.js"></script>
 
+<script type="text/javascript" src="scripts/shBrushJava.js"></script>
 
+<script type="text/javascript"> SyntaxHighlighter.all();</script>
   </div>
 
   <div id="footera">



Mime
View raw message