Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/ReleaseNotes.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/ReleaseNotes.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/ReleaseNotes.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,235 @@ + + + + + + + +Simple API Release Notes + + + + + + +
+ +
+

General

+ +

Components

+ +

Community

+ +

Development

+ +

PPMC

+ +

ASF

+ +
+
+ +

Simple API Release Notes

+

What is the Simple Java API for ODF?

+

The Simple Java API for ODF is an easy-to-use, high-level Java API for creating, modifying and extracting data from ODF 1.2 documents. It is written in pure Java and does not require that you install any document editor on your system. The Simple Java API for ODF is a high level abstraction of the lower-level ODFDOM API.

+

New Release 0.6.6

+

We are pleased to announce the release of the Simple Java API for ODF version 0.6.6 on Auguest 12th. The improvements in this version include:

+ +

You can download it here. The full release notes can be found here.

+

You are welcomed to give us any feedback by Bugzilla, eMail or forum.

+

Project roadmap and schedule

+

The Simple Java API for ODF adhears to the "Release Early and Often" development philosophy. We will target a monthly release, for the end of each month. Code that is ready makes it into that month's release. Code that is not yet ready will wait.

+

Proposed Roadmap:

+ +

More work will be started in Apache.

+

Frequently Asked Questions

+

For Users

+

How to download and install

+

