incubator-odf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From devin...@apache.org
Subject svn commit: r1163119 [1/2] - in /incubator/odf/site/trunk/content/odftoolkit/simple/demo: ./ image/ scripts/ styles/
Date Tue, 30 Aug 2011 07:36:19 GMT
Author: devinhan
Date: Tue Aug 30 07:36:17 2011
New Revision: 1163119

URL: http://svn.apache.org/viewvc?rev=1163119&view=rev
Log:
add simple demo

Added:
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/Navigation-for-ODF.zip   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationAssembler.zip   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationCombination.zip   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/TextboxDemo.zip   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/TwoDBarcodeDemo.zip   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.zip   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo2.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo3.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo4.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo5.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo6.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.zip   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo8.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo9.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo9.zip   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/ExtractedNotes.JPG   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/Generated ODT small.jpg   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/Generated ODT.jpg   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/ODT Templating.jpg   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/PresCombine.jpg   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/Thumbs.db   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/candidate-data.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo10.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo10_small.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo4_code_list.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo4_code_table.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo4_organization_list.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo4_organization_list_small.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo4_organization_table.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo5_doc small.jpg   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo5_doc.jpg   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo6-small.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo6.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo7_small.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo8_small.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo9_small.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo9p.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo9s.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/demo9t.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/generated-offer-letter.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/image/offer-letter-sample.png   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/index.html   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/scripts/
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/scripts/shBrushJava.js   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/scripts/shCore.js   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/styles/
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/styles/shCoreEclipse.css   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/stylesheet.css   (with props)
    incubator/odf/site/trunk/content/odftoolkit/simple/demo/table_list_convertion.zip   (with props)

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/Navigation-for-ODF.zip
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/Navigation-for-ODF.zip?rev=1163119&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/Navigation-for-ODF.zip
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/Navigation-for-ODF.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationAssembler.zip
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationAssembler.zip?rev=1163119&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationAssembler.zip
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationAssembler.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationCombination.zip
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationCombination.zip?rev=1163119&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationCombination.zip
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/PresentationCombination.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/TextboxDemo.zip
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/TextboxDemo.zip?rev=1163119&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/TextboxDemo.zip
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/TextboxDemo.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/TwoDBarcodeDemo.zip
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/TwoDBarcodeDemo.zip?rev=1163119&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/TwoDBarcodeDemo.zip
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/TwoDBarcodeDemo.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.html
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.html?rev=1163119&view=auto
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.html (added)
+++ incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.html Tue Aug 30 07:36:17 2011
@@ -0,0 +1,152 @@
+<!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();
+
+		}
+		// 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>
+</body>
+</html> 

+

+

+

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.html
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.zip
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.zip?rev=1163119&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.zip
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo10.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo2.html
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo2.html?rev=1163119&view=auto
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo2.html (added)
+++ incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo2.html Tue Aug 30 07:36:17 2011
@@ -0,0 +1,426 @@
+<!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> 
+
+

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo2.html
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo3.html
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo3.html?rev=1163119&view=auto
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo3.html (added)
+++ incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo3.html Tue Aug 30 07:36:17 2011
@@ -0,0 +1,319 @@
+<!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> 
+
+
+

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo3.html
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo4.html
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo4.html?rev=1163119&view=auto
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo4.html (added)
+++ incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo4.html Tue Aug 30 07:36:17 2011
@@ -0,0 +1,429 @@
+<!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> 
+
+
+
+

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo4.html
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo5.html
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo5.html?rev=1163119&view=auto
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo5.html (added)
+++ incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo5.html Tue Aug 30 07:36:17 2011
@@ -0,0 +1,231 @@
+<!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="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>
+</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> 
+
+
+

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo5.html
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo6.html
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo6.html?rev=1163119&view=auto
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo6.html (added)
+++ incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo6.html Tue Aug 30 07:36:17 2011
@@ -0,0 +1,139 @@
+<!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="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>
+</body>
+</html> 
+
+
+

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo6.html
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.html
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.html?rev=1163119&view=auto
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.html (added)
+++ incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.html Tue Aug 30 07:36:17 2011
@@ -0,0 +1,221 @@
+<!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="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>
+</body>
+</html> 
+
+
+

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.html
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.zip
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.zip?rev=1163119&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.zip
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo7.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo8.html
URL: http://svn.apache.org/viewvc/incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo8.html?rev=1163119&view=auto
==============================================================================
--- incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo8.html (added)
+++ incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo8.html Tue Aug 30 07:36:17 2011
@@ -0,0 +1,98 @@
+<!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> 

+

+

+

Propchange: incubator/odf/site/trunk/content/odftoolkit/simple/demo/demo8.html
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message