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 [2/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
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 Thu Sep  1 10:05:27 2011
@@ -21,36 +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>
 
@@ -64,197 +36,257 @@
   </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="demo5.html">Demo 4: Multiple Presentations Assembler<a>
-		</span> 
-		</div>
-		
-		<!---------------------------------------------------------------------------------------------------->	
-<div class="contenttitle">
-
-
-    <a name="overview">Overview</a>
-
-
-</div>
-
-
-<div class="bodytext">
-
-
-    <p> If you make a lot of presentations in your daily work, you  know that you don't always  create a presentation from scratch. 
-	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.
-    <br> This demo provides a Java application that can assemble  specific pages of presentations together and make one presentation from the command line.
-	<br> 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><code>Java PresentationAssembler -in PresentationA.odp(1) -in PresentationB.odp(1) -in PresentationC.odp(1-2) -out newPresentation.odp</code>
-    <br/> <br/> 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 also.<br/> <br/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img 
-
-
-    src="image/demo5_doc.jpg" ><br/> <br/> In the next section, I will show how easy it is to create this assembling application using the Simple API.  
-
-
-    </p>
-
-
-</div>
-
-
-<hr/>
-
-
-<div class="contenttitle">
-
-
-    <a name="codeintroduction">Code Introduction</a>
-
-
-</div>
-
-
-<div class="bodytext">
-
-    <p>
-    <code>assemble</code> is the method that accepts the command line parameters, analyzes them, and assembles presentations 
-	with the Simple Java API for ODF. 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 Java API for ODF provides very simple methods to
-	copy pages from other presentations:
-	 <br>
-	 <br><code>PresentationDocument.copyForeignSlide(int destIndex, PresentationDocument srcDoc, int srcIndex)</code>
-	 <br>and
-	 <br><code>PresentationDocument.appendPresentation(PresentationDocument srcDoc)</code>.
-	 <br>
-	 <br>After the slides are attached, the first slide of the new presentation is deleted by invoking method 
-	 <code>PresentationDocument.deleteSlideByIndex(int index)</code>. 
-	 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 Java API for ODF provides.  </p>
-
-    <!--java code-->
-
-
-    <pre class="brush:java;">
-
-
-	public void assemble(String[] args) throws Exception
-	{
-		String outputFileName="default.odp";
-		int pageIndex = 1;
-		PresentationDocument doc = PresentationDocument.newPresentationDocument();
-		int i=0;
-		while (i < args.length)
-		{
-			String param = args[i];
-			if (param.equals("-out")) //get the output file name
-				outputFileName = args[++i];
-			else if (param.equals("-in")) //get the input file name 
-			{
-				String pageDesc = args[++i];
-				String filename = pageDesc, pagelist;
-				int indexStart = pageDesc.indexOf('('); //get the page numbers
-				int[] srcPages = null;
-				if (indexStart > -1)
-				{
-					filename = pageDesc.substring(0, indexStart);
-					pagelist = pageDesc.substring(indexStart+1, pageDesc.length()-1);
-					srcPages = getPageNumbers(pagelist); //analysis the page number description 
-									                     //and return all page numbers that need to be copied
-				}
-				PresentationDocument sourceDoc = PresentationDocument.loadDocument(new File(filename));
-				if (srcPages==null)
-				{
-					doc.appendPresentation(sourceDoc);
-					pageIndex += sourceDoc.getSlideCount();
-				} else for(int j=0;j < srcPages.length;j++)
-				{
-					doc.copyForeignSlide(pageIndex, sourceDoc, srcPages[j]);
-					pageIndex++;
-				}
-			}
-			i++;
-		}
-		doc.deleteSlideByIndex(0);
-		doc.save(outputFileName);
-		doc.close();
-	}
-
-
-    </pre>
-
-
-</p>
-
-
-<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.4.5</a>.
-
-
-    </p>
-
-
-    <p>
-
-
-    You can download the code of this demo from <a href="PresentationAssembler.zip">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">
+
+<p>var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-22366020-1']);
+  _gaq.push(['_trackPageview']);</p>
+<p>(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);
+  })();</p>
+<p></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> &gt; 
+        <a href="demo5.html">Demo 4: Multiple Presentations Assembler<a>
+        </span> 
+        </div></p>
+<div class="codehilite"><pre>    <span class="sr">&lt;!----------------------------------------------------------------------------------------------------&gt;</span>
+</pre></div>
+
+
+<div class="contenttitle">
+
+<div class="codehilite"><pre><span class="nt">&lt;a</span> <span class="na">name=</span><span class="s">&quot;overview&quot;</span><span class="nt">&gt;</span>Overview<span class="nt">&lt;/a&gt;</span>
+</pre></div>
+
+
+</div>
+
+<div class="bodytext">
+
+<div class="codehilite"><pre><span class="nt">&lt;p&gt;</span> If you make a lot of presentations in your daily work, you  know that you don&#39;t always  create a presentation from scratch. 
+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.
+<span class="nt">&lt;br&gt;</span> This demo provides a Java application that can assemble  specific pages of presentations together and make one presentation from the command line.
+<span class="nt">&lt;br&gt;</span> 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:
+<span class="nt">&lt;br&gt;&lt;code&gt;</span>Java PresentationAssembler -in PresentationA.odp(1) -in PresentationB.odp(1) -in PresentationC.odp(1-2) -out newPresentation.odp<span class="nt">&lt;/code&gt;</span>
+<span class="nt">&lt;br/&gt;</span> <span class="nt">&lt;br/&gt;</span> 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 also.<span class="nt">&lt;br/&gt;</span> <span class="nt">&lt;br/&gt;</span> <span class="ni">&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</span><span class="nt">&lt;img</span>
+
+<span class="na">src=</span><span class="s">&quot;image/demo5_doc.jpg&quot;</span> <span class="nt">&gt;&lt;br/&gt;</span> <span class="nt">&lt;br/&gt;</span> In the next section, I will show how easy it is to create this assembling application using the Simple API.
+
+<span class="nt">&lt;/p&gt;</span>
+</pre></div>
+
+
+</div>
+
+<hr/>
+
+<div class="contenttitle">
+
+<div class="codehilite"><pre><span class="nt">&lt;a</span> <span class="na">name=</span><span class="s">&quot;codeintroduction&quot;</span><span class="nt">&gt;</span>Code Introduction<span class="nt">&lt;/a&gt;</span>
+</pre></div>
+
+
+</div>
+
+<div class="bodytext">
+
+<div class="codehilite"><pre><span class="nt">&lt;p&gt;</span>
+<span class="nt">&lt;code&gt;</span>assemble<span class="nt">&lt;/code&gt;</span> is the method that accepts the command line parameters, analyzes them, and assembles presentations 
+with the Simple Java API for ODF. 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 Java API for ODF provides very simple methods to
+copy pages from other presentations:
+ <span class="nt">&lt;br&gt;</span>
+ <span class="nt">&lt;br&gt;&lt;code&gt;</span>PresentationDocument.copyForeignSlide(int destIndex, PresentationDocument srcDoc, int srcIndex)<span class="nt">&lt;/code&gt;</span>
+ <span class="nt">&lt;br&gt;</span>and
+ <span class="nt">&lt;br&gt;&lt;code&gt;</span>PresentationDocument.appendPresentation(PresentationDocument srcDoc)<span class="nt">&lt;/code&gt;</span>.
+ <span class="nt">&lt;br&gt;</span>
+ <span class="nt">&lt;br&gt;</span>After the slides are attached, the first slide of the new presentation is deleted by invoking method 
+ <span class="nt">&lt;code&gt;</span>PresentationDocument.deleteSlideByIndex(int index)<span class="nt">&lt;/code&gt;</span>. 
+ This is because the first slide is an empty slide which was created when the new presentation was created with 
+ method <span class="nt">&lt;code&gt;</span>PresentationDocument.newPresentationDocument()<span class="nt">&lt;/code&gt;</span>
+
+<span class="nt">&lt;/p&gt;</span>
+<span class="nt">&lt;p&gt;</span>Below is the source code of method <span class="nt">&lt;code&gt;</span>assemble<span class="nt">&lt;/code&gt;</span>. 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 Java API for ODF provides.  <span class="nt">&lt;/p&gt;</span>
+
+<span class="c">&lt;!--java code--&gt;</span>
+
+<span class="nt">&lt;pre</span> <span class="na">class=</span><span class="s">&quot;brush:java;&quot;</span><span class="nt">&gt;</span>
+
+public void assemble(String[] args) throws Exception
+{
+    String outputFileName=&quot;default.odp&quot;;
+    int pageIndex = 1;
+    PresentationDocument doc = PresentationDocument.newPresentationDocument();
+    int i=0;
+    while (i <span class="nt">&lt; args.length</span><span class="err">)</span>
+    <span class="err">{</span>
+        <span class="err">String</span> <span class="na">param =</span> <span class="s">args[i];</span>
+        <span class="err">if</span> <span class="err">(param.equals(&quot;-out&quot;))</span> <span class="err">//get</span> <span class="err">the</span> <span class="err">output</span> <span class="err">file</span> <span class="err">name</span>
+            <span class="na">outputFileName =</span> <span class="s">args[++i];</span>
+        <span class="err">else</span> <span class="err">if</span> <span class="err">(param.equals(&quot;-in&quot;))</span> <span class="err">//get</span> <span class="err">the</span> <span class="err">input</span> <span class="err">file</span> <span class="err">name</span> 
+        <span class="err">{</span>
+            <span class="err">String</span> <span class="na">pageDesc =</span> <span class="s">args[++i];</span>
+            <span class="err">String</span> <span class="na">filename =</span> <span class="s">pageDesc,</span> <span class="err">pagelist;</span>
+            <span class="err">int</span> <span class="na">indexStart =</span> <span class="s">pageDesc.indexOf(&#39;(&#39;);</span> <span class="err">//get</span> <span class="err">the</span> <span class="err">page</span> <span class="err">numbers</span>
+            <span class="err">int[]</span> <span class="na">srcPages =</span> <span class="s">null;</span>
+            <span class="err">if</span> <span class="err">(indexStart</span> <span class="nt">&gt;</span> -1)
+            {
+                filename = pageDesc.substring(0, indexStart);
+                pagelist = pageDesc.substring(indexStart+1, pageDesc.length()-1);
+                srcPages = getPageNumbers(pagelist); //analysis the page number description 
+                                                     //and return all page numbers that need to be copied
+            }
+            PresentationDocument sourceDoc = PresentationDocument.loadDocument(new File(filename));
+            if (srcPages==null)
+            {
+                doc.appendPresentation(sourceDoc);
+                pageIndex += sourceDoc.getSlideCount();
+            } else for(int j=0;j <span class="nt">&lt; srcPages.length</span><span class="err">;j++)</span>
+            <span class="err">{</span>
+                <span class="err">doc.copyForeignSlide(pageIndex,</span> <span class="err">sourceDoc,</span> <span class="err">srcPages[j]);</span>
+                <span class="err">pageIndex++;</span>
+            <span class="err">}</span>
+        <span class="err">}</span>
+        <span class="err">i++;</span>
+    <span class="err">}</span>
+    <span class="err">doc.deleteSlideByIndex(0);</span>
+    <span class="err">doc.save(outputFileName);</span>
+    <span class="err">doc.close();</span>
+<span class="err">}</span>
+
+<span class="err">&lt;/pre</span><span class="nt">&gt;</span>
+</pre></div>
+
+
+</p>
+
+<p>
+
+</p>
+
+</div>
+
+<hr/>
+
+<div class="contenttitle">
+
+<div class="codehilite"><pre><span class="nt">&lt;a</span> <span class="na">name=</span><span class="s">&quot;download&quot;</span><span class="nt">&gt;</span>Download<span class="nt">&lt;/a&gt;</span>
+</pre></div>
+
+
+</div>
+
+<div class="bodytext">
+
+<div class="codehilite"><pre><span class="nt">&lt;p&gt;</span>
+
+Powered by the Simple Java API for ODF version  <span class="nt">&lt;a</span> <span class="na">target=</span><span class="s">&quot;_new&quot;</span> <span class="na">href=</span><span class="s">&quot;../downloads.html&quot;</span><span class="nt">&gt;&lt;img</span> <span class="na">src=</span><span class="s">&quot;../images/link.png&quot;</span><span class="nt">&gt;&lt;/img&gt;</span>0.4.5<span class="nt">&lt;/a&gt;</span>.
+
+<span class="nt">&lt;/p&gt;</span>
+
+<span class="nt">&lt;p&gt;</span>
+
+You can download the code of this demo from <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;PresentationAssembler.zip&quot;</span><span class="nt">&gt;</span>here<span class="nt">&lt;/a&gt;</span>.
+
+<span class="nt">&lt;/p&gt;</span>
+</pre></div>
+
+
+<p></div>
+<!---------------------------------------------------------------------------------------------------->   <br />
+</p>
+<div class="codehilite"><pre>        <span class="nt">&lt;/div&gt;</span>
+<span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">&quot;footer&quot;</span> <span class="na">class=</span><span class="s">&quot;smallgraytext&quot;</span><span class="nt">&gt;</span> <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;#&quot;</span><span class="nt">&gt;</span>Home<span class="nt">&lt;/a&gt;</span> | <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;#&quot;</span><span class="nt">&gt;</span>About Us<span class="nt">&lt;/a&gt;</span> | <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">&quot;#&quot;</span><span class="nt">&gt;</span>Contact Us<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;/div&gt;</span>
+</pre></div>
+
+
+<p></div>
+</div>
+</body>
+</html></p>
+<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/demo6.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo6.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo6.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" 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>
 
@@ -67,110 +36,186 @@
   </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="demo6.html">Demo 5: Booking Sheet with Text Box<a>
-		</span> 
-		</div>
-		
-		<!---------------------------------------------------------------------------------------------------->	
-<div class="contenttitle">
-    <a name="overview">Overview</a>
-</div>
-<div class="bodytext">
-    <p>This demo shows the power of text box and paragraph support in Simple ODF.<br/>
-	The background of this demo is that a travel agency has to help customers book hotel. They have a spreadsheet file in hand, which records all of the visitors' information. They need to generate an order form with the requirements of hotel reservation using these data. A order form template has been supplied. This program generates order forms for all the visitors based on records of passengers in spreadsheet and the given template.<br/><br/>
-<img src="image/demo6.png" ><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 simple. First, load template document and spreadsheet separately. Secondly, iterate data table and create new section and paragraph. The Text Boxes in the paragraph are also cloned. All of them are iterated and filled information from data table.<br/>
-	Data items counts are also computed. These counts are wrote to the bottom table of the sheet.<br/>
-    <!--java code-->
-    <pre class="brush:java;">
-	public static void main(String[] args) {
-		try {
-			// load template document
-			TextDocument doc = TextDocument.loadDocument("DemoTemplate.odt");
-			Table roomtable = doc.getTableByName("RoomTable");
-			roomtable.remove();
-			Section templateSection = doc.getSectionByName("SectionForm");
-			// load passenger data document
-			SpreadsheetDocument data = SpreadsheetDocument.loadDocument("Passengers.ods");
-			Table table = data.getTableByName("passenger");
-			int count = table.getRowCount();
-			int type1Count = 0, type2Count = 0, type3Count = 0;
-			for (int i = 1; i < count; i++) {
-				Row row = table.getRowByIndex(i);
-				for (int j = 0; j < 6; j++) {
-					Paragraph para = templateSection.getParagraphByIndex(j,	false);
-					Textbox nameBox = para.getTextboxIterator().next();
-					String content = row.getCellByIndex(j).getDisplayText();
-					nameBox.setTextContent(content);
-					if (j == 5) {
-						if (content.equals("Deluxe Room"))
-							type1Count++;
-						else if (content.equals("Studio/Junior Suite"))
-							type2Count++;
-						else if (content.equals("Executive Suite"))
-							type3Count++;
-					}
-				}
-				doc.appendSection(templateSection, false);
-				doc.addParagraph(null);
-			}
-			templateSection.remove();
-			roomtable.getCellByPosition(2, 1).setStringValue(type1Count + "");
-			roomtable.getCellByPosition(2, 2).setStringValue(type2Count + "");
-			roomtable.getCellByPosition(2, 3).setStringValue(type3Count + "");
-
-			doc.getContentRoot().appendChild(roomtable.getOdfElement());
-			doc.save("output.odt");
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-
-	}
-    </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.5</a>.
-  </p>
-  <p>
-    You can download the code of this demo from <a href="TextboxDemo.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">
+
+<p>var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-22366020-1']);
+  _gaq.push(['_trackPageview']);</p>
+<p>(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);
+  })();</p>
+<p></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> &gt; 
+        <a href="demo6.html">Demo 5: Booking Sheet with Text Box<a>
+        </span> 
+        </div></p>
+<div class="codehilite"><pre>    <span class="sr">&lt;!----------------------------------------------------------------------------------------------------&gt;</span>
+</pre></div>
+
+
+<p><div class="contenttitle">
+    <a name="overview">Overview</a>
+</div>
+<div class="bodytext">
+    <p>This demo shows the power of text box and paragraph support in Simple ODF.<br/>
+    The background of this demo is that a travel agency has to help customers book hotel. They have a spreadsheet file in hand, which records all of the visitors' information. They need to generate an order form with the requirements of hotel reservation using these data. A order form template has been supplied. This program generates order forms for all the visitors based on records of passengers in spreadsheet and the given template.<br/><br/>
+<img src="image/demo6.png" ><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 simple. First, load template document and spreadsheet separately. Secondly, iterate data table and create new section and paragraph. The Text Boxes in the paragraph are also cloned. All of them are iterated and filled information from data table.<br/>
+    Data items counts are also computed. These counts are wrote to the bottom table of the sheet.<br/>
+    <!--java code-->
+    <pre class="brush:java;">
+    public static void main(String[] args) {
+        try {
+            // load template document
+            TextDocument doc = TextDocument.loadDocument("DemoTemplate.odt");
+            Table roomtable = doc.getTableByName("RoomTable");
+            roomtable.remove();
+            Section templateSection = doc.getSectionByName("SectionForm");
+            // load passenger data document
+            SpreadsheetDocument data = SpreadsheetDocument.loadDocument("Passengers.ods");
+            Table table = data.getTableByName("passenger");
+            int count = table.getRowCount();
+            int type1Count = 0, type2Count = 0, type3Count = 0;
+            for (int i = 1; i &lt; count; i++) {
+                Row row = table.getRowByIndex(i);
+                for (int j = 0; j &lt; 6; j++) {
+                    Paragraph para = templateSection.getParagraphByIndex(j, false);
+                    Textbox nameBox = para.getTextboxIterator().next();
+                    String content = row.getCellByIndex(j).getDisplayText();
+                    nameBox.setTextContent(content);
+                    if (j == 5) {
+                        if (content.equals("Deluxe Room"))
+                            type1Count++;
+                        else if (content.equals("Studio/Junior Suite"))
+                            type2Count++;
+                        else if (content.equals("Executive Suite"))
+                            type3Count++;
+                    }
+                }
+                doc.appendSection(templateSection, false);
+                doc.addParagraph(null);
+            }
+            templateSection.remove();
+            roomtable.getCellByPosition(2, 1).setStringValue(type1Count + "");
+            roomtable.getCellByPosition(2, 2).setStringValue(type2Count + "");
+            roomtable.getCellByPosition(2, 3).setStringValue(type3Count + "");</p>
+<div class="codehilite"><pre>        <span class="n">doc</span><span class="o">.</span><span class="n">getContentRoot</span><span class="p">()</span><span class="o">.</span><span class="n">appendChild</span><span class="p">(</span><span class="n">roomtable</span><span class="o">.</span><span class="n">getOdfElement</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;output.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="p">}</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.5</a>.
+  </p>
+  <p>
+    You can download the code of this demo from <a href="TextboxDemo.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/demo7.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo7.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo7.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" 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>
 
@@ -67,192 +36,266 @@
   </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="demo7.html">Demo 6: Offer Letter with Text Fields<a>
-		</span> 
-		</div>
-		
-		<!---------------------------------------------------------------------------------------------------->	
-<div class="contenttitle">
-    <a name="overview">Overview</a>
-</div>
-<div class="bodytext">
-    <p> We have introduced several samples about how to use Simple ODF API to generate document from the predefined templete, for example, <a href="demo3.html"><img src="../images/link.png">Demo 3: Navigation API in Hotel Receipt</a>. I believe you have known how easy it is. But sounds like, we never talk about how to create a template document using  Simple ODF API. <br/><br/>
-Today, let's do it.<br/><br/>
-Simple ODF API provides Fields API since version 0.5. OpenDocument text documents or OpenDocument text content embedded in other types of documents may contain variable text elements called fields. Fields are commonly used for, a page number field displays the number of the page on which it appears or a creation date field displays the date on which a document was created. Besides, there are several advance field, such as, variable field and condition field.<br/><br/>
-This demo provides a Java application which can create the offer letter template document from a sample and use it to generate new offer letters with the information from a spreadsheet. The template document contains some fields whose content is decided by the information from data file.<br/><br/>
-The following picture show a sample offer letter. I have labeled the variable content with blod and color style.<br/><br/>
-<img src="image/offer-letter-sample.png" ><br/><br/> 
-This offer was generated on "2011-01-20". It also can be in any other date, so this text content should be replaced by a date field. "Tom King" is the receiver, this name can be replaced with a variable field, then we can send it to any other perpson. Similarly, "software engineer" is the job title of "Tom King", "R&D" is the branch which he belongs to, and "2011-03-12" is his onboard date, all of them should be replaced by variable field in a template document.<br/><br/> 
-Salary and allowance are more complex. Different job titles and branches have different rules. Simplicity, we assume that except "Secretary" is 5,500,00, all of the other job titles are 6,000.00. We also assume that employees from "Sales" don't have allowance. Condition field or Hidden Text field is needed to realize these rules. The same as certificates/testimonials, for campus hires, they need supply "Educational certificates", while for professinal hires, they need supply "Experience certificates from previous employers" and "Copy of resignation/acceptation letter and relieving letter". This is another use case of condition field.<br/><br/>
-After replaced all of these variable content with fields, the template document is ready. The process of generate new offer letter is very simple. Only need to load the following data, update the variable values with the data and save as a new document. <br/><br/>
-<img src="image/candidate-data.png" ><br/><br/>
-No need text content search, no need target replace. It's faster than the content replace way. Beside, the variable content is highlighted automatically by Symphony or Open Office when the document is opend. The following is a generated letter sample.<br/><br/>
-<img src="image/generated-offer-letter.png" ><br/><br/>
-As using fields, the new offer letter is easily updated without inconsistent, even though after generated. You can do it in Symphony or Open Office.
-</p>
-</div>
-<hr/>
-<div class="contenttitle">
-    <a name="codeintroduction">Code Introduction</a>
-</div>
-<div class="bodytext">
-    <p>
-	There are two methods in the class, <code>createFieldTemplate()</code> is used to create template document from sample, and <code>generateOfferLetterDocument()</code> is used to generated new document using template and data file.<br/>
-	<!--java code-->
-    <pre class="brush:java;">
-	public static void main(String[] args) {
-		try {
-			// create offer letter template with sample offer letter.
-			createFieldTemplate();
-			// generate offer letters for the candidates from spreadsheet document.
-			generateOfferLetterDocument();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-    </pre>
-    </p>
-    <p>Below is the source code of method <code>createFieldTemplate()</code>. The basic process is find the variable content and replace it with a field. We use <code>FixedDateField</code>, <code>UserVariableField</code>, <code>ConditionField</code> and <code>HiddenTextField</code> in this method. Simple ODF API provides more types of fields. For more information, please reference the <a href="../javadoc/index.html"><img src="../images/link.png"></img>Javadoc</a> or <a href="../cookbook/index.html"><img src="../images/link.png"></img>CookBook</a>.<br/>
-    <!--java code-->
-    <pre class="brush:java;">
-	public static void createFieldTemplate() throws Exception {
-		TextDocument sampleDocument = TextDocument.loadDocument("Tom's Offer.odt");
-		// replace offer date with FixedDateField
-		TextNavigation search = new TextNavigation("2011-01-20", sampleDocument);
-		while (search.hasNext()) {
-			TextSelection item = (TextSelection) search.nextSelection();
-			FieldSelection fieldSelection = new FieldSelection(item);
-			fieldSelection.replaceWithSimpleField(Field.FieldType.FIXED_DATE_FIELD);
-		}
-		// replace candidate name with UserVariableField
-		VariableField candidateVar = Fields.createUserVariableField(sampleDocument, "candidateVar", "Tom King");
-		search = new TextNavigation("Tom King", sampleDocument);
-		while (search.hasNext()) {
-			TextSelection item = (TextSelection) search.nextSelection();
-			FieldSelection fieldSelection = new FieldSelection(item);
-			fieldSelection.replaceWithVariableField(candidateVar);
-		}
-		// replace job title with UserVariableField
-		VariableField jobTitleVar = Fields.createUserVariableField(sampleDocument, "jobTitleVar", "software engineer");
-		search = new TextNavigation("software engineer", sampleDocument);
-		while (search.hasNext()) {
-			TextSelection item = (TextSelection) search.nextSelection();
-			FieldSelection fieldSelection = new FieldSelection(item);
-			fieldSelection.replaceWithVariableField(jobTitleVar);
-		}
-		// replace branch with UserVariableField
-		VariableField branchVar = Fields.createUserVariableField(sampleDocument, "branchVar", "R&D");
-		search = new TextNavigation("R&D", sampleDocument);
-		while (search.hasNext()) {
-			TextSelection item = (TextSelection) search.nextSelection();
-			FieldSelection fieldSelection = new FieldSelection(item);
-			fieldSelection.replaceWithVariableField(branchVar);
-		}
-		// replace onboard date with UserVariableField
-		VariableField onBoardDateVar = Fields.createUserVariableField(sampleDocument, "onBoardDateVar", "2011-03-12");
-		search = new TextNavigation("2011-03-12", sampleDocument);
-		while (search.hasNext()) {
-			TextSelection item = (TextSelection) search.nextSelection();
-			FieldSelection fieldSelection = new FieldSelection(item);
-			fieldSelection.replaceWithVariableField(onBoardDateVar);
-		}
-		// replace salary with ConditionField
-		search = new TextNavigation("6,000.00", sampleDocument);
-		while (search.hasNext()) {
-			TextSelection item = (TextSelection) search.nextSelection();
-			FieldSelection fieldSelection = new FieldSelection(item);
-			fieldSelection.replaceWithConditionField("jobTitleVar != \"Secretary\"", "6,000.00", "5,500.00");
-		}
-		// replace consolidated allowance with HiddenTextField
-		search = new TextNavigation(" and a Consolidated Allowance of 400\\$ per month", sampleDocument);
-		while (search.hasNext()) {
-			TextSelection item = (TextSelection) search.nextSelection();
-			FieldSelection fieldSelection = new FieldSelection(item);
-			fieldSelection.replaceWithHiddenTextField("branchVar == \"Sales\"", " and a Consolidated Allowance of 400$ per month");
-		}
-		// replace certificates/testimonials with ConditionField
-		Fields.createUserVariableField(sampleDocument, "campusHireVar", "N");
-		search = new TextNavigation("\\* Educational certificates", sampleDocument);
-		while (search.hasNext()) {
-			TextSelection item = (TextSelection) search.nextSelection();
-			FieldSelection fieldSelection = new FieldSelection(item);
-			fieldSelection
-					.replaceWithConditionField(
-							"campusHireVar == \"Y\"",
-							"* Educational certificates",
-							"* Experience certificates from previous employers\n* Copy of resignation/acceptation letter and relieving letter");
-		}
-		sampleDocument.save("OfferTemplate.odt");
-	}
-    </pre>
-</p>
-<p>Method <code>generateOfferLetterDocument()</code> is easier. Just load the template document and data docuemnt and fill new value to all of the variables. <code>getVariableFieldByName()</code> is a method of <code>VariableContainer</code> used to iterate variable field by name.
-<br/>
-    <!--java code-->
-    <pre class="brush:java;">
-	public static void generateOfferLetterDocument() throws Exception {
-		TextDocument templateDocument = TextDocument.loadDocument("OfferTemplate.odt");
-		SpreadsheetDocument dataDocument = SpreadsheetDocument.loadDocument("Candidates.ods");
-		Table table = dataDocument.getTableByName("Sheet1");
-		int rowCount = table.getRowCount();
-		for(int i = 1; i &lt rowCount; i++)
-		{
-			Row row = table.getRowByIndex(i);
-			String name = row.getCellByIndex(0).getDisplayText();
-			VariableField candidateVar = templateDocument.getVariableFieldByName("candidateVar");
-			candidateVar.updateField(name, null);
-			String jobTitle = row.getCellByIndex(1).getDisplayText();
-			VariableField jobTitleVar = templateDocument.getVariableFieldByName("jobTitleVar");
-			jobTitleVar.updateField(jobTitle, null);
-			String branch = row.getCellByIndex(2).getDisplayText();
-			VariableField branchVar = templateDocument.getVariableFieldByName("branchVar");
-			branchVar.updateField(branch, null);
-			String isCampusHire = row.getCellByIndex(3).getDisplayText();
-			VariableField campusHireVar = templateDocument.getVariableFieldByName("campusHireVar");
-			campusHireVar.updateField(isCampusHire, null);
-			String onBoradDate = row.getCellByIndex(4).getDisplayText();
-			VariableField onBoardDateVar = templateDocument.getVariableFieldByName("onBoardDateVar");
-			onBoardDateVar.updateField(onBoradDate, null);
-			templateDocument.save(name+"'s offer letter.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.5</a>.
-  </p>
-  <p>
-    You can download the code of this demo from <a href="demo7.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">
+
+<p>var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-22366020-1']);
+  _gaq.push(['_trackPageview']);</p>
+<p>(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);
+  })();</p>
+<p></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> &gt; 
+        <a href="demo7.html">Demo 6: Offer Letter with Text Fields<a>
+        </span> 
+        </div></p>
+<div class="codehilite"><pre>    <span class="sr">&lt;!----------------------------------------------------------------------------------------------------&gt;</span>
+</pre></div>
 
 
+<p><div class="contenttitle">
+    <a name="overview">Overview</a>
+</div>
+<div class="bodytext">
+    <p> We have introduced several samples about how to use Simple ODF API to generate document from the predefined templete, for example, <a href="demo3.html"><img src="../images/link.png">Demo 3: Navigation API in Hotel Receipt</a>. I believe you have known how easy it is. But sounds like, we never talk about how to create a template document using  Simple ODF API. <br/><br/>
+Today, let's do it.<br/><br/>
+Simple ODF API provides Fields API since version 0.5. OpenDocument text documents or OpenDocument text content embedded in other types of documents may contain variable text elements called fields. Fields are commonly used for, a page number field displays the number of the page on which it appears or a creation date field displays the date on which a document was created. Besides, there are several advance field, such as, variable field and condition field.<br/><br/>
+This demo provides a Java application which can create the offer letter template document from a sample and use it to generate new offer letters with the information from a spreadsheet. The template document contains some fields whose content is decided by the information from data file.<br/><br/>
+The following picture show a sample offer letter. I have labeled the variable content with blod and color style.<br/><br/>
+<img src="image/offer-letter-sample.png" ><br/><br/> 
+This offer was generated on "2011-01-20". It also can be in any other date, so this text content should be replaced by a date field. "Tom King" is the receiver, this name can be replaced with a variable field, then we can send it to any other perpson. Similarly, "software engineer" is the job title of "Tom King", "R&amp;D" is the branch which he belongs to, and "2011-03-12" is his onboard date, all of them should be replaced by variable field in a template document.<br/><br/> 
+Salary and allowance are more complex. Different job titles and branches have different rules. Simplicity, we assume that except "Secretary" is 5,500,00, all of the other job titles are 6,000.00. We also assume that employees from "Sales" don't have allowance. Condition field or Hidden Text field is needed to realize these rules. The same as certificates/testimonials, for campus hires, they need supply "Educational certificates", while for professinal hires, they need supply "Experience certificates from previous employers" and "Copy of resignation/acceptation letter and relieving letter". This is another use case of condition field.<br/><br/>
+After replaced all of these variable content with fields, the template document is ready. The process of generate new offer letter is very simple. Only need to load the following data, update the variable values with the data and save as a new document. <br/><br/>
+<img src="image/candidate-data.png" ><br/><br/>
+No need text content search, no need target replace. It's faster than the content replace way. Beside, the variable content is highlighted automatically by Symphony or Open Office when the document is opend. The following is a generated letter sample.<br/><br/>
+<img src="image/generated-offer-letter.png" ><br/><br/>
+As using fields, the new offer letter is easily updated without inconsistent, even though after generated. You can do it in Symphony or Open Office.
+</p>
+</div>
+<hr/>
+<div class="contenttitle">
+    <a name="codeintroduction">Code Introduction</a>
+</div>
+<div class="bodytext">
+    <p>
+    There are two methods in the class, <code>createFieldTemplate()</code> is used to create template document from sample, and <code>generateOfferLetterDocument()</code> is used to generated new document using template and data file.<br/>
+    <!--java code-->
+    <pre class="brush:java;">
+    public static void main(String[] args) {
+        try {
+            // create offer letter template with sample offer letter.
+            createFieldTemplate();
+            // generate offer letters for the candidates from spreadsheet document.
+            generateOfferLetterDocument();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    </pre>
+    </p>
+    <p>Below is the source code of method <code>createFieldTemplate()</code>. The basic process is find the variable content and replace it with a field. We use <code>FixedDateField</code>, <code>UserVariableField</code>, <code>ConditionField</code> and <code>HiddenTextField</code> in this method. Simple ODF API provides more types of fields. For more information, please reference the <a href="../javadoc/index.html"><img src="../images/link.png"></img>Javadoc</a> or <a href="../cookbook/index.html"><img src="../images/link.png"></img>CookBook</a>.<br/>
+    <!--java code-->
+    <pre class="brush:java;">
+    public static void createFieldTemplate() throws Exception {
+        TextDocument sampleDocument = TextDocument.loadDocument("Tom's Offer.odt");
+        // replace offer date with FixedDateField
+        TextNavigation search = new TextNavigation("2011-01-20", sampleDocument);
+        while (search.hasNext()) {
+            TextSelection item = (TextSelection) search.nextSelection();
+            FieldSelection fieldSelection = new FieldSelection(item);
+            fieldSelection.replaceWithSimpleField(Field.FieldType.FIXED_DATE_FIELD);
+        }
+        // replace candidate name with UserVariableField
+        VariableField candidateVar = Fields.createUserVariableField(sampleDocument, "candidateVar", "Tom King");
+        search = new TextNavigation("Tom King", sampleDocument);
+        while (search.hasNext()) {
+            TextSelection item = (TextSelection) search.nextSelection();
+            FieldSelection fieldSelection = new FieldSelection(item);
+            fieldSelection.replaceWithVariableField(candidateVar);
+        }
+        // replace job title with UserVariableField
+        VariableField jobTitleVar = Fields.createUserVariableField(sampleDocument, "jobTitleVar", "software engineer");
+        search = new TextNavigation("software engineer", sampleDocument);
+        while (search.hasNext()) {
+            TextSelection item = (TextSelection) search.nextSelection();
+            FieldSelection fieldSelection = new FieldSelection(item);
+            fieldSelection.replaceWithVariableField(jobTitleVar);
+        }
+        // replace branch with UserVariableField
+        VariableField branchVar = Fields.createUserVariableField(sampleDocument, "branchVar", "R&amp;D");
+        search = new TextNavigation("R&amp;D", sampleDocument);
+        while (search.hasNext()) {
+            TextSelection item = (TextSelection) search.nextSelection();
+            FieldSelection fieldSelection = new FieldSelection(item);
+            fieldSelection.replaceWithVariableField(branchVar);
+        }
+        // replace onboard date with UserVariableField
+        VariableField onBoardDateVar = Fields.createUserVariableField(sampleDocument, "onBoardDateVar", "2011-03-12");
+        search = new TextNavigation("2011-03-12", sampleDocument);
+        while (search.hasNext()) {
+            TextSelection item = (TextSelection) search.nextSelection();
+            FieldSelection fieldSelection = new FieldSelection(item);
+            fieldSelection.replaceWithVariableField(onBoardDateVar);
+        }
+        // replace salary with ConditionField
+        search = new TextNavigation("6,000.00", sampleDocument);
+        while (search.hasNext()) {
+            TextSelection item = (TextSelection) search.nextSelection();
+            FieldSelection fieldSelection = new FieldSelection(item);
+            fieldSelection.replaceWithConditionField("jobTitleVar != "Secretary"", "6,000.00", "5,500.00");
+        }
+        // replace consolidated allowance with HiddenTextField
+        search = new TextNavigation(" and a Consolidated Allowance of 400\$ per month", sampleDocument);
+        while (search.hasNext()) {
+            TextSelection item = (TextSelection) search.nextSelection();
+            FieldSelection fieldSelection = new FieldSelection(item);
+            fieldSelection.replaceWithHiddenTextField("branchVar == "Sales"", " and a Consolidated Allowance of 400$ per month");
+        }
+        // replace certificates/testimonials with ConditionField
+        Fields.createUserVariableField(sampleDocument, "campusHireVar", "N");
+        search = new TextNavigation("\<em> Educational certificates", sampleDocument);
+        while (search.hasNext()) {
+            TextSelection item = (TextSelection) search.nextSelection();
+            FieldSelection fieldSelection = new FieldSelection(item);
+            fieldSelection
+                    .replaceWithConditionField(
+                            "campusHireVar == "Y"",
+                            "</em> Educational certificates",
+                            "<em> Experience certificates from previous employersn</em> Copy of resignation/acceptation letter and relieving letter");
+        }
+        sampleDocument.save("OfferTemplate.odt");
+    }
+    </pre>
+</p>
+<p>Method <code>generateOfferLetterDocument()</code> is easier. Just load the template document and data docuemnt and fill new value to all of the variables. <code>getVariableFieldByName()</code> is a method of <code>VariableContainer</code> used to iterate variable field by name.
+<br/>
+    <!--java code-->
+    <pre class="brush:java;">
+    public static void generateOfferLetterDocument() throws Exception {
+        TextDocument templateDocument = TextDocument.loadDocument("OfferTemplate.odt");
+        SpreadsheetDocument dataDocument = SpreadsheetDocument.loadDocument("Candidates.ods");
+        Table table = dataDocument.getTableByName("Sheet1");
+        int rowCount = table.getRowCount();
+        for(int i = 1; i &amp;lt rowCount; i++)
+        {
+            Row row = table.getRowByIndex(i);
+            String name = row.getCellByIndex(0).getDisplayText();
+            VariableField candidateVar = templateDocument.getVariableFieldByName("candidateVar");
+            candidateVar.updateField(name, null);
+            String jobTitle = row.getCellByIndex(1).getDisplayText();
+            VariableField jobTitleVar = templateDocument.getVariableFieldByName("jobTitleVar");
+            jobTitleVar.updateField(jobTitle, null);
+            String branch = row.getCellByIndex(2).getDisplayText();
+            VariableField branchVar = templateDocument.getVariableFieldByName("branchVar");
+            branchVar.updateField(branch, null);
+            String isCampusHire = row.getCellByIndex(3).getDisplayText();
+            VariableField campusHireVar = templateDocument.getVariableFieldByName("campusHireVar");
+            campusHireVar.updateField(isCampusHire, null);
+            String onBoradDate = row.getCellByIndex(4).getDisplayText();
+            VariableField onBoardDateVar = templateDocument.getVariableFieldByName("onBoardDateVar");
+            onBoardDateVar.updateField(onBoradDate, null);
+            templateDocument.save(name+"'s offer letter.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.5</a>.
+  </p>
+  <p>
+    You can download the code of this demo from <a href="demo7.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/demo8.html
==============================================================================
--- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo8.html (original)
+++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/demo/demo8.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" 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>
 
@@ -67,69 +36,267 @@
   </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="demo8.html">Demo 7: Add 2D barcode image to a slide<a>

-		</span> 

-		</div>

-		

-		<!---------------------------------------------------------------------------------------------------->	

-<div class="contenttitle">

-    <a name="overview">Overview</a>

-</div>

-<div class="bodytext">

-    <p>This demo shows the power of image and metadata support in Simple ODF.<br /><br/>

-	A 2D bar code is a special image that can be scanned by a smart phone or a dedicated scanner. It could contain a URL, a books ISBN number a vCard for a person's contact, information, etc. It makes it easy to transfer information into a smartphone from a physical object, like a printed document, or a newspaper or magazine.<br /><br/>
	In this demo, the contact information of a document's author has been put in the metadata of a presentation document, with an ODF editor, such as IBM Lotus Symphony. The contact information in the metadata is extracted with the Simple ODF API, and wrapped into JSON object. Then a RESTful web service is called to generate a 2D bar code image based on this JSON object. 
	The bar code image is then added to the first slide of this presentation using the Simple ODF API.<br /><br/>
	
	This picture shows how the contact information is added to the metadata of this document.<br /><br/>

-<img src="image/demo8_metadata.bmp" ></img><br/>
<br />This picture shows the 2D bar code image added to the first slide of this presentation document.<br /><br/> 
<img src="image/demo8_slide.bmp" ></img><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 simple. First, we load the presentation document, and extract the metadata with Simple ODF API. Second, we invoke the web service to generate the bar code image and get the URI of this image. 

-	Finally, we get the subtitle text box in the first slide, add an image just below of this subtitle text box. Please note how FrameRectangle is used to specify the image position.<br /><br/>

-    <!--java code-->

-    <pre class="brush:java;">

-	public static void main(String[] args) {

-		try {
			//load the presentation
			PresentationDocument presentation = PresentationDocument.loadDocument("Demotemplate.odp");
			//get the metadata
			Meta metaData = new Meta(presentation.getMetaDom());
			String creator = metaData.getCreator();
			String mailto = metaData.getUserDefinedDataValue("Email");
			String phoneno = metaData.getUserDefinedDataValue("Phone");

			//invoke the 2D barcode service, and get the url
			BarcodeImageGeneration demo = new BarcodeImageGeneration();
			String url = demo.invokepost(creator,mailto,phoneno);
			
			//Add the image to the first slide
			Slide slide = presentation.getSlideByIndex(0);
			Textbox subtitleBox = slide.getTextboxByUsage(PresentationClass.SUBTITLE).get(0);
			FrameRectangle subtitleRect = subtitleBox.getRectangle();
			Image image = Image.newImage(slide, new URI(url));
			FrameRectangle imageRect = image.getRectangle();
			imageRect.setX(subtitleRect.getX()+(subtitleRect.getWidth()-imageRect.getWidth())/2);
			imageRect.setY(subtitleRect.getY()+subtitleRect.getHeight());
			image.setRectangle(imageRect);
			
			presentation.save("output.odp");

		} catch (Exception e) {
			e.printStackTrace();
		}

-	}

-    </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.5.5</a>.

-  </p>

-  <p>

-    You can download the code of this demo from <a href="TwoDBarcodeDemo.zip"><img src="../images/link.png"></img>here</a>.

-  </p>

-  <p>

    The dependent library jslib.zip can be downloaded from <a href="http://puzzle.dl.sourceforge.net/sourceforge/xulmaker/jslib.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="demo8.html">Demo 7: Add 2D barcode image to a slide<a>
+
+</span>
+
+</div>
+
+<!---------------------------------------------------------------------------------------------------->
 
+<div class="contenttitle">
 
+<a name="overview">Overview</a>
+
+</div>
+
+<div class="bodytext">
+
+<p>This demo shows the power of image and metadata support in Simple ODF.<br /><br/>
+
+A 2D bar code is a special image that can be scanned by a smart phone or a dedicated scanner. It could contain a URL, a books ISBN number a vCard for a person's contact, information, etc. It makes it easy to transfer information into a smartphone from a physical object, like a printed document, or a newspaper or magazine.<br /><br/>
+    In this demo, the contact information of a document's author has been put in the metadata of a presentation document, with an ODF editor, such as IBM Lotus Symphony. The contact information in the metadata is extracted with the Simple ODF API, and wrapped into JSON object. Then a RESTful web service is called to generate a 2D bar code image based on this JSON object. 
+    The bar code image is then added to the first slide of this presentation using the Simple ODF API.<br /><br/>
+
+This picture shows how the contact information is added to the metadata of this document.<br /><br/>
+
+<img src="image/demo8_metadata.bmp" ></img><br/>
+<br />This picture shows the 2D bar code image added to the first slide of this presentation document.<br /><br/> 
+<img src="image/demo8_slide.bmp" ></img><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 simple. First, we load the presentation document, and extract the metadata with Simple ODF API. Second, we invoke the web service to generate the bar code image and get the URI of this image.
+
+Finally, we get the subtitle text box in the first slide, add an image just below of this subtitle text box. Please note how FrameRectangle is used to specify the image position.<br /><br/>
+
+<!--java code-->
+
+<pre class="brush:java;">
+
+public static void main(String[] args) {
+
+try {
+            //load the presentation
+            PresentationDocument presentation = PresentationDocument.loadDocument("Demotemplate.odp");
+            //get the metadata
+            Meta metaData = new Meta(presentation.getMetaDom());
+            String creator = metaData.getCreator();
+            String mailto = metaData.getUserDefinedDataValue("Email");
+            String phoneno = metaData.getUserDefinedDataValue("Phone");
+
+//invoke the 2D barcode service, and get the url
+            BarcodeImageGeneration demo = new BarcodeImageGeneration();
+            String url = demo.invokepost(creator,mailto,phoneno);
+
+//Add the image to the first slide
+            Slide slide = presentation.getSlideByIndex(0);
+            Textbox subtitleBox = slide.getTextboxByUsage(PresentationClass.SUBTITLE).get(0);
+            FrameRectangle subtitleRect = subtitleBox.getRectangle();
+            Image image = Image.newImage(slide, new URI(url));
+            FrameRectangle imageRect = image.getRectangle();
+            imageRect.setX(subtitleRect.getX()+(subtitleRect.getWidth()-imageRect.getWidth())/2);
+            imageRect.setY(subtitleRect.getY()+subtitleRect.getHeight());
+            image.setRectangle(imageRect);
+
+presentation.save("output.odp");
+
+} catch (Exception e) {
+            e.printStackTrace();
+        }
+
+}
+
+</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.5.5</a>.
+
+</p>
+
+<p>
+
+You can download the code of this demo from <a href="TwoDBarcodeDemo.zip"><img src="../images/link.png"></img>here</a>.
+
+</p>
+
+<p>
+
+The dependent library jslib.zip can be downloaded from <a href="http://puzzle.dl.sourceforge.net/sourceforge/xulmaker/jslib.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>
+
+</body>
+
+</html>
   </div>
 
   <div id="footera">



Mime
View raw message