You can get Simple Java API for ODF as binary distribution from the [http://odftoolkit.org/projects/simple/downloads download] area. There you'll find Javadocs as well. To obtain source code, please refer to [[#download_source|development section]].

+

How to start development

+

I suggest you to start from an overview of this project. [[PackageLayer|This page]] will give you an overall introduction of the package structures. After that, you can go to the [http://simple.odftoolkit.org/cookbook/ Cookbook] and [http://simple.odftoolkit.org/ Demos] to read some code samples. And then, you can start your own program to manipulate ODF document.

+

If you are familar with ODFDOM, [http://odftoolkit.org/projects/simple/pages/PackageLayer#APIchanges Here] are the API changes from ODFDOM.

+

Prerequisites

+

In addition to the Simple Java API JAR file you will need to download and install the following runtime prerequisite:

+ +

Code examples

+

You can find sample codes from our [http://simple.odftoolkit.org/ Cookbook] and [http://simple.odftoolkit.org/ Demos].

+

The Simple Java API for ODF uses Bugzilla to track the defects. You can report defects [http://odftoolkit.org/bugzilla/buglist.cgi?product=simple&order=bugs.bug_id here].

+

===For Developers===

+

How to download source

+

First, install [http://mercurial.selenic.com/wiki/ latest Mercurial]

+

Second, setup Mercurial (optional):
Config file Mercurial.ini on Windows or /.hgrc on Unix. +Enhance the default configuration, using GIT diff and enable [http://mercurial.selenic.com/wiki/Win32TextExtension default plugin] avoid different line breaks in the source.

+
[ui]
+username = your Name <yourLoginName@odftoolkit.org>
+;merge = your-merge-program (or internal:merge)
+
+[diff]
+git = 1
+
+[defaults]
+diff=-p -U 8
+
+[extensions]
+# Enables mercurial EOL extension for line break handling
+# See http://mercurial.selenic.com/wiki/EolExtension (bundled since 1.5.4)
+eol =
+
+# It'll remove unknown files and empty directories by default. 
+# Usually you call 'hg update -C' and 'hg purge' in sequence
+# See http://mercurial.selenic.com/wiki/PurgeExtension  (bundled)
+hgext.purge=
+
+[eol]
+# Converts mixed line ending within a file to LF (Unix) format 
+# before adding the file to the source repository
+# See http://mercurial.selenic.com/wiki/EolExtension
+only-consistent = False
+
+ + +

Now, get the source code from the Simple project [http://www.selenic.com/mercurial/wiki/ Mercurial] repository. Please see below for a short introduction to using Mercurial on odftoolkit.org. There's also a more general help on how to use source control systems on odftoolkit.org. The command

+hg clone https://hg.odftoolkit.org/hg/simple~code-base
will download the repository into a new directory.
Please note that by this you'll get the latest changeset. If you for example want stable release 0.2, you may want to use
hg clone https://odftoolkit.org/hg/simple~code-base -r v0.2
Developers however always work on the latest changeset.

+

====How to build and run the unit tests===== +After the source code is checked out, now get and install [http://maven.apache.org/ Apache Maven]. On command line test your installation with "mvn -v".

+

If Maven is correctly installed, change into the project directory and build with command "mvn".

+

==Communications== +You can subscribe to the project's mailing lists from [http://odftoolkit.org/projects/simple/lists this page]. The "users" list is for discussions about using the toolkit, and the "dev" list is for discussing the development of the toolkit. Active developers should also subscribe to the "issues" and "commit" mailing lists so they will receive those automatic notifications.

+

==Easy entry level tasks== +TBD

+

==Design of the API== +The design principle is "make it easy for users to locate the functions they want".

+

org.odftoolkit.simple.Document is the abstract base class which the specific document classes are derived from: TextDocument, SpreadsheetDocument, PresentationDocument, GraphicsDocument and ChartDocument.

+

For each document type we have a subpackage that contain additional classes related to that kind of documents. So org.odftoolkit.simple.chart has classes related to chart, org.odftoolkit.simple.text has classes related to text content, and org.odftoolkit.simple.presentation has classes related to presentation documents.

+

Besides the packages for different document types, there are additional packages defined for important common ODF features which are available across all kinds of documents, such as table, meta and style.

+

There is another package named org.odftoolkit.simple.common, which contains functions that are not related with a specific document type nor a specific feature. For example, the text extractor functions are put in this package.

+

==How to contribute patches== +If you want to contribute a patch to this project, following below steps:

+ +

How to review patches

+

As a reviewer, you need to carefully read the source code, run the unit tests, to make sure the new contributed code won't hurt the quality of this project. +Step 1. Write a comment to [http://odftoolkit.org/bugzilla/buglist.cgi?product=simple&order=bugs.bug_id bugzilla], saying you would like to review this patch. +Step 2. Check out the source code following the steps in [[#download_source|development selection]], and download the patch. +Step 3. Merge the patch to the source code with Mecurial command: + hg import --no-commit ../someFile.patch +Step 4. Carefully read the code to make sure the code follows the "[[#Design_of_the_API|Design of the API]]", the code can reach the goal and the code won't bring other problems. +Step 5. Carefully check the unit test code to make sure every public method has been enough tested. +Step 6. Run the unit tests with Maven command to see if all the unit tests pass: + mvn +Step 7. Write comment to bugzilla if you think anything needs to be improved. +Step 8. Repeat step 2 to 7 after the contributor improves the patch. +*Step 9. Push the patch to repository with Mecurial command if you think the patch is good enough: + hg commit -A -u "Developer:xxx Reviewer:yyy" -m "#bug XY# Description of changes" + hg push https://:@odftoolkit.org/hg/simple~code-base

+

Reference material

+

ODF

+

The current draft of the OASIS ODF 1.2 standard can be downloaded [http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office#odf12 here].

+

Commands line tools

+

[http://odftoolkit.org/projects/odfdom/pages/Development#Mercurial Here] is a list of the most frequently used commands for Mercurial. +[http://odftoolkit.org/projects/odfdom/pages/Development#Maven Here] is a list of the most frequently used commands for Maven.

+
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + + Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/Requirements.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/Requirements.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/Requirements.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,306 @@ + + + + + + + + + + + + + + +
+ +
+

General

+ +

Components

+ +

Community

+ +

Development

+ +

PPMC

+ +

ASF

+ +
+
+ + +

==Function analysis== +This page is used to analysis the functions and requirements, and discuss the priority and the project plan.

+

TOC

+

===Requirements Tracking=== +Below are requirements from our users.

+

====Requirements for table (2010.12.20)==== +getRowList/getColumnList, if there is a row element with 65535 repeate number, then get row list will return a list which contains 65535 row element, it is not necessary and time consuming. +memory leak, because of using static map variables (Recorded in bugzilla, 2010.12.21) +use SAX API to get the content/style element as required, rather than load whole dom tree to memory, which might cause out of memory exception if many large document has been loaded in the same time. +create row/column/cell with/without repeat number(for example,if i want to create 10 rows, how to implement it ? with 10 row element or 1 row element with 10 repeate number) +append row/column with/without previous row/column style, there should be a flag for setting it. +cell format type can be auto calculated according to the style of cell

+

====Requirements for section and text box (2010.12.20)==== +repeating sections of data. Repeating section may be to clone a section of a template multiple times for different data. So identify an element(s) in the document and be able to clone it and add it into the document. Think like a block of text in a document (maybe a table or a paragraph) that we grab, copy, repeat x times, and then modify a bookmark inside each section. +text boxes that get a name at design time and something we can call it programmatically and then do something with it (delete, modify, etc.) +*embedded text tagging with multiple levels - tag a paragraph and then tag a section of text within it - so we can turn stuff off, do repeats, and do repeats within the sections.

+

===Functions Collection=== +Follow are functions collected from a perspective of an Office software user.

+

====Cut/copy/paste/selection==== +Select something, cut or copy it, and paste to somewhere else. These operations are easily made in Office softwares, but are hard done in APIs. The functions include: +Create a selection +Create a position +Cut a selection +Copy a selection +Paste a selection to some position +Delete a selection +Part of these functions have been implemented with package org.odftoolkit.simple.common.navigation

+

{|- border="1" +!Functions +!Plan and status +|- +|Create a "selection" +| +|- +|Create a "position" +| +|- +|Cut a selection +| +|- +|Copy a selection +| +|- +|Paste a selection +| +|- +|Delete a selection +| +|}

+

====Navigator/document map==== +With these functions, users can easily go to a certain place in the whole document. These functions can provide methods to get a certain heading, get a certain image, get a certain table and so on. The functions include: +Return a list of main features, such as heading,paragraphs,graphics,table,bookmark,sections,hyperlinks,reference,index,comments,text frames, and draw objects. +get next or previous feature, for example, there is a table under a paragraph, then the API can allow users to get next table after this paragraph. +Part of these functions have been implemented with getTableList() in org.odftoolkit.simple.Document.

+

====Fields==== +With this feature, users can create fields in the document. The available fields include: +Fields are used to insert information about the current document, for example, file name, template, statistics, user data, date, and time. +The references or referenced fields that are referenced fields within the same document or within sub-documents of a master document. +*Variable fields which are dynamic content to the document.

+

The functions include: +Add a field +Edit a field +Navigator among fields +Delete a field

+

====Frame==== +With frame, users can create a layout of one or more columns of text and objects. The functions include: +Set properties to a frame, including names +Delete a frame +Navigator among frames +Add caption

+

=====Text frame===== +The functions include: +Add a text frame +Search a text frame by name

+

=====Graphics===== +With graphics, users can insert a picture or create with shapes. The functions include: +Insert a picture from file +Create shapes +Navigator among images and shapes +Delete images or shapes +Set properties +Add caption

+

====Section==== +Sections are named blocks of text, including graphics or objects. With section, users can: +To prevent text from being edited. +To show or hide text. +To reuse text and graphics from other Lotus? Symphony? documents. +To insert sections of text that uses a different column layout than the current page style. +*Add caption

+

The functions include: +Create Section +Delete Section +Copy and paste section +Navigator through sections +*Set properties of section

+

====Bullet & numbering==== +To create bullet and numbering. The functions include: +Create bullet to paragraphs, including graphics bullets +create numbering to paragraphs +*Set the style properties

+

====Heading==== +To create heading of a document. The functions include: +Create headings +Set styles of headings +*Set outline numbering

+

====Table of Content==== +To create a TOC at some place.

+

====Header/footer==== +With these function, you can set header and footer. +Set header and footer +Set the styles of header and footer

+

====Footnote/endnote==== +With these function, you can create footnote or endnote in your document. +Add the footnote and the endnote +Find the footnote and endnote +*Delete the foontnote and endnote

+

====Hyperlinks==== +With these function, you can create a hyperlink in your document. +Add a hyperlink +Delete a hyperlink +*Find hyperlinks

+

====Break==== +With these function, you can add break characters in your document. +Add breaks +Delete breaks +*Find breaks

+

====Page numbering==== +With these function, you can add page numbering in your document. +Add page numbering +Delete page numbering

+

====Comment==== +With this function, you can add comment to your document. +Add comments +Navigation among comments +*delete comments

+

====Document bookmark==== +To create bookmark +Add bookmark +Navigation through bookmarks +*Delete bookmarks

+

====Fontwork==== +To create a fontwork +Add frontwork +Delete fontwork +*Navigation through fontwork

+

====Chart==== +To create a chart +Add chart +Update chart properties +Update style setting of chart +Navigation through chart +*Delete chart

+

====OLE object==== +To operate OLE object +Add a OLE object +Navigation through OLE object +Delete OLE object +Update OLE object properties

+

====Layout and columns==== +To edit the layout and columns properties +*Set properties of layout

+

====Table==== +To provide functions to manipulate table. Following functions have been provided: +create table +insert row/column +access cell +styles handling +merge cell +delete row/column +numbering format +insert formula

+

=====Filter and validity===== +To provide filter/validity functions to data in a table +Add/delete/update filter +Add/delete/update validity

+

=====Group===== +To group rows or columns +Add group +Delete group

+

=====Data pilot===== +To create or delete data pilot in a spreadsheet document. +Create data pilot +Delete data pilot

+

=====Split===== +To split a cell

+

====Slide==== +To manipulate slides. Following functions have been provided: +Add/delete slides +Navigation through slides +*Merge slides

+

=====Master Slide===== +To manipulate master slides +*update styles of master slides

+

=====Animation===== +To manipulate the animation settings. +Set effects +Set order +*Remove animation setting

+

====Page setup==== +To define the page setup. +Set page orientation +Set page margin

+
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + + Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Cell Range.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Cell Range.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Cell Range.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + + Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Cell.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Cell.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Cell.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,394 @@ + + + + + + + + + +Cell + + + + + + + + + +
+ +
+ + + +
+
+
+
+
+ +
+ + +
+
+
+Get Cell +
+
+
+If you want to get the specified cell in a table,you can use the getCellByPosition method of Table. +
+
+The first parameter is the column index,the second parameter is the row index. +
+
+         TextDocument document = (TextDocument) TextDocument.loadDocument(filePath);
+ Table table=document.getTableByName("stringTable");
+ Cell cell=table.getCellByPosition(1, 1);
+
+
+If you are manipulating a spreadsheet,you can get the cell by its address: +
+
+	 Table sheet1 = document.getTableByName("Sheet1");
+ Cell odsCell=sheet1.getCellByPosition("A1");
+
+
+If you want to get a cell from a row,you can specify the index of the cell in the row. +
+
+	 Row row=table.getRowByIndex(1);
+ Cell cell2=row.getCellByIndex(1);
+ System.out.println(cell2.getStringValue());
+
+
+What can I do if I have a Cell instance and want to know which column and row it belongs to ? +
+
+The code below shows how you can do that: +
+
+	 Row row1=cell.getTableRow();
+ Column column1=cell.getTableColumn();
+
+
+
+Use the getStyleName() method you can get the style name of the cell. +
+
+If you want to change the style,it must be set when you set the display text. +
+
+	 String cellSytle=cell.getStyleName();
+ cell.setDisplayText("content", cellSytle);
+
+
+What can I do if I want to control the display alignment of the cell? +
+
+You can set the horizontal and vertical alignment to do so. +
+
+The code below shows how to get and set the alignment.You can refer to the javadoc about the alignment type. +
+
+	  StyleTypeDefinitions.HorizontalAlignmentType horizontalAlign=cell.getHorizontalAlignmentType();
+ StyleTypeDefinitions.VerticalAlignmentType verticalAlign=cell.getVerticalAlignmentType();
+ cell.setHorizontalAlignment(StyleTypeDefinitions.HorizontalAlignmentType.CENTER);
+ cell.setVerticalAlignment(StyleTypeDefinitions.VerticalAlignmentType.BOTTOM);
+
+
+If the content of the cell is too long,you can set the wrap option of the cell. +
+
+	   cell.setTextWrapped(true);
+
+
+If don't know the cell is wrapped or not,you can use the method: +
+
+	   boolean isTextWrapped=cell.isTextWrapped();
+
+
+If you want to set the background color of the cell,be care that the color type is org.odftoolkit.odfdom.type.Color. +
+
+	    Color cellBackgroundColor=cell.getCellBackgroundColor();
+ cell.setCellBackgroundColor(Color.valueOf("#000000"));
+
+
+How can I control the spanned number of the column/row: +
+
+	    int spannedNum=cell.getcgetColumnSpannedNumber();
+ cell.setColumnSpannedNumber(spannedNum);
+ int rowSpannedNum=cell.getRowSpannedNumber();
+ cell.setRowSpannedNumber(rowSpannedNum);
+
+
+For column,maybe you want to know the column repeated number: +
+
+	    int repeatedNum=cell.getColumnsRepeatedNumber();
+ cell.setColumnsRepeatedNumber(repeatedNum);
+
+
+How about formatting a cell's content? You can set the format string of the cell to do so. +
+
+For example you want to format the date to yyyy-MM-dd ,you can: +
+
+	      String cellFormatStr=cell.getFormatString();
+ cell.setDateValue(new GregorianCalendar(2010,5,1));
+ cell.setFormatString("yyyy-MM-dd");
+
+
+Be care that the setFormatString only works for float, date and percentage. +
+
+You may be confused by the difference between getFormatString and getFormula,the difference is that: +
+
+For the setFormula method,it just sets as a formula attribute,the cell value will not be calculated. +
+
+	      String formula=cell.getFormula();
+ cell.setFormula(formula);
+
+
+How can I clear the content of the cell? +
+
+RemoveContent remove all of the cell while the removeTextContent only remove the text content of the cell. +
+
+	   cell.removeContent();
+ cell.removeTextContent();
+
+
+
+ The cell value can have different types,for the setValueType method: the parameter can be
  • "boolean"
  • "currency"
  • "date"
  • "float"
  • "percentage"
  • "string"
  • "time"
  • "void"
If the parameter type is not a valid cell type, an IllegalArgumentException will be thrown. +
+
+	   String valueType=cell.getValueType();
+ cell.setValueType(valueType);
+
+
+For the following getXXXValue() method:it gets the cell value as xxx type.An IllegalArgumentException will be thrown if the cell type is not xxx. +
+ +
+ For setBooleanValue method:it sets the cell value as a boolean and sets the value type to be boolean. +
+
+	   boolean booleanValue=cell.getBooleanValue();
+ cell.setBooleanValue(booleanValue);
+
+
+
+For the following getting methods,if the value type is not "currency", an IllegalArgumentException will be thrown. +
+
+The currency code of the cell is like "USD", "EUR", "CNY", and the currency symbol is like "$" +
+
+	   String currencyCode=cell.getCurrencyCode();  
+ cell.setCurrencyCode("USD");
+
+
+You can also set currency value and currency format.Please note the overall format includes the symbol character, for example: $#,##0.00. +
+
+	   cell.setCurrencyValue(100.00, "USD");
+ cell.setCurrencyFormat("$", "$#,##0.00");
+
+
+
+	   Calendar dateValue=cell.getDateValue(); 
+ cell.setDateValue(new GregorianCalendar(2010,5,1));
+
+
+
+	  double floatValue=cell.getDoubleValue();  
+ cell.setDoubleValue(new Double(22.99f));
+
+
+
+	  double percentageValue=cell.getPercentageValue();
+ cell.setPercentageValue(0.89);
+
+
+
+If the cell type is not string, the display text will be returned. +
+
+	  String stringValue=cell.getStringValue();   
+ cell.setStringValue("simple");
+
+
+
+If you want to get the string type of time value,you can format it: +
+
+	  cell.setTimeValue(Calendar.getInstance());
+ SimpleDateFormat simpleFormat = new SimpleDateFormat("'PT'HH'H'mm'M'ss'S'");
+ String timeString= simpleFormat.format(cell.getTimeValue().getTime());
+
+
+
+ Please note the display text in ODF viewer might be different from the value set by this method, because the displayed text in ODF viewer is calculated and set by editor. +
+
+	  String displayText=cell.getDisplayText();
+ cell.setDisplayText(displayText);
+
+
+
+Set image +
+
+
+ From version 0.5.5, we support high level APIs for images. You can use following codes to set an image to a cell. +
+
+	    Image myImage = cell.setImage(new URI("http://www.xxx.com/a.jpg"));
+
+
+ You can use following codes to access an image in a cell. +
+
+	    Image image = cell.getImage();
+ String imagename = image.getName();
+ FrameRectangle rect = image.getRectangle();
+ rect.setX(1);
+ rect.setY(1);
+ image.setRectangle(rect);
+
+

+ +
+
+ +
+
+ + +
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + + Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Charts.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Charts.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Charts.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,243 @@ + + + + + + + + + +Charts + + + + + + + + + +
+ +
+ + + +
+
+
+
+
+ +
+ + +
+
+
+Overview +
+
+
+ Since 0.6, Simple ODF provides methods to manipulate charts in text document, spreadsheet document and presentation document. You can create, update and delete charts with these methods. +
+ +
+ We all know, a chart is associated with a table. In order to create a chart, you must determine the data set of this chart. The data set can be a cell range of a table, for example: +
+
+		CellRangeAddressList cellRange = CellRangeAddressList.valueOf("A.A1:A.B3");
+ DataSet dataSet = new DataSet(cellRange, spreadsheetDoc, true, true, false);
+
+
+ Or a two dimensional array, for example: +
+
+		int row = 2, column = 3;
+ double[][] data = new double[column][row];
+ String[] labels = new String[row];
+ String[] legends = new String[column];
+ DataSet dataset = new DataSet(labels, legends, data);
+
+
+ You should also use rectangle to define the position and the size of this chart. For example: +
+
+		Rectangle rect = new Rectangle();
+ rect.x = 2000;
+ rect.y = 2700;
+ rect.width = 15000;
+ rect.height = 8000;
+ rect.y = 110000;
+
+
+ Then you can create a chart: +
+
+		spreadsheetDoc.createChart("Page Visit", dataSet,rect);
+
+
+ There are some shortcut methods to create charts, for example, below codes show how to create a chart in a text document: +
+
+		Chart chart = textDoc.createChart(
+ "Page Visit", spreadsheetDoc,
+ cellRange, true, true, false, rect);
+
+
+ If you want to create a chart in a spreadsheet document, you need to specify a cell to be the anchor of this chart, for example: +
+
+		spreadsheetDoc.createChart("Page Visit", spreadsheetDoc, cellRange,
+ true, true, false, rect, spreadsheetDoc.getTableByName("C")
+ .getCellByPosition("D10"));
+
+
+ If you want to create a chart in a presentation document, you can use the existing layout of a slide, which means, you don't need to specify a rectangle. The layouts that could contain a chart include: TITLE_PLUS_CHART, TITLE_PLUS_2_CHART, TITLE_LEFT_CHART_RIGHT_OUTLINE, TITLE_PLUS_3_OBJECT, and TITLE_PLUS_4_OBJECT. For example: +
+
+		Slide slide = presentationDoc.newSlide(2, "Slide3",
+ SlideLayout.TITLE_PLUS_2_CHART);
+ chart = slide.createChart("Count of Visits", spreadsheetDoc,
+ cellRange, true, true, false, null);
+
+
+
+ You can update charts properties, for example, the title, axis title, chart type, whether to apply 3D effect, whether to use legend with API. For example: +
+
+		chart.setChartTitle("New title");
+ chart.setAxisTitle("Hour", "Number");
+ chart.setChartType(ChartType.AREA);
+ chart.setApply3DEffect(true);
+ chart.setUseLegend(true);
+
+
+ You can update the data set too. For example: +
+
+		chart.setChartData(new DataSet(CellRangeAddressList.valueOf("A.A1:A.C4"), spreadsheetDoc, true, true, true));
+
+
+
+ You can get charts by title e.g. +
+
+		chart = textDoc.getChartByTitle("New title").get(0);
+
+
+ You can also get a chart by its unique ID. The unique ID of a chart in Simple ODF API is the path of the chart document (relative to the ODF document package). The unique ID can be gotten with method: +
+
+		String chartid = chart.getChartID();
+ chart = textDoc.getChartById(chartid);
+
+
+ You can also get the count of charts in this document. +
+
+		int count = textDoc.getChartCount();
+
+
+ You can delete a chart by ID or by title, e.g. +
+
+		textDoc.deleteChartById(chartid);
+ textDoc.deleteChartByTitle("New title");
+
+

+ +
+
+ +
+
+ + +
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + + Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Column and Row.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Column and Row.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Column and Row.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + + Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Fields.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Fields.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Fields.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,280 @@ + + + + + + + + + +Fields + + + + + + + + + +
+ +
+ + + +
+
+
+
+
+ +
+ + +
+ +
+ You can use the following code to create a variable field, and set the value. +
+
+			TextDocument doc = TextDocument.newTextDocument();
+ Paragraph paragraph = doc.addParagraph("test_con_variable:");
+ VariableField simpleVariableField = Fields.createSimpleVariableField(doc, "test_con_variable");
+ simpleVariableField.updateField("true", paragraph.getOdfElement());
+
+
+ Following code can be used to set value to variable field, and append it to an ODF element. +
+
+			simpleVariableField.updateField("user variable content", null);
+ simpleVariableField.displayField(paragraph.getOdfElement());
+
+
+
+ Following code can be used to create a condition field. +
+
+			Paragraph newParagraph = doc.addParagraph("Condition Field Test:");
+ ConditionField conditionField = Fields.createConditionField(newParagraph.getOdfElement(), "test_con_variable == \"true\"",
+ "trueText", "falseText");
+
+
+
+Hidden Field +
+
+
+ Following code can be used to create a hidden field. +
+
+			newParagraph = doc.addParagraph("Hide Text Field Test:");
+ conditionField = Fields.createHiddenTextField(newParagraph.getOdfElement(), "test_con_variable == \"true\"", "hiddenText");
+
+
+
+ Following code can be used to create a reference field. +
+
+			OdfElement newTextSpanElement = ((TextPElement)doc.addParagraph("Reference Content:").getOdfElement()).newTextSpanElement();
+ newTextSpanElement.setTextContent("This is a test reference content.");
+ ReferenceField referenceField = Fields.createReferenceField(newTextSpanElement, "test-ref");
+
+
+ Following code can be used to append a reference field. +
+
+			referenceField.appendReferenceTo(doc.addParagraph("User Reference Field:").getOdfElement(), ReferenceField.DisplayType.TEXT);
+
+
+
+ Following code can be used to create a chapter field. +
+
+			ChapterField chapterField = Fields.createChapterField(doc.addParagraph("Chapter:").getOdfElement());
+
+
+
+ Following code can be used to create a title field. +
+
+			TitleField titleField = Fields.createTitleField(doc.addParagraph("The Title:").getOdfElement());
+
+
+ Following code can be used to create a subject field. +
+
+			SubjectField subjectField = Fields.createSubjectField(doc.addParagraph("The Subject:").getOdfElement());
+
+
+
+Author Field +
+
+
+ Following code can be used to create a author initial field and a author name field. +
+
+			AuthorField authorField = Fields.createAuthorInitialsField(doc.addParagraph("The initials of the author :").getOdfElement());
+ authorField = Fields.createAuthorNameField(doc.addParagraph("Author:").getOdfElement());
+
+
+
+ Following code can be used to create a current page number field. +
+
+			PageNumberField numberField = Fields.createCurrentPageNumberField(doc.addParagraph("Current Page Number:").getOdfElement());
+ numberField.setNumberFormat(NumberFormat.UPPERCASE_LATIN_ALPHABET);
+ numberField.setDisplayPage(DisplayType.NEXT_PAGE);
+
+
+ Following code can be used to create a previous page number and a next page number field. +
+
+			numberField = Fields.createPreviousPageNumberField(doc.addParagraph("Previous Page Number:").getOdfElement());
+ numberField = Fields.createNextPageNumberField(doc.addParagraph("Next Page Number:").getOdfElement());
+
+
+
+ Following code can be used to create a page count field, and set the number format. +
+
+			PageCountField countField = Fields.createPageCountField(doc.addParagraph("Page Count:").getOdfElement());
+ countField.setNumberFormat(NumberFormat.UPPERCASE_LATIN_ALPHABET);
+
+
+
+Date Field +
+
+
+ Following code can be used to create a date field, and set the format. +
+
+			DateField dateField = Fields.createDateField(doc.addParagraph("Date:").getOdfElement());
+ dateField.formatDate("yy-MM-dd");
+
+
+
+Time Field +
+
+
+ Following code can be used to create a time field, and set the format. +
+
+			TimeField timeField = Fields.createTimeField(doc.addParagraph("Time:").getOdfElement());
+ timeField.formatTime("HH:mm:ss a");
+
+

+ +
+
+ +
+
+ + +
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + + Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Manipulate Cell Range.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Manipulate Cell Range.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Manipulate Cell Range.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + + Added: websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Manipulate Cell.html ============================================================================== --- websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Manipulate Cell.html (added) +++ websites/staging/odftoolkit/trunk/content/odftoolkit/simple/document/cookbook/Manipulate Cell.html Tue Sep 6 02:11:09 2011 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + +
+ +
+ + + +
+ +
+
+


Powered by the Apache CMS.

+
+
+

+ Apache "ODF Toolkit" is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. + Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and + decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is + not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has + yet to be fully endorsed by the ASF.

+

+ Copyright © 2011 The Apache Software Foundation Licensed under the Apache License, Version 2.0. + Contact Us +
Apache and the Apache feather logos are trademarks of The Apache Software Foundation. +
Other names appearing on the site may be trademarks of their respective owners. +

+
+
+ + +