tag r1760271 as 3.15

git-svn-id: https://svn.apache.org/repos/asf/poi/tags/REL_3_15_FINAL@1760272 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
David North 2016-09-11 18:50:13 +00:00
commit 49650404b4
4585 changed files with 408 additions and 699504 deletions

View File

@ -2390,17 +2390,19 @@ under the License.
<!-- can't combine updating and pinning of the documentation ... so we need two commits -->
<!-- (revision)properties can't be set and read within one svn block -->
<echo message="updating build.xml and status.xml"/>
<exec command="svn ci --username ${settings.apache-id.username} --password ${settings.apache-id.password} -m 'release prepare for ${version.id} - updating build.xml and status.xml' build.xml src/documentation/content/xdocs/status.xml"/>
<svn refid="svn.settings">
<commit message="release prepare for ${version.id} - updating build.xml and status.xml" recurse="false">
<!--<commit message="release prepare for ${version.id} - updating build.xml and status.xml" recurse="false">
<fileset dir="." includes="build.xml,src/documentation/content/xdocs/status.xml"/>
</commit>
</commit>-->
<update dir="." recurse="true"/>
<status path="." revisionProperty="svn_version1"/>
</svn>
<echo message="pin documentation - release ${svn_version1}"/>
<exec command="svn ci --username ${settings.apache-id.username} --password ${settings.apache-id.password} -m 'release prepare for ${version.id} - pin documentation' src"/>
<svn refid="svn.settings">
<propset path="src" name="svn:externals" value="documentation -r${svn_version1} https://svn.apache.org/repos/asf/poi/site/src/documentation"/>
<commit message="release prepare for ${version.id} - pin documentation" dir="src" recurse="false"/>
<!-- <commit message="release prepare for ${version.id} - pin documentation" dir="src" recurse="false"/>-->
<update dir="." recurse="true"/>
<status path="." revisionProperty="svn_version2"/>
</svn>
@ -2430,12 +2432,13 @@ under the License.
<svn refid="svn.settings">
<update dir="." recurse="true"/>
<propset path="src" name="svn:externals" value="documentation https://svn.apache.org/repos/asf/poi/site/src/documentation"/>
<commit message="prepare for ${rel_next}" recurse="false">
<!--<commit message="prepare for ${rel_next}" recurse="false">
<fileset dir="." includes="build.xml"/>
<fileset dir="sonar" includes="**/pom.xml"/>
<dirset dir="src"/>
</commit>
</commit>-->
</svn>
<exec command="svn ci --username ${settings.apache-id.username} --password ${settings.apache-id.password} -m 'prepare for ${rel_next}' build.xml sonar src"/>
<mkdir dir="build/release"/>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
</parent>
<artifactId>poi-examples</artifactId>
<packaging>jar</packaging>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
</parent>
<artifactId>poi-excelant</artifactId>
<packaging>jar</packaging>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
</parent>
<artifactId>poi-main</artifactId>
<packaging>jar</packaging>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema-encryption</artifactId>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema-security</artifactId>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema</artifactId>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
</parent>
<artifactId>poi-ooxml</artifactId>
<packaging>jar</packaging>

View File

@ -3,7 +3,7 @@
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<packaging>pom</packaging>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
<name>Apache POI - the Java API for Microsoft Documents</name>
<description>Maven build of Apache POI for Sonar checks</description>
<url>http://poi.apache.org/</url>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<version>3.16-beta1-SNAPSHOT</version>
</parent>
<artifactId>poi-scratchpad</artifactId>
<packaging>jar</packaging>

View File

@ -21,6 +21,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DataConsolidateFunction;
import org.apache.poi.ss.usermodel.Row;
@ -39,7 +40,11 @@ public class CreatePivotTable {
//Create some data to build the pivot table on
setCellData(sheet);
XSSFPivotTable pivotTable = sheet.createPivotTable(new AreaReference("A1:D4"), new CellReference("H5"));
AreaReference source = new AreaReference("A1:D4", SpreadsheetVersion.EXCEL2007);
CellReference position = new CellReference("H5");
// Create a pivot table on this sheet, with H5 as the top-left cell..
// The pivot table's data source is on the same sheet in A1:D4
XSSFPivotTable pivotTable = sheet.createPivotTable(source, position);
//Configure the pivot table
//Use first column as row label
pivotTable.addRowLabel(0);
@ -98,4 +103,4 @@ public class CreatePivotTable {
Cell cell44 = row4.createCell(3);
cell44.setCellValue("No");
}
}
}

View File

@ -32,13 +32,13 @@ public class FillsAndColors {
Sheet sheet = wb.createSheet("new sheet");
// Create a row and put some cells in it. Rows are 0 based.
Row row = sheet.createRow((short) 1);
Row row = sheet.createRow(1);
// Aqua background
CellStyle style = wb.createCellStyle();
style.setFillBackgroundColor(IndexedColors.AQUA.getIndex());
style.setFillPattern(CellStyle.BIG_SPOTS);
Cell cell = row.createCell((short) 1);
Cell cell = row.createCell(1);
cell.setCellValue(new XSSFRichTextString("X"));
cell.setCellStyle(style);
@ -46,7 +46,7 @@ public class FillsAndColors {
style = wb.createCellStyle();
style.setFillForegroundColor(IndexedColors.ORANGE.getIndex());
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
cell = row.createCell((short) 2);
cell = row.createCell(2);
cell.setCellValue(new XSSFRichTextString("X"));
cell.setCellStyle(style);

View File

@ -75,7 +75,7 @@ public final class BuiltinFormats {
"#,##0.00",
"\"$\"#,##0_);(\"$\"#,##0)",
"\"$\"#,##0_);[Red](\"$\"#,##0)",
"\"$\"#,##,00_);(\"$\"#,##0.00)",
"\"$\"#,##0.00_);(\"$\"#,##0.00)",
"\"$\"#,##0.00_);[Red](\"$\"#,##0.00)",
"0%",
"0.00%",

View File

@ -24,6 +24,7 @@ import org.apache.poi.ss.formula.FormulaParseException;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.Internal;
import org.apache.poi.util.Removal;
/**
* High level representation of a cell in a row of a spreadsheet.
@ -46,7 +47,8 @@ public interface Cell {
* @see #getCellType()
* @deprecated POI 3.15 beta 3. Use {@link CellType#NUMERIC} instead.
*/
CellType CELL_TYPE_NUMERIC = CellType.NUMERIC;
@Removal(version="4.0")
int CELL_TYPE_NUMERIC = 0; //CellType.NUMERIC.getCode();
/**
* String Cell type (1)
@ -54,7 +56,8 @@ public interface Cell {
* @see #getCellType()
* @deprecated POI 3.15 beta 3. Use {@link CellType#STRING} instead.
*/
CellType CELL_TYPE_STRING = CellType.STRING;
@Removal(version="4.0")
int CELL_TYPE_STRING = 1; //CellType.STRING.getCode();
/**
* Formula Cell type (2)
@ -62,7 +65,8 @@ public interface Cell {
* @see #getCellType()
* @deprecated POI 3.15 beta 3. Use {@link CellType#FORMULA} instead.
*/
CellType CELL_TYPE_FORMULA = CellType.FORMULA;
@Removal(version="4.0")
int CELL_TYPE_FORMULA = 2; //CellType.FORMULA.getCode();
/**
* Blank Cell type (3)
@ -70,7 +74,8 @@ public interface Cell {
* @see #getCellType()
* @deprecated POI 3.15 beta 3. Use {@link CellType#BLANK} instead.
*/
CellType CELL_TYPE_BLANK = CellType.BLANK;
@Removal(version="4.0")
int CELL_TYPE_BLANK = 3; //CellType.BLANK.getCode();
/**
* Boolean Cell type (4)
@ -78,7 +83,8 @@ public interface Cell {
* @see #getCellType()
* @deprecated POI 3.15 beta 3. Use {@link CellType#BOOLEAN} instead.
*/
CellType CELL_TYPE_BOOLEAN = CellType.BOOLEAN;
@Removal(version="4.0")
int CELL_TYPE_BOOLEAN = 4; //CellType.BOOLEAN.getCode();
/**
* Error Cell type (5)
@ -86,7 +92,8 @@ public interface Cell {
* @see #getCellType()
* @deprecated POI 3.15 beta 3. Use {@link CellType#ERROR} instead.
*/
CellType CELL_TYPE_ERROR = CellType.ERROR;
@Removal(version="4.0")
int CELL_TYPE_ERROR = 5; //CellType.ERROR.getCode();
/**
* Returns column index of this cell
@ -136,6 +143,7 @@ public interface Cell {
* @see CellType#ERROR
* @deprecated POI 3.15 beta 3. Use {@link #setCellType(CellType)} instead.
*/
@Removal(version="4.0")
void setCellType(int cellType);
/**
* Set the cells type (numeric, formula or string).
@ -155,7 +163,7 @@ public interface Cell {
/**
* Return the cell type.
*
* Will return {@link CellType} in a future version of POI.
* Will return {@link CellType} in version 4.0 of POI.
* For forwards compatibility, do not hard-code cell type literals in your code.
*
* @return the cell type
@ -168,9 +176,10 @@ public interface Cell {
* @return the cell type
* @since POI 3.15 beta 3
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
* Will be renamed to <code>getCellType()</code> when we make the CellType enum transition in POI 4.0. See bug 59791.
*/
@Internal(since="POI 3.15 beta 3")
@Removal(version="4.2")
CellType getCellTypeEnum();
/**
@ -192,7 +201,7 @@ public interface Cell {
* on the cached value of the formula
* @since POI 3.15 beta 3
* @deprecated POI 3.15 beta 3
* Will be deleted when we make the CellType enum transition. See bug 59791.
* Will be renamed to <code>getCachedFormulaResultType()</code> when we make the CellType enum transition in POI 4.0. See bug 59791.
*/
@Internal(since="POI 3.15 beta 3")
CellType getCachedFormulaResultTypeEnum();

View File

@ -895,7 +895,7 @@ public class DataFormatter implements Observer {
return cell.getRichStringCellValue().getString();
case BOOLEAN :
return String.valueOf(cell.getBooleanCellValue());
return cell.getBooleanCellValue() ? "TRUE" : "FALSE";
case BLANK :
return "";
case ERROR:

View File

@ -40,6 +40,7 @@ import org.apache.xmlbeans.impl.common.SystemCache;
/**
* This holds the common functionality for all POI OOXML Document classes.
*/
// TODO: implements AutoCloseable in Java 7+ when POI drops support for Java 6.
public abstract class POIXMLDocument extends POIXMLDocumentPart implements Closeable {
public static final String DOCUMENT_CREATOR = "Apache POI";
@ -230,6 +231,11 @@ public abstract class POIXMLDocument extends POIXMLDocumentPart implements Close
*/
@SuppressWarnings("resource")
public final void write(OutputStream stream) throws IOException {
OPCPackage p = getPackage();
if(p == null) {
throw new IOException("Cannot write data, document seems to have been closed already");
}
//force all children to commit their changes into the underlying OOXML Package
// TODO Shouldn't they be committing to the new one instead?
Set<PackagePart> context = new HashSet<PackagePart>();
@ -239,10 +245,6 @@ public abstract class POIXMLDocument extends POIXMLDocumentPart implements Close
//save extended and custom properties
getProperties().commit();
OPCPackage p = getPackage();
if(p == null) {
throw new IOException("Cannot write data, document seems to have been closed already");
}
p.save(stream);
}
}

View File

@ -32,9 +32,9 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTTableRow;
* Represents a table in a .pptx presentation
*/
public class XSLFTableRow implements Iterable<XSLFTableCell> {
private CTTableRow _row;
private List<XSLFTableCell> _cells;
private XSLFTable _table;
private final CTTableRow _row;
private final List<XSLFTableCell> _cells;
private final XSLFTable _table;
/*package*/ XSLFTableRow(CTTableRow row, XSLFTable table){
_row = row;
@ -78,6 +78,29 @@ public class XSLFTableRow implements Iterable<XSLFTableCell> {
_table.updateRowColIndexes();
return cell;
}
/**
* Merge cells of a table row, inclusive.
* Indices are 0-based.
*
* @param firstCol 0-based index of first column to merge, inclusive
* @param lastCol 0-based index of last column to merge, inclusive
*/
public void mergeCells(int firstCol, int lastCol)
{
if (firstCol >= lastCol) {
throw new IllegalArgumentException(
"Cannot merge, first column >= last column : "
+ firstCol + " >= " + lastCol
);
}
final int colSpan = (lastCol - firstCol) + 1;
_cells.get(firstCol).setGridSpan(colSpan);
for (final XSLFTableCell cell : _cells.subList(firstCol+1, lastCol+1)) {
cell.setHMerge(true);
}
}
}

View File

@ -67,7 +67,28 @@ final class XSSFEvaluationSheet implements EvaluationSheet {
}
}
return _cellCache.get(new CellKey(rowIndex, columnIndex));
final CellKey key = new CellKey(rowIndex, columnIndex);
EvaluationCell evalcell = _cellCache.get(key);
// If cache is stale, update cache with this one cell
// This is a compromise between rebuilding the entire cache
// (which would quickly defeat the benefit of the cache)
// and not caching at all.
// See bug 59958: Add cells on the fly to the evaluation sheet cache on cache miss
if (evalcell == null) {
XSSFRow row = _xs.getRow(rowIndex);
if (row == null) {
return null;
}
XSSFCell cell = row.getCell(columnIndex);
if (cell == null) {
return null;
}
evalcell = new XSSFEvaluationCell(cell, this);
_cellCache.put(key, evalcell);
}
return evalcell;
}
private static class CellKey {

View File

@ -591,20 +591,21 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
}
} else {
//search the referenced drawing in the list of the sheet's relations
final String id = ctDrawing.getId();
for (RelationPart rp : getRelationParts()){
POIXMLDocumentPart p = rp.getDocumentPart();
if(p instanceof XSSFVMLDrawing) {
XSSFVMLDrawing dr = (XSSFVMLDrawing)p;
String drId = rp.getRelationship().getId();
if(drId.equals(ctDrawing.getId())){
if (drId.equals(id)) {
drawing = dr;
break;
}
break;
// do not break here since drawing has not been found yet (see bug 52425)
}
}
if(drawing == null){
logger.log(POILogger.ERROR, "Can't find VML drawing with id=" + ctDrawing.getId() + " in the list of the sheet's relationships");
logger.log(POILogger.ERROR, "Can't find VML drawing with id=" + id + " in the list of the sheet's relationships");
}
}
return drawing;

View File

@ -22,6 +22,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileOutputStream;
@ -33,9 +34,11 @@ import java.util.HashSet;
import java.util.List;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
import org.apache.poi.util.NullOutputStream;
import org.apache.poi.util.PackageHelper;
import org.apache.poi.util.TempFile;
import org.junit.Test;
@ -120,12 +123,43 @@ public final class TestPOIXMLDocument {
FileOutputStream out = new FileOutputStream(tmp);
doc.write(out);
out.close();
// Should not be able to write to an output stream that has been closed
try {
doc.write(out);
fail("Should not be able to write to an output stream that has been closed.");
} catch (final OpenXML4JRuntimeException e) {
// FIXME: A better exception class (IOException?) and message should be raised
// indicating that the document could not be written because the output stream is closed.
// see {@link org.apache.poi.openxml4j.opc.ZipPackage#saveImpl(java.io.OutputStream)}
if (e.getMessage().matches("Fail to save: an error occurs while saving the package : The part .+ fail to be saved in the stream with marshaller .+")) {
// expected
} else {
throw e;
}
}
// Should not be able to write a document that has been closed
doc.close();
try {
doc.write(new NullOutputStream());
fail("Should not be able to write a document that has been closed.");
} catch (final IOException e) {
if (e.getMessage().equals("Cannot write data, document seems to have been closed already")) {
// expected
} else {
throw e;
}
}
// Should be able to close a document multiple times, though subsequent closes will have no effect.
doc.close();
@SuppressWarnings("resource")
OPCPackage pkg2 = OPCPackage.open(tmp.getAbsolutePath());
doc = new OPCParser(pkg1);
try {
doc = new OPCParser(pkg1);
doc.parse(new TestFactory());
context = new HashMap<String,POIXMLDocumentPart>();
traverse(doc, context);
@ -150,6 +184,7 @@ public final class TestPOIXMLDocument {
}
} finally {
doc.close();
pkg1.close();
pkg2.close();
}
}

View File

@ -0,0 +1,131 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xslf.usermodel;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.List;
import org.apache.poi.xslf.XSLFTestDataSamples;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableRow;
public class TestXSLFTableRow {
private static XMLSlideShow ppt;
private static XSLFTable tbl;
private static XSLFTableRow row;
/** Copied from {@link TestXSLFTable#testRead()} */
@Before
public void setUp() throws IOException {
ppt = XSLFTestDataSamples.openSampleDocument("shapes.pptx");
XSLFSlide slide = ppt.getSlides().get(3);
List<XSLFShape> shapes = slide.getShapes();
tbl = (XSLFTable)shapes.get(0);
List<XSLFTableRow> rows = tbl.getRows();
row = rows.get(0);
}
@After
public void tearDown() throws IOException {
ppt.getPackage().revert();
ppt.close();
}
@Test
public void constructor() {
XSLFTableRow row2 = new XSLFTableRow(row.getXmlObject(), tbl);
assertSame(row.getXmlObject(), row2.getXmlObject());
assertEquals(row.getHeight(), row2.getHeight(), 1e-16);
}
@Test
public void testHeight() {
final double h = 10.0;
row.setHeight(h);
assertEquals(h, row.getHeight(), 1e-16);
}
/** copied from {@link TestXSLFTable#testCreate()} */
@Test
public void getCells() {
List<XSLFTableCell> cells = row.getCells();
assertNotNull(cells);
assertEquals(3, cells.size());
}
@Test
public void testIterator() {
int i = 0;
for (XSLFTableCell cell : row) {
i++;
assertEquals("header"+i, cell.getText());
}
assertEquals(3, i);
}
/** copied from {@link TestXSLFTable#testCreate()} */
@Test
public void addCell() {
XSLFTableCell cell = row.addCell();
assertNotNull(cell);
assertNotNull(cell.getXmlObject());
// by default table cell has no borders
CTTableCell tc = (CTTableCell)cell.getXmlObject();
assertTrue(tc.getTcPr().getLnB().isSetNoFill());
assertTrue(tc.getTcPr().getLnT().isSetNoFill());
assertTrue(tc.getTcPr().getLnL().isSetNoFill());
assertTrue(tc.getTcPr().getLnR().isSetNoFill());
}
@Test
public void mergeCells() {
try {
row.mergeCells(0, 0);
fail("expected IllegalArgumentException when merging fewer than 2 columns");
} catch (final IllegalArgumentException e) {
// expected
}
row.mergeCells(0, 1);
List<XSLFTableCell> cells = row.getCells();
//the top-left cell of a merged region is not regarded as merged
assertFalse("top-left cell of merged region", cells.get(0).isMerged());
assertTrue("inside merged region", cells.get(1).isMerged());
assertFalse("outside merged region", cells.get(2).isMerged());
}
@Test
public void getXmlObject() {
CTTableRow ctrow = row.getXmlObject();
assertNotNull(ctrow);
}
}

View File

@ -43,6 +43,7 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.NullOutputStream;
import org.apache.poi.xssf.SXSSFITestDataProvider;
import org.apache.poi.xssf.XSSFTestDataSamples;
import org.apache.poi.xssf.model.SharedStringsTable;

View File

@ -47,6 +47,9 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellCopyPolicy;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Drawing;
import org.apache.poi.ss.usermodel.FormulaError;
import org.apache.poi.ss.usermodel.IgnoredErrorType;
import org.apache.poi.ss.usermodel.IndexedColors;
@ -1975,4 +1978,46 @@ public final class TestXSSFSheet extends BaseTestXSheet {
wb.close();
}
}
/**
* See bug #52425
*/
@Test
public void testInsertCommentsToClonedSheet() {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("52425.xlsx");
CreationHelper helper = wb.getCreationHelper();
Sheet sheet2 = wb.createSheet("Sheet 2");
Sheet sheet3 = wb.cloneSheet(0);
wb.setSheetName(2, "Sheet 3");
// Adding Comment to new created Sheet 2
addComments(helper, sheet2);
// Adding Comment to cloned Sheet 3
addComments(helper, sheet3);
}
private void addComments(CreationHelper helper, Sheet sheet) {
Drawing drawing = sheet.createDrawingPatriarch();
for (int i = 0; i < 2; i++) {
ClientAnchor anchor = helper.createClientAnchor();
anchor.setCol1(0);
anchor.setRow1(0 + i);
anchor.setCol2(2);
anchor.setRow2(3 + i);
Comment comment = drawing.createCellComment(anchor);
comment.setString(helper.createRichTextString("BugTesting"));
Row row = sheet.getRow(0 + i);
if (row == null)
row = sheet.createRow(0 + i);
Cell cell = row.getCell(0);
if (cell == null)
cell = row.createCell(0);
cell.setCellComment(comment);
}
}
}

View File

@ -51,6 +51,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
// TODO - support shifting of page breaks
}
/** Error occurred at FormulaShifter#rowMoveAreaPtg while shift rows upward. */
@Test
public void testBug54524() throws IOException {
XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("54524.xlsx");
@ -66,6 +67,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
workbook.close();
}
/** negative row shift causes corrupted data or throws exception */
@Test
public void testBug53798() throws IOException {
// NOTE that for HSSF (.xls) negative shifts combined with positive ones do work as expected
@ -124,6 +126,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
}
}
/** negative row shift causes corrupted data or throws exception */
@Test
public void testBug53798a() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("53798.xlsx");
@ -152,6 +155,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
read.close();
}
/** Shifting rows with comment result - Unreadable content error and comment deletion */
@Test
public void testBug56017() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("56017.xlsx");
@ -193,6 +197,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
wbBack.close();
}
/** Moving the active sheet and deleting the others results in a corrupted file */
@Test
public void test57171() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("57171_57163_57165.xlsx");
@ -210,6 +215,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
wbRead.close();
}
/** Cannot delete an arbitrary sheet in an XLS workbook (only the last one) */
@Test
public void test57163() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("57171_57163_57165.xlsx");
@ -314,6 +320,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
wb.close();
}
/** Failed to clone a sheet from an Excel 2010 */
@Test
public void test57165() throws IOException {
Workbook wb = XSSFTestDataSamples.openSampleWorkbook("57171_57163_57165.xlsx");
@ -341,6 +348,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
}
}
/** Shifting rows with cell comments only shifts comments from first such cell. Other cell comments not shifted */
@Test
public void testBug57828_OnlyOneCommentShiftedInRow() throws IOException {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57828.xlsx");

View File

@ -20,9 +20,7 @@ package org.apache.poi.ddf;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
@ -30,6 +28,7 @@ import org.apache.poi.POIDataSamples;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.util.IOUtils;
import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.NullOutputStream;
import org.junit.BeforeClass;
import org.junit.Test;
@ -83,23 +82,6 @@ public class TestEscherDump {
@SuppressWarnings("resource")
private NullPrinterStream() throws UnsupportedEncodingException {
super(new NullOutputStream(),true,LocaleUtil.CHARSET_1252.name());
}
/**
* Implementation of an OutputStream which does nothing, used
* to redirect stdout to avoid spamming the console with output
*/
private static class NullOutputStream extends OutputStream {
@Override
public void write(byte[] b, int off, int len) {
}
@Override
public void write(int b) {
}
@Override
public void write(byte[] b) throws IOException {
}
}
}
}
}

View File

@ -21,7 +21,6 @@ import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
@ -32,6 +31,7 @@ import java.util.Map;
import org.apache.poi.POIDataSamples;
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.util.NullOutputStream;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@ -119,22 +119,4 @@ public abstract class BaseXLSIteratingTest {
}
abstract void runOneFile(File pFile) throws Exception;
/**
* Implementation of an OutputStream which does nothing, used
* to redirect stdout to avoid spamming the console with output
*/
private static class NullOutputStream extends OutputStream {
@Override
public void write(byte[] b, int off, int len) {
}
@Override
public void write(int b) {
}
@Override
public void write(byte[] b) throws IOException {
}
}
}

View File

@ -136,45 +136,45 @@ public final class TestHSSFConditionalFormatting extends BaseTestConditionalForm
Row row = sheet.createRow(0);
Cell cell0 = row.createCell(0);
cell0.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell0.setCellType(CellType.NUMERIC);
cell0.setCellValue(100);
Cell cell1 = row.createCell(1);
cell1.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell1.setCellType(CellType.NUMERIC);
cell1.setCellValue(120);
Cell cell2 = row.createCell(2);
cell2.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell2.setCellType(CellType.NUMERIC);
cell2.setCellValue(130);
// row 1
row = sheet.createRow(1);
cell0 = row.createCell(0);
cell0.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell0.setCellType(CellType.NUMERIC);
cell0.setCellValue(200);
cell1 = row.createCell(1);
cell1.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell1.setCellType(CellType.NUMERIC);
cell1.setCellValue(220);
cell2 = row.createCell(2);
cell2.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell2.setCellType(CellType.NUMERIC);
cell2.setCellValue(230);
// row 2
row = sheet.createRow(2);
cell0 = row.createCell(0);
cell0.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell0.setCellType(CellType.NUMERIC);
cell0.setCellValue(300);
cell1 = row.createCell(1);
cell1.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell1.setCellType(CellType.NUMERIC);
cell1.setCellValue(320);
cell2 = row.createCell(2);
cell2.setCellType(org.apache.poi.ss.usermodel.Cell.CELL_TYPE_NUMERIC);
cell2.setCellType(CellType.NUMERIC);
cell2.setCellValue(330);
// Create conditional formatting, CELL1 should be yellow if CELL0 is not blank.

View File

@ -1015,4 +1015,36 @@ public abstract class BaseTestCell {
wb.close();
}
@Test
public void primitiveToEnumReplacementDoesNotBreakBackwardsCompatibility() {
// bug 59836
// until we have changes POI from working on primitives (int) to enums,
// we should make sure we minimize backwards compatibility breakages.
// This method tests the old way of working with cell types, alignment, etc.
Workbook wb = _testDataProvider.createWorkbook();
Sheet sheet = wb.createSheet();
Row row = sheet.createRow(0);
Cell cell = row.createCell(0);
// Cell.CELL_TYPE_* -> CellType.*
cell.setCellValue(5.0);
assertEquals(Cell.CELL_TYPE_NUMERIC, cell.getCellType());
assertEquals(0, cell.getCellType()); //make sure that hard-coded int literals still work, even though users should be using the named constants
assertEquals(CellType.NUMERIC, cell.getCellTypeEnum()); // make sure old way and new way are compatible
// make sure switch(int|Enum) still works. Cases must be statically resolvable in Java 6 ("constant expression required")
switch(cell.getCellType()) {
case Cell.CELL_TYPE_NUMERIC:
// expected
break;
case Cell.CELL_TYPE_STRING:
case Cell.CELL_TYPE_BOOLEAN:
case Cell.CELL_TYPE_ERROR:
case Cell.CELL_TYPE_FORMULA:
case Cell.CELL_TYPE_BLANK:
default:
fail("unexpected cell type: " + cell.getCellType());
}
}
}

View File

@ -34,6 +34,7 @@ import java.util.Iterator;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.ss.ITestDataProvider;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.util.NullOutputStream;
import org.junit.Test;
public abstract class BaseTestWorkbook {
@ -781,15 +782,6 @@ public abstract class BaseTestWorkbook {
}
}
protected static class NullOutputStream extends OutputStream {
public NullOutputStream() {
}
@Override
public void write(int b) throws IOException {
}
}
@Test
public void test58499() throws IOException {
Workbook workbook = _testDataProvider.createWorkbook();

View File

@ -597,6 +597,27 @@ public class TestDataFormatter {
}
}
@Test
public void testBoolean() throws IOException {
DataFormatter formatter = new DataFormatter();
// Create a spreadsheet with some TRUE/FALSE boolean values in it
Workbook wb = new HSSFWorkbook();
try {
Sheet s = wb.createSheet();
Row r = s.createRow(0);
Cell c = r.createCell(0);
c.setCellValue(true);
assertEquals("TRUE", formatter.formatCellValue(c));
c.setCellValue(false);
assertEquals("FALSE", formatter.formatCellValue(c));
} finally {
wb.close();
}
}
/**
* While we don't currently support using a locale code at
* the start of a format string to format it differently, we

View File

@ -15,19 +15,27 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ddf;
package org.apache.poi.util;
import java.io.OutputStream;
/**
* Ignores all serialization events.
* Implementation of an OutputStream which does nothing, used
* to redirect stdout to avoid spamming the console with output
*/
public class NullEscherSerializationListener implements EscherSerializationListener {
@Override
public void beforeRecordSerialize(int offset, short recordId, EscherRecord record) {
// do nothing
public final class NullOutputStream extends OutputStream {
public NullOutputStream() {
}
@Override
public void afterRecordSerialize(int offset, short recordId, int size, EscherRecord record) {
// do nothing
public void write(byte[] b, int off, int len) {
}
@Override
public void write(int b) {
}
@Override
public void write(byte[] b) {
}
}

Binary file not shown.

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="src/testcases"/>
<classpathentry kind="src" path="src/resources/main"/>
<classpathentry kind="src" path="src/ooxml/java"/>
<classpathentry kind="src" path="src/ooxml/testcases"/>
<classpathentry kind="src" path="src/resources/ooxml"/>
<classpathentry kind="src" path="src/scratchpad/src"/>
<classpathentry kind="src" path="src/scratchpad/testcases"/>
<classpathentry kind="src" path="src/resources/scratchpad"/>
<classpathentry kind="src" path="src/contrib/poi-ruby/java"/>
<classpathentry kind="src" path="src/examples/src"/>
<classpathentry kind="src" path="src/excelant/java"/>
<classpathentry kind="src" path="src/excelant/testcases"/>
<classpathentry kind="src" path="src/excelant/resources"/>
<classpathentry kind="src" path="src/integrationtest"/>
<classpathentry kind="lib" path="lib/ant-1.9.4.jar"/>
<classpathentry kind="lib" path="lib/ant-launcher-1.9.4.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
<classpathentry exported="true" kind="lib" path="ooxml-lib/xmlbeans-2.6.0.jar"/>
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
<classpathentry kind="lib" path="ooxml-lib/curvesapi-1.04.jar"/>
<classpathentry exported="true" kind="lib" path="ooxml-lib/ooxml-schemas-1.3.jar" sourcepath="ooxml-lib/ooxml-schemas-1.3-sources.jar"/>
<classpathentry exported="true" kind="lib" path="ooxml-lib/ooxml-security-1.1.jar" sourcepath="ooxml-lib/ooxml-security-1.1-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="lib" path="compile-lib/slf4j-api-1.7.12.jar"/>
<classpathentry kind="lib" path="compile-lib/bcpkix-jdk15on-1.54.jar"/>
<classpathentry kind="lib" path="compile-lib/bcprov-ext-jdk15on-1.54.jar"/>
<classpathentry exported="true" kind="lib" path="compile-lib/xmlsec-2.0.6.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-collections4-4.1.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ApachePOI</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.sonar.ide.eclipse.core.sonarNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,395 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
org.eclipse.jdt.core.codeComplete.fieldSuffixes=
org.eclipse.jdt.core.codeComplete.localPrefixes=
org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

File diff suppressed because one or more lines are too long

View File

@ -1,4 +0,0 @@
eclipse.preferences.version=1
org.moreunit.core.anyLanguage.srcFolderPathTemplate=${srcProject}
org.moreunit.core.anyLanguage.testFileNameTemplate=${srcFile}Test
org.moreunit.core.anyLanguage.testFolderPathTemplate=${srcProject}

View File

@ -1,4 +0,0 @@
eclipse.preferences.version=1
org.moreunit.preferences.version=2
org.moreunit.unitsourcefolder=ApachePOI\:src/java\:ApachePOI\:src/testcases\#ApachePOI\:src/java\:ApachePOI\:src/ooxml/testcases\#ApachePOI\:src/java\:ApachePOI\:src/scratchpad/testcases\#ApachePOI\:src/java\:ApachePOI\:src/excelant/testcases\#ApachePOI\:src/java\:ApachePOI\:src/integrationtest
org.moreunit.useprojectsettings=true

2388
trunk/KEYS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,135 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl"?>
<rdf:RDF xml:lang="en"
xmlns="http://usefulinc.com/ns/doap#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:asfext="http://projects.apache.org/ns/asfext#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Project rdf:about="http://poi.apache.org">
<created>2006-01-26</created>
<license rdf:resource="http://spdx.org/licenses/Apache-2.0" />
<name>Apache POI</name>
<homepage rdf:resource="http://poi.apache.org" />
<asfext:pmc rdf:resource="http://poi.apache.org" />
<shortdesc>Java API To Access Microsoft Document File Formats</shortdesc>
<description>APIs for manipulating various file formats based upon Open Office XML (ECMA-376) and Microsoft's OLE 2 Compound Document formats using pure Java. Apache POI is your Java Excel, Word and PowerPoint solution. We have a complete API for porting other OOXML and OLE 2 Compound Document formats and welcome others to participate.</description>
<bug-database rdf:resource="http://issues.apache.org/bugzilla/buglist.cgi?product=POI" />
<mailing-list rdf:resource="http://poi.apache.org/mailinglists.html" />
<download-page rdf:resource="http://www.apache.org/dyn/closer.lua/poi/" />
<programming-language>Java</programming-language>
<category rdf:resource="http://projects.apache.org/category/content" />
<category rdf:resource="http://projects.apache.org/category/library" />
<release>
<Version>
<name>Apache POI 3.14</name>
<created>2016-03-05</created>
<revision>3.14</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.13</name>
<created>2015-09-29</created>
<revision>3.13</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.12</name>
<created>2015-05-11</created>
<revision>3.12</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.11</name>
<created>2014-12-21</created>
<revision>3.11</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.10.1</name>
<created>2014-08-18</created>
<revision>3.10.1</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.10</name>
<created>2014-02-08</created>
<revision>3.10</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.9</name>
<created>2012-12-03</created>
<revision>3.9</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.8</name>
<created>2012-03-26</created>
<revision>3.8</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.7</name>
<created>2010-10-29</created>
<revision>3.7</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.6</name>
<created>2009-12-14</created>
<revision>3.6</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.5</name>
<created>2009-09-28</created>
<revision>3.5</revision>
</Version>
</release>
<release>
<Version>
<name>Apache POI 3.2</name>
<created>2008-10-19</created>
<revision>3.2</revision>
</Version>
</release>
<repository>
<SVNRepository>
<location rdf:resource="http://svn.apache.org/repos/asf/poi/"/>
<browse rdf:resource="http://svn.apache.org/viewvc/poi/"/>
</SVNRepository>
</repository>
<maintainer>
<foaf:Person>
<foaf:name>POI Committers</foaf:name>
<foaf:mbox rdf:resource="mailto:dev@poi.apache.org"/>
</foaf:Person>
</maintainer>
</Project>
</rdf:RDF>

View File

@ -1,513 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
APACHE POI SUBCOMPONENTS:
Apache POI includes subcomponents with separate copyright notices and
license terms. Your use of these subcomponents is subject to the terms
and conditions of the following licenses:
Office Open XML schemas (ooxml-schemas-1.*.jar)
The Office Open XML schema definitions used by Apache POI are
a part of the Office Open XML ECMA Specification (ECMA-376, [1]).
As defined in section 9.4 of the ECMA bylaws [2], this specification
is available to all interested parties without restriction:
9.4 All documents when approved shall be made available to
all interested parties without restriction.
Furthermore, both Microsoft and Adobe have granted patent licenses
to this work [3,4,5].
[1] http://www.ecma-international.org/publications/standards/Ecma-376.htm
[2] http://www.ecma-international.org/memento/Ecmabylaws.htm
[3] http://www.microsoft.com/openspecifications/en/us/programs/osp/default.aspx
[4] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/
Patent%20statements%20ok/ECMA-376%20Edition%202%20Microsoft%20Patent%20Declaration.pdf
[5] http://www.ecma-international.org/publications/files/ECMA-ST/Ecma%20PATENT/
Patent%20statements%20ok/ECMA-376%20Adobe%20Patent%20Declaration.pdf
Bouncy Castle library (bcprov-*.jar, bcpg-*.jar, bcpkix-*.jar)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
JUnit test library (junit-4.*.jar) & JaCoCo (*jacoco*)
Eclipse Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are
distributed by that particular Contributor. A Contribution 'originates' from
a Contributor if it was added to the Program by such Contributor itself or
anyone acting on such Contributor's behalf. Contributions do not include
additions to the Program which: (i) are separate modules of software
distributed in conjunction with the Program under their own license agreement,
and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which are
necessarily infringed by the use or sale of its Contribution alone or when
combined with the Program.
"Program" means the Contributions distributed in accordance with this Agreement.
"Recipient" means anyone who receives the Program under this Agreement,
including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free copyright license to
reproduce, prepare derivative works of, publicly display, publicly
perform, distribute and sublicense the Contribution of such Contributor,
if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free patent license under
Licensed Patents to make, use, sell, offer to sell, import and otherwise
transfer the Contribution of such Contributor, if any, in source code
and object code form. This patent license shall apply to the combination
of the Contribution and the Program if, at the time the Contribution is
added by the Contributor, such addition of the Contribution causes such
combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Contribution.
No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses
to its Contributions set forth herein, no assurances are provided by any
Contributor that the Program does not infringe the patent or other
intellectual property rights of any other entity. Each Contributor
disclaims any liability to Recipient for claims brought by any other
entity based on infringement of intellectual property rights or
otherwise. As a condition to exercising the rights and licenses granted
hereunder, each Recipient hereby assumes sole responsibility to secure
any other intellectual property rights needed, if any. For example, if
a third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient
copyright rights in its Contribution, if any, to grant the copyright
license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under
its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties and
conditions, express and implied, including warranties or conditions of
title and non-infringement, and implied warranties or conditions of
merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for
damages, including direct, indirect, special, incidental and
consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are
offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such
Contributor, and informs licensees how to obtain it in a reasonable
manner on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained
within the Program.
Each Contributor must identify itself as the originator of its Contribution,
if any, in a manner that reasonably allows subsequent Recipients to identify
the originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with
respect to end users, business partners and the like. While this license is
intended to facilitate the commercial use of the Program, the Contributor
who includes the Program in a commercial product offering should do so in a
manner which does not create potential liability for other Contributors.
Therefore, if a Contributor includes the Program in a commercial product
offering, such Contributor ("Commercial Contributor") hereby agrees to
defend and indemnify every other Contributor ("Indemnified Contributor")
against any losses, damages and costs (collectively "Losses") arising from
claims, lawsuits and other legal actions brought by a third party against
the Indemnified Contributor to the extent caused by the acts or omissions
of such Commercial Contributor in connection with its distribution of the
Program in a commercial product offering. The obligations in this section
do not apply to any claims or Losses relating to any actual or alleged
intellectual property infringement. In order to qualify, an Indemnified
Contributor must: a) promptly notify the Commercial Contributor in writing
of such claim, and b) allow the Commercial Contributor to control, and
cooperate with the Commercial Contributor in, the defense and any related
settlement negotiations. The Indemnified Contributor may participate in any
such claim at its own expense.
For example, a Contributor might include the Program in a commercial product
offering, Product X. That Contributor is then a Commercial Contributor. If
that Commercial Contributor then makes performance claims, or offers
warranties related to Product X, those performance claims and warranties are
such Commercial Contributor's responsibility alone. Under this section, the
Commercial Contributor would have to defend claims against the other
Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON
AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR
CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the
appropriateness of using and distributing the Program and assumes all risks
associated with its exercise of rights under this Agreement , including but
not limited to the risks and costs of program errors, compliance with
applicable laws, damage to or loss of data, programs or equipment, and
unavailability or interruption of operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of the
remainder of the terms of this Agreement, and without further action by the
parties hereto, such provision shall be reformed to the minimum extent
necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
(excluding combinations of the Program with other software or hardware)
infringes such Recipient's patent(s), then such Recipient's rights granted
under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to
comply with any of the material terms or conditions of this Agreement and
does not cure such failure in a reasonable period of time after becoming
aware of such noncompliance. If all Recipient's rights under this Agreement
terminate, Recipient agrees to cease use and distribution of the Program as
soon as reasonably practicable. However, Recipient's obligations under this
Agreement and any licenses granted by Recipient relating to the Program
shall continue and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but
in order to avoid inconsistency the Agreement is copyrighted and may only
be modified in the following manner. The Agreement Steward reserves the
right to publish new versions (including revisions) of this Agreement from
time to time. No one other than the Agreement Steward has the right to
modify this Agreement. The Eclipse Foundation is the initial Agreement
Steward. The Eclipse Foundation may assign the responsibility to serve as
the Agreement Steward to a suitable separate entity. Each new version of
the Agreement will be given a distinguishing version number. The Program
(including Contributions) may always be distributed subject to the version
of the Agreement under which it was received. In addition, after a new
version of the Agreement is published, Contributor may elect to distribute
the Program (including its Contributions) under the new version. Except as
expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
rights or licenses to the intellectual property of any Contributor under
this Agreement, whether expressly, by implication, estoppel or otherwise.
All rights in the Program not expressly granted under this Agreement are
reserved.
This Agreement is governed by the laws of the State of New York and the
intellectual property laws of the United States of America. No party to this
Agreement will bring a legal action under this Agreement more than one year
after the cause of action arose. Each party waives its rights to a jury
trial in any resulting litigation.
Hamcrest library (hamcrest-*.jar) & CuvesAPI / Curve API
BSD License
Copyright (c) 2000-2006, www.hamcrest.org
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. Redistributions in binary
form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials
provided with the distribution.
Neither the name of Hamcrest nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
SLF4J library (slf4j-api-*.jar)
Copyright (c) 2004-2013 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,23 +0,0 @@
Apache POI
Copyright 2003-2016 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (https://www.apache.org/).
This product contains parts that were originally based on software from BEA.
Copyright (c) 2000-2003, BEA Systems, <http://www.bea.com/>.
This product contains W3C XML Schema documents. Copyright 2001-2003 (c)
World Wide Web Consortium (Massachusetts Institute of Technology, European
Research Consortium for Informatics and Mathematics, Keio University)
This product contains the Piccolo XML Parser for Java
(http://piccolo.sourceforge.net/). Copyright 2002 Yuval Oren.
This product contains the chunks_parse_cmds.tbl file from the vsdump program.
Copyright (C) 2006-2007 Valek Filippov (frob@df.ru)
This product contains parts of the eID Applet project
(http://eid-applet.googlecode.com). Copyright (c) 2009-2014
FedICT (federal ICT department of Belgium), e-Contract.be BVBA (https://www.e-contract.be),
Bart Hanssens from FedICT

View File

@ -1,54 +0,0 @@
#! /bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# create md5 checksums and gpg signatures
echo "If you use gpg2 you need to set GPG_BIN accordingly"
GPG_BIN=gpg
stty -echo
echo "enter your GPG passphrase"
read passphrase
stty echo
# Do we have md5sum and sha1sum?
# (We can use openssl if not, but the files it produces aren't as nice)
which md5sum > /dev/null
LACKING_MD5SUM=$?
which sha1sum > /dev/null
LACKING_SHA1SUM=$?
for i in *; do
echo ""
echo Signing $i
echo $passphrase | $GPG_BIN --passphrase-fd 0 --output $i.asc --detach-sig --armor $i
$GPG_BIN --verify $i.asc $i
echo Hashing $i
if [ "$LACKING_MD5SUM" = "1" ]; then
openssl md5 < $i > $i.md5
else
md5sum $i > $i.md5
fi
if [ "$LACKING_SHA1SUM" = "1" ]; then
openssl sha1 < $i > $i.sha1
else
sha1sum $i > $i.sha1
fi
done

View File

@ -1,62 +0,0 @@
#! /bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Shell script to deploy POI artifacts in a maven repository.
#
# Note, You should configure your settings.xml and add a server with id=apache-releases:
#
# <server>
# <id>apache-releases</id>
# <username>apacheId</username>
# <password>mySecurePassw0rd</password>
# </server>
#
# <profiles>
# <profile>
# <id>apache-releases</id>
# <properties>
# <gpg.passphrase><!-- Your GPG passphrase --></gpg.passphrase>
# </properties>
# </profile>
# </profiles>
#
# Usage:
# 1. ant dist
# 2. cd build/dist
# 3. ./mvn-deploy.sh
M2_REPOSITORY=https://repository.apache.org/service/local/staging/deploy/maven2
VERSION=@VERSION@
DSTAMP=@DSTAMP@
for artifactId in poi poi-scratchpad poi-ooxml poi-examples poi-ooxml-schemas poi-excelant
do
SENDS="-Dfile=$artifactId-$VERSION-$DSTAMP.jar"
SENDS="$SENDS -DpomFile=$artifactId-$VERSION.pom"
if [ -r $artifactId-$VERSION-sources-$DSTAMP.jar ]; then
SENDS="$SENDS -Dsources=$artifactId-$VERSION-sources-$DSTAMP.jar"
fi
if [ -r $artifactId-$VERSION-javadocs-$DSTAMP.jar ]; then
SENDS="$SENDS -Djavadoc=$artifactId-$VERSION-javadocs-$DSTAMP.jar"
fi
mvn gpg:sign-and-deploy-file \
-DrepositoryId=apache-releases -P apache-releases \
-Durl=$M2_REPOSITORY \
$SENDS
done

View File

@ -1,70 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>@VERSION@</version>
<packaging>jar</packaging>
<name>OOXML schemas</name>
<description>XmlBeans generated from the Ecma supplied xsds:
http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%20Part%204%20(DOCX).zip</description>
<url>http://poi.apache.org/</url>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</project>

View File

@ -1,79 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-security</artifactId>
<version>@VERSION@</version>
<packaging>jar</packaging>
<name>OOXML security</name>
<description>
XmlBeans generated from various supplied xsds for encryption and signing:
http://msdn.microsoft.com/en-us/library/dd925810(v=office.12).aspx
http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%202%20(PDF).zip
http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd
http://uri.etsi.org/01903/v1.3.2/XAdES.xsd
http://uri.etsi.org/01903/v1.4.1/XAdESv141.xsd
http://dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd
http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd
http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcmitype.xsd
</description>
<url>http://poi.apache.org/</url>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</project>

View File

@ -1,78 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-examples</artifactId>
<version>@VERSION@</version>
<packaging>jar</packaging>
<name>Apache POI</name>
<url>http://poi.apache.org/</url>
<description>Apache POI Examples</description>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>@VERSION@</version>
</dependency>
</dependencies>
</project>

View File

@ -1,78 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-excelant</artifactId>
<version>@VERSION@</version>
<packaging>jar</packaging>
<name>Apache POI</name>
<url>http://poi.apache.org/</url>
<description>Apache POI Excel Ant Tasks</description>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
</project>

View File

@ -1,68 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>@VERSION@</version>
<packaging>jar</packaging>
<name>Apache POI</name>
<url>http://poi.apache.org/</url>
<description>Apache POI - Java API To Access Microsoft Format Files</description>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
</dependency>
</dependencies>
</project>

View File

@ -1,78 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>@VERSION@</version>
<packaging>jar</packaging>
<name>Apache POI</name>
<url>http://poi.apache.org/</url>
<description>Apache POI - Java API To Access Microsoft Format Files</description>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>@VERSION@</version>
</dependency>
<dependency>
<groupId>com.github.virtuald</groupId>
<artifactId>curvesapi</artifactId>
<version>1.04</version>
</dependency>
</dependencies>
</project>

View File

@ -1,68 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>@VERSION@</version>
<packaging>jar</packaging>
<name>Apache POI</name>
<url>http://poi.apache.org/</url>
<description>Apache POI - Java API To Access Microsoft Format Files</description>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>@VERSION@</version>
</dependency>
</dependencies>
</project>

View File

@ -1,101 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>@VERSION@</version>
<packaging>jar</packaging>
<name>Apache POI</name>
<url>http://poi.apache.org/</url>
<description>Apache POI - Java API To Access Microsoft Format Files</description>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
<version>1.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
</dependencies>
</project>

View File

@ -1,67 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- POI OSGi Bundle System -->
<project name="POI OSGi Bundle" default="bundle" basedir=".." xmlns:mvn="antlib:org.apache.maven.artifact.ant">
<description>The Apache POI OSGi Bundle System.</description>
<property name="bundle.lib" location="osgi/lib"/>
<!-- TODO Import these from the parent build file -->
<property name="repository.m2" value="http://repo1.maven.org"/>
<property name="version.id" value="3.11-beta1"/>
<property name="dist.dir" value="build/dist"/>
<!-- jars in the /lib directory, see the fetch-bundle-jars target-->
<property name="bundle.bnd.jar" location="${bundle.lib}/bnd-1.50.0.jar"/>
<property name="bundle.bnd.url" value="${repository.m2}/maven2/biz/aQute/bnd/1.50.0/bnd-1.50.0.jar"/>
<import file="../build.xml"/>
<target name="check-bundle-jars">
<condition property="jars.bundle.present">
<available file="${bundle.bnd.jar}"/>
</condition>
</target>
<target name="fetch-bundle-jars" unless="jars.bundle.present">
<mkdir dir="${bundle.lib}"/>
<antcall target="downloadfile">
<param name="sourcefile" value="${bundle.bnd.url}"/>
<param name="destfile" value="${bundle.bnd.jar}"/>
</antcall>
</target>
<!--
<target name="bundle" depends="init, check-bundle-jars, fetch-bundle-jars, jar">
-->
<target name="bundle" depends="init, check-bundle-jars, fetch-bundle-jars">
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${bundle.bnd.jar}"/>
<mkdir dir="build/osgi"/>
<bnd
classpath="${dist.dir}/poi-${version.id}-${DSTAMP}.jar,${dist.dir}/poi-scratchpad-${version.id}-${DSTAMP}.jar,${dist.dir}/poi-ooxml-${version.id}-${DSTAMP}.jar"
eclipse="false"
failok="false"
exceptions="true"
output="build/osgi"
files="test.bnd"/>
<!-- TODO Include the settings from http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk/poi-3.9/pom.xml -->
<!-- TODO Make this actually spit out an OSGi Jar -->
</target>
</project>

View File

@ -1,38 +0,0 @@
\u001B[1mSYNOPSIS\u001B[0m
${project.description}
Original Maven URLs:
\u001B[33mmvn:${pkgGroupId}/poi/${pkgVersion}\u001B[0m
\u001B[33mmvn:${pkgGroupId}/poi-ooxml/${pkgVersion}\u001B[0m
\u001B[33mmvn:${pkgGroupId}/poi-scratchpad/${pkgVersion}\u001B[0m
\u001B[1mDESCRIPTION\u001B[0m
The Apache POI Project's mission is to create and maintain Java APIs for manipulating various file formats based
upon the Office Open XML standards (OOXML) and Microsoft's OLE 2 Compound Document format (OLE2). In short, you can
read and write MS Excel files using Java. In addition, you can read and write MS Word and MS PowerPoint files using
Java. Apache POI is your Java Excel solution (for Excel 97-2008). We have a complete API for porting other OOXML and
OLE2 formats and welcome others to participate.
OLE2 files include most Microsoft Office files such as XLS, DOC, and PPT as well as MFC serialization API based file
formats. The project provides APIs for the OLE2 Filesystem (POIFS) and OLE2 Document Properties (HPSF).
Office OpenXML Format is the new standards based XML file format found in Microsoft Office 2007 and 2008. This
includes XLSX, DOCX and PPTX. The project provides a low level API to support the Open Packaging Conventions using
openxml4j.
For each MS Office application there exists a component module that attempts to provide a common high level Java api
to both OLE2 and OOXML document formats. This is most developed for Excel workbooks (SS=HSSF+XSSF). Work is
progressing for Word documents (HWPF+XWPF) and PowerPoint presentations (HSLF+XSLF).
The project has recently added support for Outlook (HSMF). Microsoft opened the specifications to this format in
October 2007. We would welcome contributions.
There are also projects for Visio (HDGF), TNEF (HMEF), and Publisher (HPBF).
As a general policy we collaborate as much as possible with other projects to provide this functionality.
Examples include: Cocoon for which there are serializers for HSSF; Open Office.org with whom we collaborate in
documenting the XLS format; and Tika / Lucene, for which we provide format interpretors.
When practical, we donate components directly to those projects for POI-enabling them.
\u001B[1mSEE ALSO\u001B[0m
\u001B[36mhttp://poi.apache.org/\u001B[0m

View File

@ -1,229 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>10</version>
<relativePath />
</parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-bundle</artifactId>
<packaging>bundle</packaging>
<name>Apache POI OSGi bundle</name>
<description>
OSGi bundle that contains Apache POI, and the dependencies.
</description>
<url>http://poi.apache.org/</url>
<version>${poi.version}</version>
<!--
<version>3.12-beta2</version>
<version>@VERSION@</version>
-->
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<pax.exam.version>4.4.0</pax.exam.version>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-native</artifactId>
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>4.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-assembly</artifactId>
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>2.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Activator>
org.apache.poi.osgi.Activator
</Bundle-Activator>
<Embed-Dependency>
poi;inline=true,
poi-scratchpad;inline=true,
poi-ooxml;inline=true,
poi-ooxml-schemas,
xmlbeans
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Bundle-DocURL>${project.url}</Bundle-DocURL>
<Export-Package>
org.apache.poi.*
</Export-Package>
<Import-Package>
!org.junit,
*,
org.apache.xmlbeans.impl.xpath.saxon;resolution:=optional,
org.apache.xmlbeans.impl.xquery.saxon;resolution:=optional,
org.bouncycastle.cert;resolution:=optional,
org.bouncycastle.cert.ocsp;resolution:=optional,
org.bouncycastle.cms.bc;resolution:=optional,
org.bouncycastle.cert.jcajce;resolution:=optional,
org.bouncycastle.operator;resolution:=optional,
org.bouncycastle.operator.bc;resolution:=optional,
org.bouncycastle.tsp;resolution:=optional,
org.openxmlformats.schemas.officeDocument.x2006.math;resolution:=optional,
org.openxmlformats.schemas.schemaLibrary.x2006.main;resolution:=optional,
schemasMicrosoftComOfficePowerpoint;resolution:=optional,
schemasMicrosoftComOfficeWord;resolution:=optional,
</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>java6</id>
<activation>
<jdk>[1.6,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptor>test-bundles.xml</descriptor>
<finalName>test</finalName>
<attach>false</attach>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<org.ops4j.pax.logging.DefaultServiceLog.level>
WARN
</org.ops4j.pax.logging.DefaultServiceLog.level>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<organization>
<name>The Apache Software Founation</name>
<url>http://www.apache.org</url>
</organization>
<scm>
<url>http://svn.apache.org/viewvc/poi/trunk/osgi</url>
<connection>scm:svn:http://svn.apache.org/repos/asf/poi/trunk/osgi</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/poi/trunk/osgi</developerConnection>
</scm>
</project>

View File

@ -1,28 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.osgi;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
public void start(BundleContext context) throws Exception {
}
public void stop(BundleContext context) throws Exception {
}
}

View File

@ -1,84 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.osgi;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.options;
import javax.inject.Inject;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerMethod;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
/**
* Test to ensure that all our main formats can create, write
* and read back in, when running under OSGi
*/
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerMethod.class)
public class TestOSGiBundle {
private final File TARGET = new File("target");
@Inject
private BundleContext bc;
@Configuration
public Option[] configuration() throws IOException, URISyntaxException {
File base = new File(TARGET, "test-bundles");
return options(
junitBundles(),
bundle(new File(base, "poi-bundle.jar").toURI().toURL().toString()));
}
@Test
public void testHSSF() throws Exception {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet("OSGi");
s.createRow(0).createCell(0).setCellValue("With OSGi");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
wb.write(baos);
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
wb = new HSSFWorkbook(bais);
assertEquals(1, wb.getNumberOfSheets());
s = wb.getSheet("OSGi");
assertEquals("With OSGi", s.getRow(0).getCell(0).toString());
}
}

View File

@ -1,34 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>bundles</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory/>
<outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping>
<includes>
<include>org.apache.poi:poi-bundle</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>

View File

@ -1,128 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
=======================================================================
Use Apache Ant to generate a patch file.
=======================================================================
-->
<project name="create-patch" default="patchpackage" basedir=".">
<property environment="env"/>
<property name="patch.package" value="patch.tar.gz"/>
<property name="patch.file" value="patch.txt"/>
<condition property="svn.found">
<or>
<available file="svn" filepath="${env.PATH}"/>
<available file="svn.exe" filepath="${env.PATH}"/>
<available file="svn.exe" filepath="${env.Path}"/>
</or>
</condition>
<target name="createpatch">
<fail unless="svn.found" message="You need a version of svn to create the patch"/>
<exec executable="svn" output="${patch.file}">
<arg value="diff"/>
</exec>
</target>
<target name="newfiles">
<exec executable="svn" output="${patch.file}.tmp">
<arg value="status"/>
</exec>
<!-- prepare the list of files to include in patch.tar.gz -->
<loadfile srcfile="${patch.file}.tmp" property="tar.file.list">
<filterchain>
<!-- capture any new files -->
<linecontainsregexp>
<regexp pattern="^(\?|A)......"/>
</linecontainsregexp>
<!-- filter out the first six characters -->
<tokenfilter>
<replaceregex pattern="^(.......)" replace=""/>
</tokenfilter>
<!--remove line breaks -->
<striplinebreaks/>
</filterchain>
</loadfile>
</target>
<target name="patchpackage" depends="createpatch,newfiles">
<delete file="${patch.package}"/>
<tar includes="${tar.file.list}"
destfile="${patch.package}"
basedir="."
compression="gzip" >
</tar>
<delete file="${patch.file}.tmp"/>
</target>
<target name="apply"
description="apply patch.tar.gz files generated by patchpackage">
<!--
extract patch.tar.gz to svn working copy
$ tar xvzf patch.tar.gz
-->
<echo message="extracting ${patch.file} to working copy"/>
<untar src="${patch.package}"
dest="."
failOnEmptyArchive="true"
compression="gzip">
</untar>
<!--
Apply the changes from patch.txt
$ svn patch patch.txt
-->
<echo message="svn patch ${patch.file}"/>
<fail unless="svn.found" message="You need a version of svn to create the patch"/>
<exec executable="svn">
<arg value="patch"/>
<arg value="${patch.file}"/>
</exec>
<delete file="${patch.file}"/>
<!--
get a list of all new files in patch.tar.gz and store in tar.file.list filelist
$ tar tf patch.tar.gz | grep -v patch\.txt | xargs svn add
-->
<echo message="Getting ${patch.file} file list"/>
<delete dir="${patch.package}.tmp" quiet="false" failonerror="false" />
<untar src="${patch.package}"
dest="${patch.package}.tmp"
failOnEmptyArchive="true"
compression="gzip">
</untar>
<fileset dir="${patch.package}.tmp"
id="tar.file.list"
excludes="${patch.file}"/>
<!-- add new files -->
<echo message="Adding new files to svn working copy"/>
<apply executable="svn"
relative="true">
<arg value="add"/>
<fileset refid="tar.file.list"/>
</apply>
<delete dir="${patch.package}.tmp"/>
</target>
</project>

View File

@ -1,76 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
</parent>
<artifactId>poi-examples</artifactId>
<packaging>jar</packaging>
<name>Apache POI Examples package</name>
<build>
<plugins>
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.plugin.resources.version}</version>
<executions>
<execution>
<id>copy-sources</id>
<!-- here the phase you need -->
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<resources>
<resource>
<directory>../../src/examples/src</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- clean copied sources afterwards -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.plugin.clean.version}</version>
<configuration>
<filesets>
<fileset>
<directory>src</directory>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${project.version}</version>
</dependency>
<!-- non-test dependency for UpdateEmbeddedDoc -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,114 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
</parent>
<artifactId>poi-excelant</artifactId>
<packaging>jar</packaging>
<name>Apache POI ExcelAnt package</name>
<build>
<plugins>
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.plugin.resources.version}</version>
<executions>
<execution>
<id>copy-sources</id>
<!-- here the phase you need -->
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<resources>
<resource>
<directory>../../src/excelant/java</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
<resources>
<resource>
<directory>../../src/excelant/resources</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-tests</id>
<!-- here the phase you need -->
<phase>generate-test-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/test/java</outputDirectory>
<resources>
<resource>
<directory>../../src/excelant/testcases</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- clean copied sources afterwards -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.plugin.clean.version}</version>
<configuration>
<filesets>
<fileset>
<directory>src</directory>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.2</version>
</dependency>
</dependencies>
</project>

View File

@ -1,129 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
</parent>
<artifactId>poi-main</artifactId>
<packaging>jar</packaging>
<name>Apache POI Main package</name>
<build>
<plugins>
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.plugin.resources.version}</version>
<executions>
<execution>
<id>copy-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<resources>
<resource>
<directory>../../src/java</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
<resources>
<resource>
<directory>../../src/resources/main</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-tests</id>
<!-- here the phase you need -->
<phase>generate-test-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/test/java</outputDirectory>
<resources>
<resource>
<directory>../../src/testcases</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- clean copied sources afterwards -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.plugin.clean.version}</version>
<configuration>
<filesets>
<fileset>
<directory>src</directory>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- provide the test-jar for other modules -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven.plugin.jar.version}</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- set jvm parameters for surefire plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.plugin.surefire.version}</version>
<configuration>
<argLine>-Duser.language=en -Duser.country=US -Xmx1024m -XX:MaxPermSize=256m -XX:-OmitStackTraceInFastThrow</argLine>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</project>

View File

@ -1,55 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema-encryption</artifactId>
<packaging>jar</packaging>
<name>Apache POI - Openxmlformats Encryption Schema package</name>
<properties>
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property -->
<sonar.exclusions>target/generated-sources/*</sonar.exclusions>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven.plugin.antrun.version}</version>
<executions>
<execution>
<id>unzip-schema</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy todir="target/schemas">
<fileset dir="../../src/ooxml/resources/org/apache/poi/poifs/crypt" includes="encryption*.*"/>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>${xmlbeans.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1 +0,0 @@
This purpose of this marker file is solely to activate the xmlbeans maven profile.

View File

@ -1,144 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema-security</artifactId>
<packaging>jar</packaging>
<name>Apache POI - Openxmlformats Security-Schema package</name>
<properties>
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property -->
<sonar.exclusions>target/generated-sources/*</sonar.exclusions>
<maven.compiler.fork>true</maven.compiler.fork>
<xmlbeans.noUpa>true</xmlbeans.noUpa>
<xmlbeans.noPvr>true</xmlbeans.noPvr>
</properties>
<build>
<plugins>
<!-- Download and unpack the OfficeOpenXML Schema and use xmlbeans to create classes from the XSDs -->
<!-- use maven plugin instead of ant tasks get because of caching feature ... -->
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>maven-download-plugin</artifactId>
<version>${maven.plugin.download.version}</version>
<executions>
<execution>
<id>install-xsds-part-1</id>
<phase>generate-sources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<url>http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%202%20(PDF).zip</url>
<unpack>true</unpack>
<md5>c8f0eac388691d5be0d1647146400a10</md5>
</configuration>
</execution>
<execution>
<id>install-xsds-part-2</id>
<phase>generate-sources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<outputDirectory>target/schemas</outputDirectory>
<url>http://dublincore.org/schemas/xmls/qdc/2003/04/02/dc.xsd</url>
</configuration>
</execution>
<execution>
<id>install-xsds-part-3</id>
<phase>generate-sources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<outputDirectory>target/schemas</outputDirectory>
<url>http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcterms.xsd</url>
</configuration>
</execution>
<execution>
<id>install-xsds-part-4</id>
<phase>generate-sources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<outputDirectory>target/schemas</outputDirectory>
<url>http://dublincore.org/schemas/xmls/qdc/2003/04/02/dcmitype.xsd</url>
</configuration>
</execution>
<execution>
<id>install-xsds-part-5</id>
<phase>generate-sources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<outputDirectory>target/schemas</outputDirectory>
<url>http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd</url>
</configuration>
</execution>
<execution>
<id>install-xsds-part-6</id>
<phase>generate-sources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<outputDirectory>target/schemas</outputDirectory>
<url>http://uri.etsi.org/01903/v1.3.2/XAdES.xsd</url>
</configuration>
</execution>
<execution>
<id>install-xsds-part-7</id>
<phase>generate-sources</phase>
<goals><goal>wget</goal></goals>
<configuration>
<outputDirectory>target/schemas</outputDirectory>
<url>http://uri.etsi.org/01903/v1.4.1/XAdESv141.xsd</url>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven.plugin.antrun.version}</version>
<executions>
<execution>
<id>unzip-schema</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo message="unzip schemas" />
<unzip src="target/OpenPackagingConventions-XMLSchema.zip" dest="target/schemas/" />
<copy file="../../src/ooxml/resources/org/apache/poi/poifs/crypt/signatureInfo.xsd"
todir="target/schemas"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>${xmlbeans.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1 +0,0 @@
This purpose of this marker file is solely to activate the xmlbeans maven profile.

View File

@ -1,89 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>poi-ooxml-schema</artifactId>
<packaging>jar</packaging>
<name>Apache POI - Openxmlformats Schema package</name>
<properties>
<!-- see http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus for details of this property -->
<sonar.exclusions>target/generated-sources/*</sonar.exclusions>
<maven.compiler.fork>true</maven.compiler.fork>
<xmlbeans.xsdconfig>${basedir}/../../src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig</xmlbeans.xsdconfig>
</properties>
<build>
<plugins>
<!-- Download and unpack the OfficeOpenXML Schema and use xmlbeans to create classes from the XSDs -->
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>maven-download-plugin</artifactId>
<version>${maven.plugin.download.version}</version>
<executions>
<execution>
<id>download-xsds</id>
<phase>generate-sources</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%201st%20edition%20Part%204%20(PDF).zip</url>
<unpack>true</unpack>
<md5>abe6bb6e7799e854934b3c634e8bcf7b</md5>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven.plugin.antrun.version}</version>
<executions>
<execution>
<id>unzip-schema</id>
<phase>generate-sources</phase>
<configuration>
<target>
<echo message="unzip schemas" />
<unzip src="target/OfficeOpenXML-XMLSchema.zip" dest="target/schemas" />
<copy file="../../src/ooxml/resources/org/apache/poi/xdgf/visio.xsd"
todir="target/schemas"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>${xmlbeans.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1 +0,0 @@
This purpose of this marker file is solely to activate the xmlbeans maven profile.

View File

@ -1,165 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
</parent>
<artifactId>poi-ooxml</artifactId>
<packaging>jar</packaging>
<name>Apache POI OOXML package</name>
<build>
<plugins>
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.plugin.resources.version}</version>
<executions>
<execution>
<id>copy-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<resources>
<resource>
<directory>../../src/ooxml/java</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
<resources>
<resource>
<directory>../../src/resources/ooxml</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-tests</id>
<phase>generate-test-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/test/java</outputDirectory>
<resources>
<resource>
<directory>../../src/ooxml/testcases</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- clean copied sources afterwards -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.plugin.clean.version}</version>
<configuration>
<filesets>
<fileset>
<directory>src</directory>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>build</directory>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<!-- set jvm parameters for surefire plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.plugin.surefire.version}</version>
<configuration>
<argLine>-Duser.language=en -Duser.country=US -Xmx1024m -XX:MaxPermSize=256m -XX:-OmitStackTraceInFastThrow</argLine>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-ooxml-schema</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-ooxml-schema-encryption</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-ooxml-schema-security</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>${xmlbeans.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk15on</artifactId>
<version>1.54</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.54</version>
</dependency>
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>com.github.virtuald</groupId>
<artifactId>curvesapi</artifactId>
<version>1.04</version>
</dependency>
<!-- non-test dependency for OOXMLLite -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,272 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<packaging>pom</packaging>
<version>3.15-beta4-SNAPSHOT</version>
<name>Apache POI - the Java API for Microsoft Documents</name>
<description>Maven build of Apache POI for Sonar checks</description>
<url>http://poi.apache.org/</url>
<mailingLists>
<mailingList>
<name>POI Users List</name>
<subscribe>user-subscribe@poi.apache.org</subscribe>
<unsubscribe>user-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-user/</archive>
</mailingList>
<mailingList>
<name>POI Developer List</name>
<subscribe>dev-subscribe@poi.apache.org</subscribe>
<unsubscribe>dev-unsubscribe@poi.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/poi-dev/</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
</organization>
<issueManagement>
<system>bugzilla</system>
<url>https://issues.apache.org/bugzilla/</url>
</issueManagement>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/poi/trunk</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/poi/trunk</developerConnection>
<url>http://svn.apache.org/viewvc/poi</url>
</scm>
<modules>
<module>main</module>
<module>ooxml-schema</module>
<module>ooxml-schema-encryption</module>
<module>ooxml-schema-security</module>
<module>ooxml</module>
<module>scratchpad</module>
<module>excelant</module>
<module>examples</module>
</modules>
<properties>
<project.build.sourceEncoding>ASCII</project.build.sourceEncoding>
<!-- Try to disable running SVN blame as it causes errors here because the source is copied from the actual SVN location here! -->
<sonar.scm.disabled>true</sonar.scm.disabled>
<!-- define some of the third-party or plugin-versions globally to use the same in all modules -->
<xmlbeans.version>2.6.0</xmlbeans.version>
<junit.version>4.12</junit.version>
<maven.plugin.resources.version>3.0.1</maven.plugin.resources.version>
<maven.plugin.jar.version>3.0.1</maven.plugin.jar.version>
<maven.plugin.clean.version>3.0.0</maven.plugin.clean.version>
<maven.plugin.download.version>1.1.0</maven.plugin.download.version>
<maven.plugin.antrun.version>1.8</maven.plugin.antrun.version>
<maven.plugin.surefire.version>2.19.1</maven.plugin.surefire.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.plugin.surefire.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${maven.plugin.surefire.version}</version>
</dependency>
</dependencies>
<configuration>
<systemPropertyVariables>
<POI.testdata.path>../../test-data</POI.testdata.path>
<java.awt.headless>true</java.awt.headless>
<org.apache.poi.util.POILogger>org.apache.poi.util.NullLogger</org.apache.poi.util.POILogger>
</systemPropertyVariables>
<!-- use to following to analyze OOM issues: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -->
<argLine>-Duser.language=en -Duser.country=US -Xmx1024m</argLine>
<excludes>
<exclude>**/All*Tests.java</exclude>
<exclude>**/TestUnfixedBugs.java</exclude>
<exclude>**/TestcaseRecordInputStream.java</exclude>
<exclude>**/POITestCase.java</exclude>
<!-- TODO: error about no public construct, seems to run with JUnit 3.8... -->
<exclude>**/TestWordToConverterSuite*.java</exclude>
<exclude>**/TestExcelConverterSuite*.java</exclude>
</excludes>
<!--test>TestPPTX2PNG</test-->
<!--parallel>both</parallel>
<threadCount>10</threadCount-->
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<!-- We need a fair amount of memory to compile the xml schema, -->
<!-- but limit it in case it goes wrong! -->
<!-- Pick the right amount based on 32 vs 64 bit jvm -->
<!-- ********************************************************** -->
<!-- If you are using IntelliJ, you might want to check -->
<!-- http://stackoverflow.com/questions/24115142 -->
<!-- ********************************************************** -->
<profile>
<id>32bitstuff</id>
<activation>
<property>
<name>sun.arch.data.model</name>
<value>32</value>
</property>
</activation>
<properties>
<maven.compiler.maxmem>512m</maven.compiler.maxmem>
<argLine>-Xmx768m -XX:MaxPermSize=128m @{argLine}</argLine>
</properties>
</profile>
<profile>
<id>64bitstuff</id>
<activation>
<property>
<name>sun.arch.data.model</name>
<value>64</value>
</property>
</activation>
<properties>
<maven.compiler.maxmem>768m</maven.compiler.maxmem>
<argLine>-Xmx1024m -XX:MaxPermSize=256m @{argLine}</argLine>
</properties>
</profile>
<profile>
<id>xmlbean</id>
<activation>
<file><exists>xmlbeans.marker</exists></file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xmlbeans-maven-plugin</artifactId>
<version>2.3.3</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>xmlbeans</goal>
</goals>
<configuration>
<schemaDirectory>${basedir}/target/schemas</schemaDirectory>
<javaSource>1.5</javaSource>
<noJavac>true</noJavac>
<noUpa>${xmlbeans.noUpa}</noUpa>
<noPvr>${xmlbeans.noPvr}</noPvr>
<xmlConfigs>
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionCertificate.xsdconfig</xmlConfig>
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionInfo.xsdconfig</xmlConfig>
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/poifs/crypt/encryptionPassword.xsdconfig</xmlConfig>
<xmlConfig implementation="java.io.File">${basedir}/../../src/ooxml/resources/org/apache/poi/schemas/ooxmlSchemas.xsdconfig</xmlConfig>
</xmlConfigs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven.plugin.antrun.version}</version>
<executions>
<execution>
<id>copy-xmltype-and-xsdconfig</id>
<phase>generate-sources</phase>
<goals><goal>run</goal></goals>
<configuration>
<target>
<copy todir="${basedir}/target/generated-sources/xmlbeans">
<fileset dir="${basedir}/../../src/ooxml/java">
<include name="org/apache/poi/POIXMLTypeLoader.java"/>
<include name="org/apache/poi/util/DocumentHelper.java"/>
<include name="org/apache/poi/util/SAXHelper.java"/>
</fileset>
<fileset dir="${basedir}/../../src/java">
<include name="org/apache/poi/util/POILogFactory.java"/>
<include name="org/apache/poi/util/POILogger.java"/>
<include name="org/apache/poi/util/NullLogger.java"/>
<include name="org/apache/poi/util/Internal.java"/>
</fileset>
</copy>
<copy todir="${basedir}/target/schemas">
<fileset dir="${basedir}/../../src/ooxml/resources/org/apache/poi/schemas"/>
</copy>
</target>
</configuration>
</execution>
<execution>
<id>replace-xmltypeloader</id>
<phase>process-sources</phase>
<goals><goal>run</goal></goals>
<configuration>
<target>
<replace dir="${basedir}/target/generated-sources/xmlbeans" includes="**/*.java" excludes="**/impl/**">
<replacetoken>org.apache.xmlbeans.XmlBeans.getContextTypeLoader()</replacetoken>
<replacevalue>org.apache.poi.POIXMLTypeLoader</replacevalue>
</replace>
</target>
</configuration>
</execution>
<execution>
<id>remove-xmltypeloader-from-schema-jar</id>
<phase>prepare-package</phase>
<goals><goal>run</goal></goals>
<configuration>
<target>
<touch file="${basedir}/target/generated-sources/xmlbeans/.staleFlag"/>
<delete dir="${basedir}/target/classes/org/apache"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>${xmlbeans.version}</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

View File

@ -1,109 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.poi</groupId>
<artifactId>poi-parent</artifactId>
<version>3.15-beta4-SNAPSHOT</version>
</parent>
<artifactId>poi-scratchpad</artifactId>
<packaging>jar</packaging>
<name>Apache POI Scratchpad package</name>
<properties>
<!-- Exclude some generated code from Sonar analysis -->
<sonar.exclusions>src/main/java/org/apache/poi/hwpf/model/types/*,src/main/java/org/apache/poi/hdf/model/hdftypes/definitions/*</sonar.exclusions>
</properties>
<build>
<plugins>
<!-- copy sources, resources and tests in place as otherwise Sonar does not pick them up correctly! -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven.plugin.resources.version}</version>
<executions>
<execution>
<id>copy-sources</id>
<!-- here the phase you need -->
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<resources>
<resource>
<directory>../../src/scratchpad/src</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/main/resources</outputDirectory>
<resources>
<resource>
<directory>../../src/resources/scratchpad</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-tests</id>
<!-- here the phase you need -->
<phase>generate-test-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/src/test/java</outputDirectory>
<resources>
<resource>
<directory>../../src/scratchpad/testcases</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- clean copied sources afterwards -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.plugin.clean.version}</version>
<configuration>
<filesets>
<fileset>
<directory>src</directory>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>poi-main</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,332 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# Makefile for building Poi4R
#
# Supported operating systems: Linux, Mac OS X and Windows.
# See INSTALL file for requirements.
#
# Steps to build
# 1. Edit the sections below as documented
# 2. make all
# 3. make install
#
# The install target installs the Poi4R python extension in python's
# site-packages directory. On Mac OS X, it also installs the gcj runtime
# libraries into $(PREFIX)/lib.
#
# To successfully import the Poi4R extension into Ruby, all required
# libraries need to be found. If the locations you chose are non-standard,
# the relevant DYLD_LIBRARY_PATH (Mac OS X), LD_LIBRARY_PATH (Linux), or
# PATH (Windows) need to be set accordingly.
#
VERSION=0.1.0
POI_VER=$(shell grep '<property name="version.id"' ../../../build.xml | awk -F'"' '{print $$4}')
RUBY_VER=1.8
POI4R:=$(shell pwd)
POI=$(POI4R)/poi-$(POI_VER)
#DEBUG=1
#
# You need to uncomment and edit the variables below in the section
# corresponding to your operating system.
#
# PREFIX: where programs are normally installed on your system (Unix).
# PREFIX_RUBY: where your version of python is installed.
# GCJ_HOME: where GCC/GCJ is installed.
# Windows drive-absolute paths need to be expressed cygwin style.
#
# Mac OS X (Darwin)
#PREFIX=/usr/local
#PREFIX_RUBY=/Library/Frameworks/Ruby.framework/Versions/$(RUBY_VER)
#SWIG=$(PREFIX)/bin/swig
#GCJ_HOME=/usr/local/gcc-3.4.1
#DB=$(POI4R)/db-$(DB_VER)
#PREFIX_DB=/usr/local/BerkeleyDB.$(DB_LIB_VER)
# Linux
PREFIX=/usr
PREFIX_RUBY=$(PREFIX)
SWIG=$(PREFIX)/bin/swig
GCJ_HOME=/usr
#DB=$(POI4R)/db-$(DB_VER)
#PREFIX_DB=$(PREFIX)/BerkeleyDB.$(DB_LIB_VER)
# Windows
#PREFIX_RUBY=/cygdrive/o/Python-2.3.2
#SWIG=/cygdrive/c/utils/bin/swig.exe
#GCJ_HOME=/cygdrive/o/mingw-3.1
#DB=/cygdrive/o/db-$(DB_VER)
#PREFIX_DB=$(DB)
#
# No edits required below
#
OS=$(shell uname)
ifeq ($(findstring CYGWIN,$(OS)),CYGWIN)
OS=Cygwin
endif
ifeq ($(findstring WINNT,$(OS)),WINNT)
OS=Cygwin
endif
ifeq ($(DEBUG),1)
COMP_OPT=DEBUG=1
SUFFIX=d
_SUFFIX=_d
BINDIR=debug
else
COMP_OPT=
SUFFIX=
_SUFFIX=
BINDIR=release
endif
SWIG_OPT=-DSWIG_COBJECT_TYPES -DPOI4R_VER="'$(VERSION)'" -DPOI_VER="'$(POI_VER)'"
JCCFLAGS=--encoding=UTF-8
#JCCFLAGS=--encoding=UTF-8 -findirect-dispatch
ifeq ($(OS),Darwin)
RUBY_SITE=$(PREFIX_RUBY)/lib/ruby$(RUBY_VER)/site-packages
RUBY_INC=$(PREFIX_RUBY)/lib/ruby$(RUBY_VER)
POI4R=$(BINDIR)/poi4r.so
ifeq ($(DEBUG),1)
CCFLAGS=-O0 -g
LDFLAGS=-g
else
CCFLAGS=-O2
LDFLAGS=
endif
else
ifeq ($(OS),Linux)
RUBY_SITE=$(PREFIX_RUBY)/lib/ruby/site-ruby/$(RUBY_VER)/
RUBY_INC=$(PREFIX_RUBY)/lib/ruby/$(RUBY_VER)/i686-linux
POI4R_LIB=$(BINDIR)/poi4r.so
ifeq ($(DEBUG),1)
CCFLAGS=-O0 -g -fPIC
LDFLAGS=-g
else
CCFLAGS=-O2 -fPIC
LDFLAGS=
endif
else
ifeq ($(OS),Cygwin)
RUBY_SITE=`cygpath -aw $(PREFIX_RUBY)/Lib/site-packages`
RUBY_INC=`cygpath -aw $(PREFIX_RUBY)/Include`
RUBY_PC=`cygpath -aw $(PREFIX_RUBY)/PC`
POI4R_LIB=$(BINDIR)/poi4r$(_SUFFIX).so
ifeq ($(DEBUG),1)
CCFLAGS=-O -g
LDFLAGS=-g
else
CCFLAGS=-O2
LDFLAGS=
endif
else
RUBY=unknown
RUBY_SITE=unknown
endif
endif
endif
CLASSES=$(BINDIR)/classes
JAR_CLASSES=$(CLASSES)/jar
CC=$(GCJ_HOME)/bin/gcc
CXX=$(GCJ_HOME)/bin/g++
JCC=$(GCJ_HOME)/bin/gcj
JCCH=$(GCJ_HOME)/bin/gcjh
JAR=$(GCJ_HOME)/bin/jar
POI_ZIP=poi-$(POI_VER).jar
POI_JAR=poi-$(POI_VER).jar
POI_JAR_WC=poi-$(POI_VER)-*.jar
POI4R_CP:=$(BINDIR)/$(POI_JAR):$(CLASSES)
OBJS=$(BINDIR)/poi.o $(BINDIR)/io.java.o $(BINDIR)/io.cpp.o
LIBS=$(POI4R_LIB)
default: all
patches:
env:
ifndef PREFIX_RUBY
@echo Operating system is $(OS)
@echo You need to edit that section of the Makefile
@false
else
@true
endif
$(BINDIR):
mkdir -p $(BINDIR)/classes/jar
DISTRIB=Poi-$(VERSION)
ifeq ($(OS),Cygwin)
POI4R_CP:=`cygpath -awp $(POI4R_CP)`
endif
ifeq ($(OS),Cygwin)
_poi=`cygpath -aw $(POI)`
else
_poi=$(POI)
endif
$(BINDIR)/$(POI_JAR):
cp ../../../build/dist/$(POI_JAR_WC) $(BINDIR)/$(POI_JAR)
cd $(JAR_CLASSES); $(JAR) -xf ../../$(POI_JAR)
$(BINDIR)/io.java.o: java/org/apache/poi/RubyOutputStream.java
$(JCC) $(JCCFLAGS) -C -d $(CLASSES) java/org/apache/poi/RubyOutputStream.java
$(JCC) $(JCCFLAGS) $(CCFLAGS) -I$(GCJ_HOME)/include -c -o $@ java/org/apache/poi/RubyOutputStream.java
$(CLASSES)/org/apache/poi/RubyOutputStream.h: $(BINDIR)/io.java.o Makefile
mkdir -p $(CLASSES)/org/apache/poi/hssf/usermodel
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFWorkbook
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFSheet
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFRow
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFCell
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFHeader
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFFooter
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFFont
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFDataFormat
$(JCCH) -d $(CLASSES) --classpath=$(JAR_CLASSES) org.apache.poi.hssf.usermodel.HSSFCellStyle
$(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.poi.RubyOutputStream
$(BINDIR)/io.cpp.o: $(CLASSES)/org/apache/poi/RubyOutputStream.h cpp/RubyIO.cpp $(BINDIR)/io.java.o
$(JCC) -I$(RUBY_INC) -I$(GCJ_HOME)/include -I$(CLASSES) $(CCFLAGS) -c -o $@ cpp/RubyIO.cpp
$(BINDIR)/poi.o: $(BINDIR)/$(POI_JAR)
$(JCC) $(JCCFLAGS) $(CCFLAGS) -c -o $@ $(BINDIR)/$(POI_JAR)
Poi4R_wrap.cxx: $(BINDIR)/io.cpp.o Poi4R.i
ifdef SWIG
$(SWIG) $(SWIG_OPT) -I$(CLASSES) -c++ -ruby Poi4R.i
endif
ifeq ($(OS),Darwin)
$(POI4R_LIB): $(OBJS) Poi4R_wrap.cxx
$(CXX) -shared -bundle -o $@ $(CCFLAGS) $(SWIG_OPT) $(DB_INC) -I$(GCJ_HOME)/include -I$(CLASSES) -I$(RUBY_INC) Poi4R_wrap.cxx $(OBJS) -L$(GCJ_HOME)/lib -lgcj -liconv -undefined suppress -flat_namespace -multiply_defined suppress
else
ifeq ($(OS),Linux)
$(POI4R_LIB): $(OBJS) Poi4R_wrap.cxx
$(CXX) -shared -o $@ $(CCFLAGS) $(SWIG_OPT) $(DB_INC) -I$(CLASSES) -I$(RUBY_INC) Poi4R_wrap.cxx $(OBJS) -lgcj
else
ifeq ($(OS),Cygwin)
$(POI4R_LIB): $(OBJS) Poi4R_wrap.cxx
$(CXX) -c $(CCFLAGS) $(PYDBG) -D_NO_OLDNAMES -D_off_t=off_t $(SWIG_OPT) $(DB_INC) -I$(CLASSES) -I$(RUBY_PC) -I$(RUBY_INC) -o $(BINDIR)/Poi4R_wrap.o Poi4R_wrap.cxx
$(CXX) -shared $(LDFLAGS) -o $@ $(OBJS) `cygpath -aw $(PREFIX_RUBY)/python23$(_SUFFIX).dll` $(BINDIR)/Poi4R_wrap.o -lgcj -lwin32k -lws2_32
endif
endif
endif
all: env $(BINDIR) $(LIBS)
@echo build of $(POI4R_LIB) complete
install:: all
install Poi4R.rb $(RUBY_SITE)
install $(POI4R_LIB) $(RUBY_SITE)
ifeq ($(OS),Darwin)
install::
install $(GCJ_HOME)/lib/libgcj.5.dylib $(PREFIX)/lib
install $(GCJ_HOME)/lib/libstdc++.6.dylib $(PREFIX)/lib
install $(GCJ_HOME)/lib/libgcc_s.1.0.dylib $(PREFIX)/lib
else
ifeq ($(OS),Linux)
install::
else
ifeq ($(OS),Cygwin)
install::
endif
endif
endif
clean:
rm -rf $(BINDIR) Poi4R.rb* Poi4R_wrap.cxx
realclean: clean
rm -rf $(POI) $(STORE) $(DISTRIB)
distrib::
mkdir -p $(DISTRIB)/python
install Poi4R.rb $(DISTRIB)/python
install $(POI4R_LIB) $(DISTRIB)/python
install README $(DISTRIB)
ifeq ($(OS),Darwin)
distrib::
ifdef DB
mkdir -p $(DISTRIB)/db
install $(LIBDB_JAVA_LIB) $(DISTRIB)/db
install libdb_java-$(DB_LIB_VER).la.osx $(DISTRIB)/db
endif
mkdir -p $(DISTRIB)/gcj
install $(GCJ_HOME)/lib/libgcj.5.dylib $(DISTRIB)/gcj
install $(GCJ_HOME)/lib/libstdc++.6.dylib $(DISTRIB)/gcj
install $(GCJ_HOME)/lib/libgcc_s.1.0.dylib $(DISTRIB)/gcj
else
ifeq ($(OS),Linux)
distrib::
ifdef DB
mkdir -p $(DISTRIB)/db
install $(LIBDB_JAVA_LIB) $(DISTRIB)/db
endif
mkdir -p $(DISTRIB)/gcj
install $(GCJ_HOME)/lib/libgcj.so.5 $(DISTRIB)/gcj
install $(GCJ_HOME)/lib/libstdc++.so.6 $(DISTRIB)/gcj
install $(GCJ_HOME)/lib/libgcc_s.so.1 $(DISTRIB)/gcj
else
ifeq ($(OS),Cygwin)
distrib::
ifdef DB
mkdir -p $(DISTRIB)/db
install $(LIBDB_JAVA_LIB) $(DISTRIB)/db
endif
endif
endif
endif

View File

@ -1,614 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
%module poi4r
%{
#include <gcj/cni.h>
#include <java/lang/Object.h>
#include <java/lang/Thread.h>
#include <java/lang/ThreadGroup.h>
#include <java/lang/Runnable.h>
#include <java/lang/String.h>
#include <java/lang/Throwable.h>
#include <java/lang/Comparable.h>
#include <java/lang/Integer.h>
#include <java/lang/Long.h>
#include <java/lang/Float.h>
#include <java/lang/Double.h>
#include <java/io/StringWriter.h>
#include <java/io/PrintWriter.h>
#include <java/util/HashMap.h>
#include <java/util/Date.h>
#include <java/util/Calendar.h>
#include <java/lang/System.h>
#include "org/apache/poi/hssf/usermodel/HSSFWorkbook.h"
#include "org/apache/poi/hssf/usermodel/HSSFSheet.h"
#include "org/apache/poi/hssf/usermodel/HSSFRow.h"
#include "org/apache/poi/hssf/usermodel/HSSFCell.h"
#include "org/apache/poi/hssf/usermodel/HSSFFont.h"
#include "org/apache/poi/hssf/usermodel/HSSFCellStyle.h"
#include "org/apache/poi/hssf/usermodel/HSSFDataFormat.h"
#include "org/apache/poi/hssf/usermodel/HSSFHeader.h"
#include "org/apache/poi/hssf/usermodel/HSSFFooter.h"
#include "org/apache/poi/RubyOutputStream.h"
typedef ::org::apache::poi::hssf::usermodel::HSSFWorkbook *jhworkbook;
typedef ::org::apache::poi::hssf::usermodel::HSSFSheet *jhsheet;
typedef ::org::apache::poi::hssf::usermodel::HSSFRow *jhrow;
typedef ::org::apache::poi::hssf::usermodel::HSSFCell *jhcell;
typedef ::org::apache::poi::hssf::usermodel::HSSFCellStyle *jhcellstyle;
typedef ::org::apache::poi::hssf::usermodel::HSSFFont *jhfont;
typedef ::org::apache::poi::hssf::usermodel::HSSFFooter *jhfooter;
typedef ::org::apache::poi::hssf::usermodel::HSSFHeader *jhheader;
typedef ::org::apache::poi::hssf::usermodel::HSSFDataFormat *jhdataformat;
typedef ::java::util::Date *jdate;
typedef ::java::util::Calendar *jcalendar;
typedef ::java::io::OutputStream *joutputstream;
typedef ::java::io::InputStream *jinputstream;
typedef ::java::util::Collection *jstringCollection;
typedef ::java::util::Collection *jtermCollection;
typedef ::java::util::Locale *jlocale;
typedef ::java::lang::Comparable *jcomparable;
typedef JArray<jobject> *jobjectArray;
typedef JArray<jstring> *jstringArray;
static java::lang::Thread *nextThread;
static java::util::HashMap *objects;
static void store_reference(jobject object) {
java::lang::Integer *ji =new java::lang::Integer(java::lang::System::identityHashCode(object));
jobject jo = objects->get(ji);
if (!jo) {
// printf("put object in hash\n");
objects->put(ji,object);
}
}
static VALUE jo2rv(jobject object, swig_type_info *descriptor)
{
if (object == NULL)
{
return Qnil;
}
else
{
return SWIG_NewPointerObj((void *) object, descriptor, 0);
}
}
static int cvtptr(VALUE value, void **jo, swig_type_info *info)
{
if (SWIG_ConvertPtr(value, jo, info, 0) == 0)
return 0;
else
{
return -1;
}
}
static int rv2jo(VALUE rv, jobject *jo, swig_type_info *descriptor)
{
if (NIL_P(rv))
*jo = NULL;
else
{
java::lang::Object *javaObj;
if (cvtptr(rv, (void **) &javaObj, descriptor) == -1)
return 0;
*jo = javaObj;
}
return 1;
}
static jstring r2j(VALUE object)
{
if (NIL_P(object)){
return NULL;
}
else {
char *ps = STR2CSTR(object);
jstring js = JvNewStringLatin1(ps);
if (!js)
{
rb_raise(rb_eRuntimeError, "ruby str cannot be converted to java: %s",ps);
}
return js;
}
}
VALUE j2r(jstring js)
{
if (!js)
{
return Qnil;
}
else
{
jint len = JvGetStringUTFLength(js);
char buf[len + 1];
JvGetStringUTFRegion(js, 0, len, buf);
buf[len] = '\0';
return rb_str_new2(buf);
}
}
static void free_java_obj(void* arg1) {
jobject object =(jobject) arg1;
java::lang::Integer *ji =new java::lang::Integer(java::lang::System::identityHashCode(object));
jobject jo = objects->get(ji);
if (jo) {
// printf("removed object from hash\n");
objects->remove(ji);
}
}
static void raise_ruby_error(java::lang::Throwable *e) {
java::io::StringWriter *buffer = new java::io::StringWriter();
java::io::PrintWriter *writer = new java::io::PrintWriter(buffer);
e->printStackTrace(writer);
writer->close();
jstring message = buffer->toString();
jint len = JvGetStringUTFLength(message);
char buf[len + 1];
JvGetStringUTFRegion(message, 0, len, buf);
buf[len] = '\0';
rb_raise(rb_eRuntimeError, "error calling poi \n %s", buf);
}
%}
typedef long jint;
typedef long long jlong;
typedef char jbyte;
typedef float jfloat;
typedef float jdouble;
typedef int jshort;
typedef bool jboolean;
%typemap(in) SWIGTYPE * {
if (!rv2jo($input, (jobject *) &$1, $1_descriptor))
rb_raise(rb_eRuntimeError, "Unrecoverable error in SWIG typemapping");
}
%typemap(out) SWIGTYPE * {
$result = jo2rv($1, $1_descriptor);
}
%typemap(in) org::apache::poi::hssf::usermodel::HSSFWorkbook{
if (!rv2jo($input, (jobject *) &$1,
$descriptor(org::apache::poi::hssf::usermodel::HSSFWorkbook *)))
SWIG_fail;
}
%typemap(out) org::apache::poi::hssf::usermodel::HSSFWorkbook {
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFWorkbook *));
}
%typemap(in) jhsheet{
if (!rv2jo($input, (jobject *) &$1,
$descriptor(org::apache::poi::hssf::usermodel::HSSFSheet *)))
SWIG_fail;
}
%typemap(out) jhsheet {
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFSheet *));
}
%typemap(in) jhrow{
if (!rv2jo($input, (jobject *) &$1,
$descriptor(org::apache::poi::hssf::usermodel::HSSFRow *)))
SWIG_fail;
}
%typemap(out) jhrow {
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFRow *));
}
%typemap(in) jhcell{
if (!rv2jo($input, (jobject *) &$1,
$descriptor(org::apache::poi::hssf::usermodel::HSSFCell *)))
SWIG_fail;
}
%typemap(out) jhcell {
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFCell *));
}
%typemap(in) jhfont{
if (!rv2jo($input, (jobject *) &$1,
$descriptor(org::apache::poi::hssf::usermodel::HSSFFont *)))
rb_raise(rb_eRuntimeError, "Unrecoverable error in SWIG typemapping of HSSFFont");
}
%typemap(out) jhfont {
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFFont *));
}
%typemap(in) jhcellstyle{
if (!rv2jo($input, (jobject *) &$1,
$descriptor(org::apache::poi::hssf::usermodel::HSSFCellStyle *)))
rb_raise(rb_eRuntimeError, "Unrecoverable error in SWIG typemapping of HSSFCellStyle");
}
%typemap(out) jhcellstyle {
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFCellStyle *));
}
%typemap(in) jhdataformat{
if (!rv2jo($input, (jobject *) &$1,
$descriptor(org::apache::poi::hssf::usermodel::HSSFDataFormat *)))
rb_raise(rb_eRuntimeError, "Unrecoverable error in SWIG typemapping of HSSFDataFormat");
}
%typemap(out) jhdataformat {
$result = jo2rv($1, $descriptor(org::apache::poi::hssf::usermodel::HSSFDataFormat *));
}
%typemap(in) jstring {
$1 = r2j($input);
}
%typemap(out) jstring {
$result = j2r($1);
}
%typecheck(SWIG_TYPECHECK_STRING) jstring {
$1 = ( NIL_P($input) || TYPE($input)==T_STRING );
}
%typemap(in) joutputstream {
jlong ptr;
if (!rb_respond_to($input, rb_intern("putc"))) rb_raise(rb_eTypeError,"Expected IO");
*(VALUE *) &ptr = (VALUE) $input;
$1 = new org::apache::poi::RubyOutputStream(ptr);
}
%typemap(in) jcalendar {
$1 = java::util::Calendar::getInstance();
//$1->setTimeInMillis((long long) NUM2DBL(rb_funcall($input,rb_intern("to_i"),0,NULL))*1000.0);
$1->set(FIX2INT(rb_funcall($input,rb_intern("year"),0,NULL)),
FIX2INT(rb_funcall($input,rb_intern("mon"),0,NULL))-1,
FIX2INT(rb_funcall($input,rb_intern("day"),0,NULL)),
FIX2INT(rb_funcall($input,rb_intern("hour"),0,NULL)),
FIX2INT(rb_funcall($input,rb_intern("min"),0,NULL)),
FIX2INT(rb_funcall($input,rb_intern("sec"),0,NULL))
);
}
%typecheck(SWIG_TYPECHECK_POINTER) jcalendar {
$1 = rb_respond_to($input, rb_intern("asctime"));
}
%typemap(out) jdate {
jlong t = ((jdate) $1)->getTime();
//TODO: separate seconds and microsecs
int ts=t/1000;
$result=rb_time_new((time_t) ts, 0 );
}
%freefunc org::apache::poi::hssf::usermodel::HSSFWorkbook "free_java_obj";
%exception {
try {
$action
} catch (java::lang::Throwable *e) {
raise_ruby_error(e);
}
}
%exception org::apache::poi::hssf::usermodel::HSSFWorkbook::HSSFWorkbook {
try {
$action
store_reference(result);
} catch (java::lang::Throwable *e) {
raise_ruby_error(e);
}
}
namespace java {
namespace lang {
class Object {
jstring toString();
};
%nodefault;
class System : public Object {
public:
static jstring getProperty(jstring);
static jstring getProperty(jstring, jstring);
static void load(jstring);
static void loadLibrary(jstring);
static void mapLibraryName(jstring);
static void runFinalization();
static void setProperty(jstring, jstring);
};
%makedefault;
}
namespace io {
%nodefault;
class InputStream : public ::java::lang::Object {
};
class OutputStream : public ::java::lang::Object {
};
%makedefault;
}
namespace util {
class Date : public ::java::lang::Object {
public:
Date();
Date(jlong);
void setTime(jlong);
jstring toString();
};
}
}
namespace org {
namespace apache {
namespace poi {
namespace hssf {
namespace usermodel {
%nodefault;
class HSSFWorkbook : public ::java::lang::Object {
public:
HSSFWorkbook();
jstring getSheetName(jint);
jint getNumberOfSheets();
void setSheetOrder(jstring,jint);
void setSheetName(jint,jstring);
void setSheetName(jint,jstring,jshort);
jint getSheetIndex(jstring);
jhsheet createSheet();
jhsheet cloneSheet(jint);
jhsheet createSheet(jstring);
jhsheet getSheetAt(jint);
jhsheet getSheet(jstring);
void removeSheetAt(jint);
jhcellstyle createCellStyle();
jhfont createFont();
jhdataformat createDataFormat();
void write(joutputstream);
};
class HSSFSheet : public ::java::lang::Object {
public:
jhrow createRow(jint);
jhrow getRow(jint);
jhfooter getFooter();
jhheader getHeader();
};
class HSSFRow : public ::java::lang::Object {
public:
jhcell createCell(jshort);
jhcell getCell(jshort);
//jboolean getProtect(); //only in 2.5
};
class HSSFCell : public ::java::lang::Object {
public:
void setCellValue(jdouble);
void setCellValue(jstring);
void setCellValue(jboolean);
void setCellValue(jcalendar);
void setCellFormula(jstring);
jstring getStringCellValue();
jdouble getNumericCellValue();
jdate getDateCellValue();
jstring getCellFormula();
jboolean getBooleanCellValue();
jint getCellType();
jshort getEncoding();
void setAsActiveCell();
void setCellStyle(jhcellstyle);
void setEncoding(jshort encoding);
static const jint CELL_TYPE_BLANK;
static const jint CELL_TYPE_BOOLEAN;
static const jint CELL_TYPE_ERROR;
static const jint CELL_TYPE_FORMULA;
static const jint CELL_TYPE_NUMERIC;
static const jint CELL_TYPE_STRING;
static const jshort ENCODING_COMPRESSED_UNICODE;
static const jshort ENCODING_UTF_16;
};
class HSSFCellStyle : public ::java::lang::Object {
public:
static const jshort ALIGN_CENTER;
static const jshort ALIGN_CENTER_SELECTION;
static const jshort ALIGN_FILL;
static const jshort ALIGN_GENERAL;
static const jshort ALIGN_JUSTIFY;
static const jshort ALIGN_LEFT;
static const jshort ALIGN_RIGHT;
static const jshort ALT_BARS;
static const jshort BIG_SPOTS;
static const jshort BORDER_DASH_DOT;
static const jshort BORDER_DASH_DOT_DOT;
static const jshort BORDER_DASHED;
static const jshort BORDER_DOTTED;
static const jshort BORDER_DOUBLE;
static const jshort BORDER_HAIR;
static const jshort BORDER_MEDIUM;
static const jshort BORDER_MEDIUM_DASH_DOT;
static const jshort BORDER_MEDIUM_DASH_DOT_DOT;
static const jshort BORDER_MEDIUM_DASHED;
static const jshort BORDER_NONE;
static const jshort BORDER_SLANTED_DASH_DOT;
static const jshort BORDER_THICK;
static const jshort BORDER_THIN;
static const jshort BRICKS;
static const jshort DIAMONDS;
static const jshort FINE_DOTS;
static const jshort NO_FILL;
static const jshort SOLID_FOREGROUND;
static const jshort SPARSE_DOTS;
static const jshort SQUARES;
static const jshort THICK_BACKWARD_DIAG;
static const jshort THICK_FORWARD_DIAG;
static const jshort THICK_HORZ_BANDS;
static const jshort THICK_VERT_BANDS;
static const jshort THIN_BACKWARD_DIAG;
static const jshort THIN_FORWARD_DIAG;
static const jshort THIN_HORZ_BANDS;
static const jshort THIN_VERT_BANDS;
static const jshort VERTICAL_BOTTOM;
static const jshort VERTICAL_CENTER;
static const jshort VERTICAL_JUSTIFY;
static const jshort VERTICAL_TOP;
jshort getAlignment();
jshort getBorderBottom();
jshort getBorderLeft();
jshort getBorderRight();
jshort getBorderTop();
jshort getBottomBorderColor();
jshort getDataFormat();
jshort getFillBackgroundColor();
jshort getFillForegroundColor();
jshort getFillPattern();
jshort getFontIndex();
jboolean getHidden();
jshort getIndention();
jshort getIndex();
jshort getLeftBorderColor();
jboolean getLocked();
jshort getRightBorderColor();
jshort getRotation();
jshort getTopBorderColor();
jshort getVerticalAlignment();
jboolean getWrapText();
void setAlignment(jshort) ;
void setBorderBottom(jshort );
void setBorderLeft(jshort );
void setBorderRight(jshort );
void setBorderTop(jshort );
void setBottomBorderColor(jshort );
void setDataFormat(jshort );
void setFillBackgroundColor(jshort );
void setFillForegroundColor(jshort );
void setFillPattern(jshort );
void setFont(jhfont );
void setHidden(jboolean );
void setIndention(jshort );
void setLeftBorderColor(jshort );
void setLocked(jboolean );
void setRightBorderColor(jshort );
void setRotation(jshort );
void setTopBorderColor(jshort );
void setVerticalAlignment(jshort );
void setWrapText(jboolean );
};
class HSSFDataFormat : public ::java::lang::Object {
public:
static jstring getBuiltinFormat(jshort);
static jshort getBuiltinFormat(jstring);
jstring getFormat(jshort);
jshort getFormat(jstring);
static jint getNumberOfBuiltinBuiltinFormats();
//TODO static jlist getBuiltinFormats();
};
class HSSFFont : public ::java::lang::Object {
public:
static const jshort BOLDWEIGHT_BOLD;
static const jshort BOLDWEIGHT_NORMAL;
static const jshort COLOR_NORMAL;
static const jshort COLOR_RED;
static const jstring FONT_ARIAL;
static const jshort SS_NONE;
static const jshort SS_SUB;
static const jshort SS_SUPER;
static const jshort U_DOUBLE;
static const jshort U_DOUBLE_ACCOUNTING;
static const jshort U_NONE;
static const jshort U_SINGLE;
static const jshort U_SINGLE_ACCOUNTING;
jshort getBoldweight();
jshort getColor();
jshort getFontHeight();
jshort getFontHeightInPoints();
jstring getFontName();
jshort getIndex();
jboolean getItalic();
jboolean getStrikeout();
jshort getTypeOffset();
jshort getUnderline();
void setBoldweight(jshort );
void setColor(jshort );
void setFontHeight(jshort );
void setFontHeightInPoints(jshort );
void setFontName(jstring );
void setItalic(jboolean );
void setStrikeout(jboolean );
void setTypeOffset(jshort );
void setUnderline(jshort );
};
%makedefault;
}
}
}
}
}
%init %{
JvCreateJavaVM(NULL);
JvAttachCurrentThread(NULL, NULL);
nextThread = new java::lang::Thread();
objects = new java::util::HashMap();
java::util::HashMap *props = (java::util::HashMap *)
java::lang::System::getProperties();
props->put(JvNewStringUTF("inRuby"), objects);
JvInitClass(&org::apache::poi::hssf::usermodel::HSSFFont::class$);
JvInitClass(&org::apache::poi::hssf::usermodel::HSSFCell::class$);
JvInitClass(&org::apache::poi::hssf::usermodel::HSSFSheet::class$);
JvInitClass(&org::apache::poi::hssf::usermodel::HSSFCellStyle::class$);
%}

View File

@ -1,44 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
#include <gcj/cni.h>
#include "ruby.h"
#include "org/apache/poi/RubyOutputStream.h"
/**
* The native functions declared in org.apache.poi.RubyoutputStream
*
* @author aviks
*/
namespace org {
namespace apache {
namespace poi {
void RubyOutputStream::close(void)
{
rb_funcall3((VALUE ) rubyIO, rb_intern("close"), 0, NULL);
}
void RubyOutputStream::write(jint toWrite)
{
rb_funcall((VALUE ) rubyIO, rb_intern("putc"),1,INT2FIX(toWrite));
}
}
}
}

View File

@ -1,62 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi;
import java.io.OutputStream;
import java.io.IOException;
/**
* @author aviks
* Wrap a java.io.OutputStream around a Ruby IO object
*/
public class RubyOutputStream extends OutputStream {
//pointer to native ruby VALUE
protected long rubyIO;
public RubyOutputStream (long rubyIO)
{
this.rubyIO = rubyIO;
// incRef();
}
@Override
protected void finalize()
throws Throwable
{
// decRef();
}
// protected native void incRef();
// protected native void decRef();
@Override
public native void close()
throws IOException;
/* (non-Javadoc)
* @see java.io.OutputStream#write(int)
*/
@Override
public native void write(int arg0) throws IOException;
}

View File

@ -1,100 +0,0 @@
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ====================================================================
require 'test/unit'
require 'release/poi4r'
class TC_base_tests < Test::Unit::TestCase
def setup()
end
def test_get_constant
h=Poi4r::HSSFWorkbook.new
s=h.createSheet("Sheet1")
r=s.createRow(0)
c=r.createCell(0)
assert_equal(3,Poi4r::HSSFCell.CELL_TYPE_BLANK,"Constant CELL_TYPE_BLANK")
end
def test_base
system("rm test.xls")
h=Poi4r::HSSFWorkbook.new
#Test Sheet Creation
s=h.createSheet("Sheet1")
s=h.createSheet("Sheet2")
assert_equal(2,h.getNumberOfSheets(),"Number of sheets is 2")
#Test setting cell values
s=h.getSheetAt(0)
r=s.createRow(0)
c=r.createCell(0)
c.setCellValue(1.5)
assert_equal(c.getNumericCellValue(),1.5,"Numeric Cell Value")
c=r.createCell(1)
c.setCellValue("Ruby")
assert_equal(c.getStringCellValue(),"Ruby","String Cell Value")
#Test error handling
assert_raise (RuntimeError) {c.getNumericCellValue()}
#Test styles
st = h.createCellStyle()
c=r.createCell(2)
st.setAlignment(Poi4r::HSSFCellStyle.ALIGN_CENTER)
c.setCellStyle(st)
c.setCellValue("centr'd")
#Date handling
c=r.createCell(3)
t1=Time.now
c.setCellValue(Time.now)
t2= c.getDateCellValue().gmtime
assert_equal(t1.year,t2.year,"year")
assert_equal(t1.mon,t2.mon,"month")
assert_equal(t1.day,t2.day,"day")
assert_equal(t1.hour,t2.hour,"hour")
assert_equal(t1.min,t2.min,"min")
assert_equal(t1.sec,t2.sec,"sec")
st=h.createCellStyle();
st.setDataFormat(Poi4r::HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"))
c.setCellStyle(st)
#Fonts
c=r.createCell(4)
font = h.createFont();
font.setFontHeightInPoints(24);
font.setFontName("Courier New");
font.setItalic(true);
font.setStrikeout(true);
style = h.createCellStyle();
style.setFont(font);
c.setCellValue("This is a test of fonts");
c.setCellStyle(style);
#Formulas
c=r.createCell(5)
c.setCellFormula("A1*2")
assert_equal("A1*2",c.getCellFormula,"formula")
#Test writing
h.write(File.new("test.xls","w"))
assert_nothing_raised {File.new("test.xls","r")}
#h.write(0.1)
end
end

View File

@ -1,32 +0,0 @@
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ====================================================================
require 'test/unit'
require 'release/poi4r'
class TC_gc < Test::Unit::TestCase
def test_premature_collection
h=Poi4r::HSSFWorkbook.new
h.createSheet("Sheet1");
5000.times do
hh=Poi4r::HSSFWorkbook.new
GC.start()
end
assert_equal(1,h.getNumberOfSheets(),"Number of sheets")
end
end

View File

@ -1,20 +0,0 @@
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ====================================================================
require 'test/unit'
require 'tests/tc_base_tests'
require 'tests/tc_gc'

View File

@ -1,116 +0,0 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<%@page contentType="text/html"
import="java.io.*,org.apache.poi.poifs.filesystem.POIFSFileSystem,org.apache.poi
.hssf.record.*,org.apache.poi.hssf.model.*,org.apache.poi.hssf.usermodel.*,org.a
pache.poi.hssf.util.*" %>
<html>
<head><title>Read Excel file </title>
</head>
<body>
An example of using Jakarta POI's HSSF package to read an excel spreadsheet:
<form name="form1" method="get" action="">
Select an Excel file to read.
<input type="file" name="xls_filename" onChange="form1.submit()">
</form>
<%
String filename = request.getParameter("xls_filename");
if (filename != null && !filename.equals("")) {
%>
<br>You chose the file <%= filename %>.
<br><br>It's contents are:
<%
try
{
// create a poi workbook from the excel spreadsheet file
POIFSFileSystem fs =
new POIFSFileSystem(new FileInputStream(filename));
HSSFWorkbook wb = new HSSFWorkbook(fs);
for (int k = 0; k < wb.getNumberOfSheets(); k++)
{
%>
<br><br>Sheet <%= k %> <br>
<%
HSSFSheet sheet = wb.getSheetAt(k);
int rows = sheet.getPhysicalNumberOfRows();
for (int r = 0; r < rows; r++)
{
HSSFRow row = sheet.getRow(r);
if (row != null) {
int cells = row.getPhysicalNumberOfCells();
%>
<br><b>ROW <%=
row.getRowNum() %> </b>
<%
for (short c = 0; c < cells; c++)
{
HSSFCell cell = row.getCell(c);
if (cell != null) {
String value = null;
switch (cell.getCellType())
{
case HSSFCell.CELL_TYPE_FORMULA :
value = "FORMULA ";
break;
case HSSFCell.CELL_TYPE_NUMERIC :
value = "NUMERIC value="
+ cell.getNumericCellValue
();
break;
case HSSFCell.CELL_TYPE_STRING :
value = "STRING value="
+ cell.getStringCellValue();
break;
default :
}
%>
<%= "CELL col="
+ cell.getColumnIndex()
+ " VALUE=" + value %>
<%
}
}
}
}
}
}
catch (Exception e)
{
%>
Error occurred: <%= e.getMessage() %>
<%
e.printStackTrace();
}
}
%>
</body>
</html>

View File

@ -1 +0,0 @@
Dummy file so this directory is not deleted by CVS. It's required for the build.

View File

@ -1,502 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import org.apache.poi.hpsf.HPSFRuntimeException;
import org.apache.poi.hpsf.MarkUnsupportedException;
import org.apache.poi.hpsf.MutablePropertySet;
import org.apache.poi.hpsf.NoPropertySetStreamException;
import org.apache.poi.hpsf.PropertySet;
import org.apache.poi.hpsf.PropertySetFactory;
import org.apache.poi.hpsf.Util;
import org.apache.poi.hpsf.WritingNotSupportedException;
import org.apache.poi.poifs.eventfilesystem.POIFSReader;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;
import org.apache.poi.poifs.filesystem.DirectoryEntry;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.Entry;
import org.apache.poi.poifs.filesystem.POIFSDocumentPath;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.TempFile;
/**
* <p>This class copies a POI file system to a new file and compares the copy
* with the original.</p>
*
* <p>Property set streams are copied logically, i.e. the application
* establishes a {@link org.apache.poi.hpsf.PropertySet} of an original property
* set, creates a {@link org.apache.poi.hpsf.MutablePropertySet} from the
* {@link org.apache.poi.hpsf.PropertySet} and writes the
* {@link org.apache.poi.hpsf.MutablePropertySet} to the destination POI file
* system. - Streams which are no property set streams are copied bit by
* bit.</p>
*
* <p>The comparison of the POI file systems is done logically. That means that
* the two disk files containing the POI file systems do not need to be
* exactly identical. However, both POI file systems must contain the same
* files, and most of these files must be bitwise identical. Property set
* streams, however, are compared logically: they must have the same sections
* with the same attributs, and the sections must contain the same properties.
* Details like the ordering of the properties do not matter.</p>
*/
public class CopyCompare
{
/**
* <p>Runs the example program. The application expects one or two
* arguments:</p>
*
* <ol>
*
* <li><p>The first argument is the disk file name of the POI filesystem to
* copy.</p></li>
*
* <li><p>The second argument is optional. If it is given, it is the name of
* a disk file the copy of the POI filesystem will be written to. If it is
* not given, the copy will be written to a temporary file which will be
* deleted at the end of the program.</p></li>
*
* </ol>
*
* @param args Command-line arguments.
* @exception MarkUnsupportedException if a POI document stream does not
* support the mark() operation.
* @exception NoPropertySetStreamException if the application tries to
* create a property set from a POI document stream that is not a property
* set stream.
* @exception IOException if any I/O exception occurs.
* @exception UnsupportedEncodingException if a character encoding is not
* supported.
*/
public static void main(final String[] args)
throws NoPropertySetStreamException, MarkUnsupportedException,
UnsupportedEncodingException, IOException
{
String originalFileName = null;
String copyFileName = null;
/* Check the command-line arguments. */
if (args.length == 1) {
originalFileName = args[0];
File f = TempFile.createTempFile("CopyOfPOIFileSystem-", ".ole2");
f.deleteOnExit();
copyFileName = f.getAbsolutePath();
} else if (args.length == 2) {
originalFileName = args[0];
copyFileName = args[1];
} else {
System.err.println("Usage: " + CopyCompare.class.getName() +
"originPOIFS [copyPOIFS]");
System.exit(1);
}
/* Read the origin POIFS using the eventing API. The real work is done
* in the class CopyFile which is registered here as a POIFSReader. */
final POIFSReader r = new POIFSReader();
final CopyFile cf = new CopyFile(copyFileName);
r.registerListener(cf);
FileInputStream fis = new FileInputStream(originalFileName);
r.read(fis);
fis.close();
/* Write the new POIFS to disk. */
cf.close();
/* Read all documents from the original POI file system and compare them
* with the equivalent document from the copy. */
final POIFSFileSystem opfs = new POIFSFileSystem(new File(originalFileName));
final POIFSFileSystem cpfs = new POIFSFileSystem(new File(copyFileName));
final DirectoryEntry oRoot = opfs.getRoot();
final DirectoryEntry cRoot = cpfs.getRoot();
final StringBuffer messages = new StringBuffer();
if (equal(oRoot, cRoot, messages)) {
System.out.println("Equal");
} else {
System.out.println("Not equal: " + messages.toString());
}
cpfs.close();
opfs.close();
}
/**
* <p>Compares two {@link DirectoryEntry} instances of a POI file system.
* The directories must contain the same streams with the same names and
* contents.</p>
*
* @param d1 The first directory.
* @param d2 The second directory.
* @param msg The method may append human-readable comparison messages to
* this string buffer.
* @return <code>true</code> if the directories are equal, else
* <code>false</code>.
* @exception MarkUnsupportedException if a POI document stream does not
* support the mark() operation.
* @exception NoPropertySetStreamException if the application tries to
* create a property set from a POI document stream that is not a property
* set stream.
* @throws UnsupportedEncodingException
* @exception IOException if any I/O exception occurs.
*/
private static boolean equal(final DirectoryEntry d1,
final DirectoryEntry d2,
final StringBuffer msg)
throws NoPropertySetStreamException, MarkUnsupportedException,
UnsupportedEncodingException, IOException
{
boolean equal = true;
/* Iterate over d1 and compare each entry with its counterpart in d2. */
for (final Entry e1 : d1) {
final String n1 = e1.getName();
Entry e2 = null;
try {
e2 = d2.getEntry(n1);
} catch (FileNotFoundException ex) {
msg.append("Document \"" + e1 + "\" exists, document \"" +
e2 + "\" does not.\n");
equal = false;
break;
}
if (e1.isDirectoryEntry() && e2.isDirectoryEntry()) {
equal = equal((DirectoryEntry) e1, (DirectoryEntry) e2, msg);
} else if (e1.isDocumentEntry() && e2.isDocumentEntry()) {
equal = equal((DocumentEntry) e1, (DocumentEntry) e2, msg);
} else {
msg.append("One of \"" + e1 + "\" and \"" + e2 + "\" is a " +
"document while the other one is a directory.\n");
equal = false;
}
}
/* Iterate over d2 just to make sure that there are no entries in d2
* that are not in d1. */
for (final Entry e2 : d2) {
final String n2 = e2.getName();
Entry e1 = null;
try {
e1 = d1.getEntry(n2);
} catch (FileNotFoundException ex) {
msg.append("Document \"" + e2 + "\" exitsts, document \"" +
e1 + "\" does not.\n");
equal = false;
break;
}
}
return equal;
}
/**
* <p>Compares two {@link DocumentEntry} instances of a POI file system.
* Documents that are not property set streams must be bitwise identical.
* Property set streams must be logically equal.</p>
*
* @param d1 The first document.
* @param d2 The second document.
* @param msg The method may append human-readable comparison messages to
* this string buffer.
* @return <code>true</code> if the documents are equal, else
* <code>false</code>.
* @exception MarkUnsupportedException if a POI document stream does not
* support the mark() operation.
* @exception NoPropertySetStreamException if the application tries to
* create a property set from a POI document stream that is not a property
* set stream.
* @throws UnsupportedEncodingException
* @exception IOException if any I/O exception occurs.
*/
private static boolean equal(final DocumentEntry d1, final DocumentEntry d2,
final StringBuffer msg)
throws NoPropertySetStreamException, MarkUnsupportedException,
UnsupportedEncodingException, IOException
{
boolean equal = true;
final DocumentInputStream dis1 = new DocumentInputStream(d1);
final DocumentInputStream dis2 = new DocumentInputStream(d2);
try {
if (PropertySet.isPropertySetStream(dis1) &&
PropertySet.isPropertySetStream(dis2)) {
final PropertySet ps1 = PropertySetFactory.create(dis1);
final PropertySet ps2 = PropertySetFactory.create(dis2);
equal = ps1.equals(ps2);
if (!equal) {
msg.append("Property sets are not equal.\n");
return equal;
}
} else {
int i1;
int i2;
do {
i1 = dis1.read();
i2 = dis2.read();
if (i1 != i2) {
equal = false;
msg.append("Documents are not equal.\n");
break;
}
} while (equal && i1 == -1);
}
} finally {
dis2.close();
dis1.close();
}
return true;
}
/**
* <p>This class does all the work. Its method {@link
* #processPOIFSReaderEvent(POIFSReaderEvent)} is called for each file in
* the original POI file system. Except for property set streams it copies
* everything unmodified to the destination POI filesystem. Property set
* streams are copied by creating a new {@link PropertySet} from the
* original property set by using the {@link
* MutablePropertySet#MutablePropertySet(PropertySet)} constructor.</p>
*/
static class CopyFile implements POIFSReaderListener {
String dstName;
OutputStream out;
POIFSFileSystem poiFs;
/**
* <p>The constructor of a {@link CopyFile} instance creates the target
* POIFS. It also stores the name of the file the POIFS will be written
* to once it is complete.</p>
*
* @param dstName The name of the disk file the destination POIFS is to
* be written to.
*/
public CopyFile(final String dstName) {
this.dstName = dstName;
poiFs = new POIFSFileSystem();
}
/**
* <p>The method is called by POI's eventing API for each file in the
* origin POIFS.</p>
*/
public void processPOIFSReaderEvent(final POIFSReaderEvent event) {
/* The following declarations are shortcuts for accessing the
* "event" object. */
final POIFSDocumentPath path = event.getPath();
final String name = event.getName();
final DocumentInputStream stream = event.getStream();
Throwable t = null;
try {
/* Find out whether the current document is a property set
* stream or not. */
if (PropertySet.isPropertySetStream(stream)) {
/* Yes, the current document is a property set stream.
* Let's create a PropertySet instance from it. */
PropertySet ps = null;
try {
ps = PropertySetFactory.create(stream);
} catch (NoPropertySetStreamException ex) {
/* This exception will not be thrown because we already
* checked above. */
}
/* Copy the property set to the destination POI file
* system. */
copy(poiFs, path, name, ps);
} else {
/* No, the current document is not a property set stream. We
* copy it unmodified to the destination POIFS. */
copy(poiFs, event.getPath(), event.getName(), stream);
}
} catch (MarkUnsupportedException ex) {
t = ex;
} catch (IOException ex) {
t = ex;
} catch (WritingNotSupportedException ex) {
t = ex;
}
/* According to the definition of the processPOIFSReaderEvent method
* we cannot pass checked exceptions to the caller. The following
* lines check whether a checked exception occured and throws an
* unchecked exception. The message of that exception is that of
* the underlying checked exception. */
if (t != null) {
throw new HPSFRuntimeException
("Could not read file \"" + path + "/" + name +
"\". Reason: " + Util.toString(t));
}
}
/**
* <p>Writes a {@link PropertySet} to a POI filesystem.</p>
*
* @param poiFs The POI filesystem to write to.
* @param path The file's path in the POI filesystem.
* @param name The file's name in the POI filesystem.
* @param ps The property set to write.
* @throws WritingNotSupportedException
* @throws IOException
*/
public void copy(final POIFSFileSystem poiFs,
final POIFSDocumentPath path,
final String name,
final PropertySet ps)
throws WritingNotSupportedException, IOException {
final DirectoryEntry de = getPath(poiFs, path);
final MutablePropertySet mps = new MutablePropertySet(ps);
de.createDocument(name, mps.toInputStream());
}
/**
* <p>Copies the bytes from a {@link DocumentInputStream} to a new
* stream in a POI filesystem.</p>
*
* @param poiFs The POI filesystem to write to.
* @param path The source document's path.
* @param name The source document's name.
* @param stream The stream containing the source document.
* @throws IOException
*/
public void copy(final POIFSFileSystem poiFs,
final POIFSDocumentPath path,
final String name,
final DocumentInputStream stream)
throws IOException {
final DirectoryEntry de = getPath(poiFs, path);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
int c;
while ((c = stream.read()) != -1) {
out.write(c);
}
stream.close();
out.close();
final InputStream in =
new ByteArrayInputStream(out.toByteArray());
de.createDocument(name, in);
}
/**
* <p>Writes the POI file system to a disk file.</p>
*
* @throws FileNotFoundException
* @throws IOException
*/
public void close() throws FileNotFoundException, IOException {
out = new FileOutputStream(dstName);
poiFs.writeFilesystem(out);
out.close();
}
/** Contains the directory paths that have already been created in the
* output POI filesystem and maps them to their corresponding
* {@link org.apache.poi.poifs.filesystem.DirectoryNode}s. */
private final Map<String,DirectoryEntry> paths = new HashMap<String,DirectoryEntry>();
/**
* <p>Ensures that the directory hierarchy for a document in a POI
* fileystem is in place. When a document is to be created somewhere in
* a POI filesystem its directory must be created first. This method
* creates all directories between the POI filesystem root and the
* directory the document should belong to which do not yet exist.</p>
*
* <p>Unfortunately POI does not offer a simple method to interrogate
* the POIFS whether a certain child node (file or directory) exists in
* a directory. However, since we always start with an empty POIFS which
* contains the root directory only and since each directory in the
* POIFS is created by this method we can maintain the POIFS's directory
* hierarchy ourselves: The {@link DirectoryEntry} of each directory
* created is stored in a {@link Map}. The directories' path names map
* to the corresponding {@link DirectoryEntry} instances.</p>
*
* @param poiFs The POI filesystem the directory hierarchy is created
* in, if needed.
* @param path The document's path. This method creates those directory
* components of this hierarchy which do not yet exist.
* @return The directory entry of the document path's parent. The caller
* should use this {@link DirectoryEntry} to create documents in it.
*/
public DirectoryEntry getPath(final POIFSFileSystem poiFs,
final POIFSDocumentPath path) {
try {
/* Check whether this directory has already been created. */
final String s = path.toString();
DirectoryEntry de = paths.get(s);
if (de != null)
/* Yes: return the corresponding DirectoryEntry. */
return de;
/* No: We have to create the directory - or return the root's
* DirectoryEntry. */
int l = path.length();
if (l == 0) {
/* Get the root directory. It does not have to be created
* since it always exists in a POIFS. */
de = poiFs.getRoot();
} else {
/* Create a subordinate directory. The first step is to
* ensure that the parent directory exists: */
de = getPath(poiFs, path.getParent());
/* Now create the target directory: */
de = de.createDirectory(path.getComponent
(path.length() - 1));
}
paths.put(s, de);
return de;
} catch (IOException ex) {
/* This exception will be thrown if the directory already
* exists. However, since we have full control about directory
* creation we can ensure that this will never happen. */
ex.printStackTrace(System.err);
throw new RuntimeException(ex.toString());
/* FIXME (2): Replace the previous line by the following once we
* no longer need JDK 1.3 compatibility. */
// throw new RuntimeException(ex);
}
}
}
}

View File

@ -1,173 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Date;
import org.apache.poi.hpsf.CustomProperties;
import org.apache.poi.hpsf.DocumentSummaryInformation;
import org.apache.poi.hpsf.MarkUnsupportedException;
import org.apache.poi.hpsf.NoPropertySetStreamException;
import org.apache.poi.hpsf.PropertySetFactory;
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hpsf.UnexpectedPropertySetTypeException;
import org.apache.poi.hpsf.WritingNotSupportedException;
import org.apache.poi.poifs.filesystem.DirectoryEntry;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
/**
* <p>This is a sample application showing how to easily modify properties in
* the summary information and in the document summary information. The
* application reads the name of a POI filesystem from the command line and
* performs the following actions:</p>
*
* <ul>
*
* <li><p>Open the POI filesystem.</p></li>
*
* <li><p>Read the summary information.</p></li>
*
* <li><p>Read and print the "author" property.</p></li>
*
* <li><p>Change the author to "Rainer Klute".</p></li>
*
* <li><p>Read the document summary information.</p></li>
*
* <li><p>Read and print the "category" property.</p></li>
*
* <li><p>Change the category to "POI example".</p></li>
*
* <li><p>Read the custom properties (if available).</p></li>
*
* <li><p>Insert a new custom property.</p></li>
*
* <li><p>Write the custom properties back to the document summary
* information.</p></li>
*
* <li><p>Write the summary information to the POI filesystem.</p></li>
*
* <li><p>Write the document summary information to the POI filesystem.</p></li>
*
* <li><p>Write the POI filesystem back to the original file.</p></li>
*
* </ol>
*/
public class ModifyDocumentSummaryInformation {
/**
* <p>Main method - see class description.</p>
*
* @param args The command-line parameters.
* @throws IOException
* @throws MarkUnsupportedException
* @throws NoPropertySetStreamException
* @throws UnexpectedPropertySetTypeException
* @throws WritingNotSupportedException
*/
public static void main(final String[] args) throws IOException,
NoPropertySetStreamException, MarkUnsupportedException,
UnexpectedPropertySetTypeException, WritingNotSupportedException
{
/* Read the name of the POI filesystem to modify from the command line.
* For brevity to boundary check is performed on the command-line
* arguments. */
File summaryFile = new File(args[0]);
/* Open the POI filesystem. */
NPOIFSFileSystem poifs = new NPOIFSFileSystem(summaryFile, false);
/* Read the summary information. */
DirectoryEntry dir = poifs.getRoot();
SummaryInformation si;
try
{
si = (SummaryInformation)PropertySetFactory.create(
dir, SummaryInformation.DEFAULT_STREAM_NAME);
}
catch (FileNotFoundException ex)
{
// There is no summary information yet. We have to create a new one
si = PropertySetFactory.newSummaryInformation();
}
/* Change the author to "Rainer Klute". Any former author value will
* be lost. If there has been no author yet, it will be created. */
si.setAuthor("Rainer Klute");
System.out.println("Author changed to " + si.getAuthor() + ".");
/* Handling the document summary information is analogous to handling
* the summary information. An additional feature, however, are the
* custom properties. */
/* Read the document summary information. */
DocumentSummaryInformation dsi;
try
{
dsi = (DocumentSummaryInformation)PropertySetFactory.create(
dir, DocumentSummaryInformation.DEFAULT_STREAM_NAME);
}
catch (FileNotFoundException ex)
{
/* There is no document summary information yet. We have to create a
* new one. */
dsi = PropertySetFactory.newDocumentSummaryInformation();
}
/* Change the category to "POI example". Any former category value will
* be lost. If there has been no category yet, it will be created. */
dsi.setCategory("POI example");
System.out.println("Category changed to " + dsi.getCategory() + ".");
/* Read the custom properties. If there are no custom properties yet,
* the application has to create a new CustomProperties object. It will
* serve as a container for custom properties. */
CustomProperties customProperties = dsi.getCustomProperties();
if (customProperties == null)
customProperties = new CustomProperties();
/* Insert some custom properties into the container. */
customProperties.put("Key 1", "Value 1");
customProperties.put("Schl\u00fcssel 2", "Wert 2");
customProperties.put("Sample Number", new Integer(12345));
customProperties.put("Sample Boolean", Boolean.TRUE);
customProperties.put("Sample Date", new Date());
/* Read a custom property. */
Object value = customProperties.get("Sample Number");
System.out.println("Custom Sample Number is now " + value);
/* Write the custom properties back to the document summary
* information. */
dsi.setCustomProperties(customProperties);
/* Write the summary information and the document summary information
* to the POI filesystem. */
si.write(dir, SummaryInformation.DEFAULT_STREAM_NAME);
dsi.write(dir, DocumentSummaryInformation.DEFAULT_STREAM_NAME);
/* Write the POI filesystem back to the original file. Please note that
* in production code you should take care when write directly to the
* origin, to make sure you don't loose things on error */
poifs.writeFilesystem();
poifs.close();
}
}

View File

@ -1,134 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import org.apache.poi.hpsf.NoPropertySetStreamException;
import org.apache.poi.hpsf.Property;
import org.apache.poi.hpsf.PropertySet;
import org.apache.poi.hpsf.PropertySetFactory;
import org.apache.poi.hpsf.Section;
import org.apache.poi.poifs.eventfilesystem.POIFSReader;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;
import org.apache.poi.util.HexDump;
/**
* <p>Sample application showing how to read a document's custom property set.
* Call it with the document's file name as command-line parameter.</p>
*
* <p>Explanations can be found in the HPSF HOW-TO.</p>
*/
public class ReadCustomPropertySets
{
/**
* <p>Runs the example program.</p>
*
* @param args Command-line arguments (unused).
* @throws IOException if any I/O exception occurs.
*/
public static void main(final String[] args)
throws IOException
{
final String filename = args[0];
POIFSReader r = new POIFSReader();
/* Register a listener for *all* documents. */
r.registerListener(new MyPOIFSReaderListener());
r.read(new FileInputStream(filename));
}
static class MyPOIFSReaderListener implements POIFSReaderListener
{
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
PropertySet ps = null;
try
{
ps = PropertySetFactory.create(event.getStream());
}
catch (NoPropertySetStreamException ex)
{
out("No property set stream: \"" + event.getPath() +
event.getName() + "\"");
return;
}
catch (Exception ex)
{
throw new RuntimeException
("Property set stream \"" +
event.getPath() + event.getName() + "\": " + ex);
}
/* Print the name of the property set stream: */
out("Property set stream \"" + event.getPath() +
event.getName() + "\":");
/* Print the number of sections: */
final long sectionCount = ps.getSectionCount();
out(" No. of sections: " + sectionCount);
/* Print the list of sections: */
List<Section> sections = ps.getSections();
int nr = 0;
for (Iterator<Section> i = sections.iterator(); i.hasNext();)
{
/* Print a single section: */
Section sec = i.next();
out(" Section " + nr++ + ":");
String s = hex(sec.getFormatID().getBytes());
s = s.substring(0, s.length() - 1);
out(" Format ID: " + s);
/* Print the number of properties in this section. */
int propertyCount = sec.getPropertyCount();
out(" No. of properties: " + propertyCount);
/* Print the properties: */
Property[] properties = sec.getProperties();
for (int i2 = 0; i2 < properties.length; i2++)
{
/* Print a single property: */
Property p = properties[i2];
long id = p.getID();
long type = p.getType();
Object value = p.getValue();
out(" Property ID: " + id + ", type: " + type +
", value: " + value);
}
}
}
}
static void out(final String msg)
{
System.out.println(msg);
}
static String hex(final byte[] bytes)
{
return HexDump.dump(bytes, 0L, 0);
}
}

View File

@ -1,79 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.hpsf.PropertySetFactory;
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.poifs.eventfilesystem.POIFSReader;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;
/**
* <p>Sample application showing how to read a OLE 2 document's
* title. Call it with the document's file name as command line
* parameter.</p>
*
* <p>Explanations can be found in the HPSF HOW-TO.</p>
*/
public class ReadTitle
{
/**
* <p>Runs the example program.</p>
*
* @param args Command-line arguments. The first command-line argument must
* be the name of a POI filesystem to read.
* @throws IOException if any I/O exception occurs.
*/
public static void main(final String[] args) throws IOException
{
final String filename = args[0];
POIFSReader r = new POIFSReader();
r.registerListener(new MyPOIFSReaderListener(),
"\005SummaryInformation");
r.read(new FileInputStream(filename));
}
static class MyPOIFSReaderListener implements POIFSReaderListener
{
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
SummaryInformation si = null;
try
{
si = (SummaryInformation)
PropertySetFactory.create(event.getStream());
}
catch (Exception ex)
{
throw new RuntimeException
("Property set stream \"" +
event.getPath() + event.getName() + "\": " + ex);
}
final String title = si.getTitle();
if (title != null)
System.out.println("Title: \"" + title + "\"");
else
System.out.println("Document has no title.");
}
}
}

View File

@ -1,419 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import org.apache.poi.hpsf.HPSFRuntimeException;
import org.apache.poi.hpsf.MarkUnsupportedException;
import org.apache.poi.hpsf.MutablePropertySet;
import org.apache.poi.hpsf.MutableSection;
import org.apache.poi.hpsf.NoPropertySetStreamException;
import org.apache.poi.hpsf.PropertySet;
import org.apache.poi.hpsf.PropertySetFactory;
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hpsf.Util;
import org.apache.poi.hpsf.Variant;
import org.apache.poi.hpsf.WritingNotSupportedException;
import org.apache.poi.hpsf.wellknown.PropertyIDMap;
import org.apache.poi.poifs.eventfilesystem.POIFSReader;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;
import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;
import org.apache.poi.poifs.filesystem.DirectoryEntry;
import org.apache.poi.poifs.filesystem.DocumentInputStream;
import org.apache.poi.poifs.filesystem.POIFSDocumentPath;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
* <p>This class is a sample application which shows how to write or modify the
* author and title property of an OLE 2 document. This could be done in two
* different ways:</p>
*
* <ul>
*
* <li><p>The first approach is to open the OLE 2 file as a POI filesystem
* (see class {@link POIFSFileSystem}), read the summary information property
* set (see classes {@link SummaryInformation} and {@link PropertySet}), write
* the author and title properties into it and write the property set back into
* the POI filesystem.</p></li>
*
* <li><p>The second approach does not modify the original POI filesystem, but
* instead creates a new one. All documents from the original POIFS are copied
* to the destination POIFS, except for the summary information stream. The
* latter is modified by setting the author and title property before writing
* it to the destination POIFS. It there are several summary information streams
* in the original POIFS - e.g. in subordinate directories - they are modified
* just the same.</p></li>
*
* </ul>
*
* <p>This sample application takes the second approach. It expects the name of
* the existing POI filesystem's name as its first command-line parameter and
* the name of the output POIFS as the second command-line argument. The
* program then works as described above: It copies nearly all documents
* unmodified from the input POI filesystem to the output POI filesystem. If it
* encounters a summary information stream it reads its properties. Then it sets
* the "author" and "title" properties to new values and writes the modified
* summary information stream into the output file.</p>
*
* <p>Further explanations can be found in the HPSF HOW-TO.</p>
*/
public class WriteAuthorAndTitle
{
/**
* <p>Runs the example program.</p>
*
* @param args Command-line arguments. The first command-line argument must
* be the name of a POI filesystem to read.
* @throws IOException if any I/O exception occurs.
*/
public static void main(final String[] args) throws IOException
{
/* Check whether we have exactly two command-line arguments. */
if (args.length != 2)
{
System.err.println("Usage: " + WriteAuthorAndTitle.class.getName() +
" originPOIFS destinationPOIFS");
System.exit(1);
}
/* Read the names of the origin and destination POI filesystems. */
final String srcName = args[0];
final String dstName = args[1];
/* Read the origin POIFS using the eventing API. The real work is done
* in the class ModifySICopyTheRest which is registered here as a
* POIFSReader. */
final POIFSReader r = new POIFSReader();
final ModifySICopyTheRest msrl = new ModifySICopyTheRest(dstName);
r.registerListener(msrl);
FileInputStream fis = new FileInputStream(srcName);
r.read(fis);
fis.close();
/* Write the new POIFS to disk. */
msrl.close();
}
/**
* <p>This class does all the work. As its name implies it modifies a
* summary information property set and copies everything else unmodified
* to the destination POI filesystem. Since an instance of it is registered
* as a {@link POIFSReader} its method {@link
* #processPOIFSReaderEvent(POIFSReaderEvent)} is called for each document
* in the origin POIFS.</p>
*/
static class ModifySICopyTheRest implements POIFSReaderListener
{
String dstName;
OutputStream out;
POIFSFileSystem poiFs;
/**
* <p>The constructor of a {@link ModifySICopyTheRest} instance creates
* the target POIFS. It also stores the name of the file the POIFS will
* be written to once it is complete.</p>
*
* @param dstName The name of the disk file the destination POIFS is to
* be written to.
*/
public ModifySICopyTheRest(final String dstName)
{
this.dstName = dstName;
poiFs = new POIFSFileSystem();
}
/**
* <p>The method is called by POI's eventing API for each file in the
* origin POIFS.</p>
*/
public void processPOIFSReaderEvent(final POIFSReaderEvent event)
{
/* The following declarations are shortcuts for accessing the
* "event" object. */
final POIFSDocumentPath path = event.getPath();
final String name = event.getName();
final DocumentInputStream stream = event.getStream();
Throwable t = null;
try
{
/* Find out whether the current document is a property set
* stream or not. */
if (PropertySet.isPropertySetStream(stream))
{
/* Yes, the current document is a property set stream.
* Let's create a PropertySet instance from it. */
PropertySet ps = null;
try
{
ps = PropertySetFactory.create(stream);
}
catch (NoPropertySetStreamException ex)
{
/* This exception will not be thrown because we already
* checked above. */
}
/* Now we know that we really have a property set. The next
* step is to find out whether it is a summary information
* or not. */
if (ps.isSummaryInformation())
/* Yes, it is a summary information. We will modify it
* and write the result to the destination POIFS. */
editSI(poiFs, path, name, ps);
else
/* No, it is not a summary information. We don't care
* about its internals and copy it unmodified to the
* destination POIFS. */
copy(poiFs, path, name, ps);
}
else
/* No, the current document is not a property set stream. We
* copy it unmodified to the destination POIFS. */
copy(poiFs, event.getPath(), event.getName(), stream);
}
catch (MarkUnsupportedException ex)
{
t = ex;
}
catch (IOException ex)
{
t = ex;
}
catch (WritingNotSupportedException ex)
{
t = ex;
}
/* According to the definition of the processPOIFSReaderEvent method
* we cannot pass checked exceptions to the caller. The following
* lines check whether a checked exception occured and throws an
* unchecked exception. The message of that exception is that of
* the underlying checked exception. */
if (t != null)
{
throw new HPSFRuntimeException
("Could not read file \"" + path + "/" + name +
"\". Reason: " + Util.toString(t));
}
}
/**
* <p>Receives a summary information property set modifies (or creates)
* its "author" and "title" properties and writes the result under the
* same path and name as the origin to a destination POI filesystem.</p>
*
* @param poiFs The POI filesystem to write to.
* @param path The original (and destination) stream's path.
* @param name The original (and destination) stream's name.
* @param si The property set. It should be a summary information
* property set.
* @throws IOException
* @throws WritingNotSupportedException
*/
public void editSI(final POIFSFileSystem poiFs,
final POIFSDocumentPath path,
final String name,
final PropertySet si)
throws WritingNotSupportedException, IOException
{
/* Get the directory entry for the target stream. */
final DirectoryEntry de = getPath(poiFs, path);
/* Create a mutable property set as a copy of the original read-only
* property set. */
final MutablePropertySet mps = new MutablePropertySet(si);
/* Retrieve the section containing the properties to modify. A
* summary information property set contains exactly one section. */
final MutableSection s =
(MutableSection) mps.getSections().get(0);
/* Set the properties. */
s.setProperty(PropertyIDMap.PID_AUTHOR, Variant.VT_LPSTR,
"Rainer Klute");
s.setProperty(PropertyIDMap.PID_TITLE, Variant.VT_LPWSTR,
"Test");
/* Create an input stream containing the bytes the property set
* stream consists of. */
final InputStream pss = mps.toInputStream();
/* Write the property set stream to the POIFS. */
de.createDocument(name, pss);
}
/**
* <p>Writes a {@link PropertySet} to a POI filesystem. This method is
* simpler than {@link #editSI} because the origin property set has just
* to be copied.</p>
*
* @param poiFs The POI filesystem to write to.
* @param path The file's path in the POI filesystem.
* @param name The file's name in the POI filesystem.
* @param ps The property set to write.
* @throws WritingNotSupportedException
* @throws IOException
*/
public void copy(final POIFSFileSystem poiFs,
final POIFSDocumentPath path,
final String name,
final PropertySet ps)
throws WritingNotSupportedException, IOException
{
final DirectoryEntry de = getPath(poiFs, path);
final MutablePropertySet mps = new MutablePropertySet(ps);
de.createDocument(name, mps.toInputStream());
}
/**
* <p>Copies the bytes from a {@link DocumentInputStream} to a new
* stream in a POI filesystem.</p>
*
* @param poiFs The POI filesystem to write to.
* @param path The source document's path.
* @param name The source document's name.
* @param stream The stream containing the source document.
* @throws IOException
*/
public void copy(final POIFSFileSystem poiFs,
final POIFSDocumentPath path,
final String name,
final DocumentInputStream stream) throws IOException
{
final DirectoryEntry de = getPath(poiFs, path);
final ByteArrayOutputStream out = new ByteArrayOutputStream();
int c;
while ((c = stream.read()) != -1)
out.write(c);
stream.close();
out.close();
final InputStream in =
new ByteArrayInputStream(out.toByteArray());
de.createDocument(name, in);
}
/**
* <p>Writes the POI file system to a disk file.</p>
*
* @throws FileNotFoundException
* @throws IOException
*/
public void close() throws FileNotFoundException, IOException
{
out = new FileOutputStream(dstName);
poiFs.writeFilesystem(out);
out.close();
}
/** Contains the directory paths that have already been created in the
* output POI filesystem and maps them to their corresponding
* {@link org.apache.poi.poifs.filesystem.DirectoryNode}s. */
private final Map<String, DirectoryEntry> paths = new HashMap<String, DirectoryEntry>();
/**
* <p>Ensures that the directory hierarchy for a document in a POI
* fileystem is in place. When a document is to be created somewhere in
* a POI filesystem its directory must be created first. This method
* creates all directories between the POI filesystem root and the
* directory the document should belong to which do not yet exist.</p>
*
* <p>Unfortunately POI does not offer a simple method to interrogate
* the POIFS whether a certain child node (file or directory) exists in
* a directory. However, since we always start with an empty POIFS which
* contains the root directory only and since each directory in the
* POIFS is created by this method we can maintain the POIFS's directory
* hierarchy ourselves: The {@link DirectoryEntry} of each directory
* created is stored in a {@link Map}. The directories' path names map
* to the corresponding {@link DirectoryEntry} instances.</p>
*
* @param poiFs The POI filesystem the directory hierarchy is created
* in, if needed.
* @param path The document's path. This method creates those directory
* components of this hierarchy which do not yet exist.
* @return The directory entry of the document path's parent. The caller
* should use this {@link DirectoryEntry} to create documents in it.
*/
public DirectoryEntry getPath(final POIFSFileSystem poiFs,
final POIFSDocumentPath path)
{
try
{
/* Check whether this directory has already been created. */
final String s = path.toString();
DirectoryEntry de = paths.get(s);
if (de != null)
/* Yes: return the corresponding DirectoryEntry. */
return de;
/* No: We have to create the directory - or return the root's
* DirectoryEntry. */
int l = path.length();
if (l == 0)
/* Get the root directory. It does not have to be created
* since it always exists in a POIFS. */
de = poiFs.getRoot();
else
{
/* Create a subordinate directory. The first step is to
* ensure that the parent directory exists: */
de = getPath(poiFs, path.getParent());
/* Now create the target directory: */
de = de.createDirectory(path.getComponent
(path.length() - 1));
}
paths.put(s, de);
return de;
}
catch (IOException ex)
{
/* This exception will be thrown if the directory already
* exists. However, since we have full control about directory
* creation we can ensure that this will never happen. */
ex.printStackTrace(System.err);
throw new RuntimeException(ex);
}
}
}
}

View File

@ -1,103 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.poi.hpsf.MutableProperty;
import org.apache.poi.hpsf.MutablePropertySet;
import org.apache.poi.hpsf.MutableSection;
import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hpsf.Variant;
import org.apache.poi.hpsf.WritingNotSupportedException;
import org.apache.poi.hpsf.wellknown.PropertyIDMap;
import org.apache.poi.hpsf.wellknown.SectionIDMap;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
/**
* <p>This class is a simple sample application showing how to create a property
* set and write it to disk.</p>
*/
public class WriteTitle
{
/**
* <p>Runs the example program.</p>
*
* @param args Command-line arguments. The first and only command-line
* argument is the name of the POI file system to create.
* @throws IOException if any I/O exception occurs.
* @throws WritingNotSupportedException if HPSF does not (yet) support
* writing a certain property type.
*/
public static void main(final String[] args)
throws WritingNotSupportedException, IOException
{
/* Check whether we have exactly one command-line argument. */
if (args.length != 1)
{
System.err.println("Usage: " + WriteTitle.class.getName() +
"destinationPOIFS");
System.exit(1);
}
final String fileName = args[0];
/* Create a mutable property set. Initially it contains a single section
* with no properties. */
final MutablePropertySet mps = new MutablePropertySet();
/* Retrieve the section the property set already contains. */
final MutableSection ms = (MutableSection) mps.getSections().get(0);
/* Turn the property set into a summary information property. This is
* done by setting the format ID of its first section to
* SectionIDMap.SUMMARY_INFORMATION_ID. */
ms.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID);
/* Create an empty property. */
final MutableProperty p = new MutableProperty();
/* Fill the property with appropriate settings so that it specifies the
* document's title. */
p.setID(PropertyIDMap.PID_TITLE);
p.setType(Variant.VT_LPWSTR);
p.setValue("Sample title");
/* Place the property into the section. */
ms.setProperty(p);
/* Create the POI file system the property set is to be written to. */
final POIFSFileSystem poiFs = new POIFSFileSystem();
/* For writing the property set into a POI file system it has to be
* handed over to the POIFS.createDocument() method as an input stream
* which produces the bytes making out the property set stream. */
final InputStream is = mps.toInputStream();
/* Create the summary information property set in the POI file
* system. It is given the default name most (if not all) summary
* information property sets have. */
poiFs.createDocument(is, SummaryInformation.DEFAULT_STREAM_NAME);
/* Write the whole POI file system to a disk file. */
poiFs.writeFilesystem(new FileOutputStream(fileName));
}
}

View File

@ -1,456 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.sl.draw.DrawTableShape;
import org.apache.poi.sl.draw.SLGraphics;
import org.apache.poi.sl.usermodel.AutoShape;
import org.apache.poi.sl.usermodel.GroupShape;
import org.apache.poi.sl.usermodel.ShapeType;
import org.apache.poi.sl.usermodel.Slide;
import org.apache.poi.sl.usermodel.SlideShow;
import org.apache.poi.sl.usermodel.TableCell;
import org.apache.poi.sl.usermodel.TableShape;
import org.apache.poi.sl.usermodel.TextBox;
import org.apache.poi.sl.usermodel.TextParagraph;
import org.apache.poi.sl.usermodel.TextRun;
import org.apache.poi.sl.usermodel.TextShape.TextPlaceholder;
import org.apache.poi.sl.usermodel.VerticalAlignment;
/**
* Presentation for Fast Feather Track on ApacheconEU 2008
*
* @author Yegor Kozlov
*/
public final class ApacheconEU08 {
public static void main(String[] args) throws IOException {
SlideShow<?,?> ppt = new HSLFSlideShow();
// SlideShow<?,?> ppt = new XMLSlideShow();
ppt.setPageSize(new Dimension(720, 540));
slide1(ppt);
slide2(ppt);
slide3(ppt);
slide4(ppt);
slide5(ppt);
slide6(ppt);
slide7(ppt);
slide8(ppt);
slide9(ppt);
slide10(ppt);
slide11(ppt);
slide12(ppt);
String ext = ppt.getClass().getName().contains("HSLF") ? "ppt" : "pptx";
FileOutputStream out = new FileOutputStream("apachecon_eu_08."+ext);
ppt.write(out);
out.close();
ppt.close();
}
public static void slide1(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.CENTER_TITLE);
box1.setText("POI-HSLF");
box1.setAnchor(new Rectangle(54, 78, 612, 115));
TextBox<?,?> box2 = slide.createTextBox();
box2.setTextPlaceholder(TextPlaceholder.CENTER_BODY);
box2.setText("Java API To Access Microsoft PowerPoint Format Files");
box2.setAnchor(new Rectangle(108, 204, 504, 138));
TextBox<?,?> box3 = slide.createTextBox();
box3.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(32d);
box3.setText(
"Yegor Kozlov\r" +
"yegor - apache - org");
box3.setHorizontalCentered(true);
box3.setAnchor(new Rectangle(206, 348, 310, 84));
}
public static void slide2(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.TITLE);
box1.setText("What is HSLF?");
box1.setAnchor(new Rectangle(36, 21, 648, 90));
TextBox<?,?> box2 = slide.createTextBox();
box2.setTextPlaceholder(TextPlaceholder.BODY);
box2.setText("HorribleSLideshowFormat is the POI Project's pure Java implementation " +
"of the Powerpoint binary file format. \r" +
"POI sub-project since 2005\r" +
"Started by Nick Burch, Yegor Kozlov joined soon after");
box2.setAnchor(new Rectangle(36, 126, 648, 356));
}
public static void slide3(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.TITLE);
box1.setText("HSLF in a Nutshell");
box1.setAnchor(new Rectangle(36, 15, 648, 65));
TextBox<?,?> box2 = slide.createTextBox();
box2.setTextPlaceholder(TextPlaceholder.BODY);
box2.setText(
"HSLF provides a way to read, create and modify MS PowerPoint presentations\r" +
"Pure Java API - you don't need PowerPoint to read and write *.ppt files\r" +
"Comprehensive support of PowerPoint objects\r" +
"Rich text\r" +
"Tables\r" +
"Shapes\r" +
"Pictures\r" +
"Master slides\r" +
"Access to low level data structures"
);
List<? extends TextParagraph<?,?,?>> tp = box2.getTextParagraphs();
for (int i : new byte[]{0,1,2,8}) {
tp.get(i).getTextRuns().get(0).setFontSize(28d);
}
for (int i : new byte[]{3,4,5,6,7}) {
tp.get(i).getTextRuns().get(0).setFontSize(24d);
tp.get(i).setIndentLevel(1);
}
box2.setAnchor(new Rectangle(36, 80, 648, 400));
}
public static void slide4(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
String[][] txt1 = {
{"Note"},
{"This presentation was created programmatically using POI HSLF"}
};
TableShape<?,?> table1 = slide.createTable(2, 1);
for (int i = 0; i < txt1.length; i++) {
for (int j = 0; j < txt1[i].length; j++) {
TableCell<?,?> cell = table1.getCell(i, j);
cell.setText(txt1[i][j]);
TextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
rt.setFontSize(10d);
rt.setFontFamily("Arial");
rt.setBold(true);
if(i == 0){
rt.setFontSize(32d);
rt.setFontColor(Color.white);
cell.setFillColor(new Color(0, 153, 204));
} else {
rt.setFontSize(28d);
cell.setFillColor(new Color(235, 239, 241));
}
cell.setVerticalAlignment(VerticalAlignment.MIDDLE);
}
}
DrawTableShape dts = new DrawTableShape(table1);
dts.setAllBorders(1.0, Color.black);
dts.setOutsideBorders(4.0);
table1.setColumnWidth(0, 450);
table1.setRowHeight(0, 50);
table1.setRowHeight(1, 80);
Dimension dim = ppt.getPageSize();
Rectangle2D oldAnchor = table1.getAnchor();
table1.setAnchor(new Rectangle2D.Double((dim.width-450)/2d, 100, oldAnchor.getWidth(), oldAnchor.getHeight()));
TextBox<?,?> box1 = slide.createTextBox();
box1.setHorizontalCentered(true);
box1.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(24d);
box1.setText("The source code is available at\r" +
"http://people.apache.org/~yegor/apachecon_eu08/");
box1.setAnchor(new Rectangle(80, 356, 553, 65));
}
public static void slide5(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.TITLE);
box1.setText("HSLF in Action - 1\rData Extraction");
box1.setAnchor(new Rectangle(36, 21, 648, 100));
TextBox<?,?> box2 = slide.createTextBox();
box2.setTextPlaceholder(TextPlaceholder.BODY);
box2.setText(
"Text from slides and notes\r" +
"Images\r" +
"Shapes and their properties (type, position in the slide, color, font, etc.)");
box2.setAnchor(new Rectangle(36, 150, 648, 300));
}
public static void slide6(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.TITLE);
box1.setText("HSLF in Action - 2");
box1.setAnchor(new Rectangle(36, 20, 648, 90));
TextBox<?,?> box2 = slide.createTextBox();
box2.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(18d);
box2.setText("Creating a simple presentation from scratch");
box2.setAnchor(new Rectangle(170, 100, 364, 30));
TextBox<?,?> box3 = slide.createTextBox();
TextRun rt3 = box3.getTextParagraphs().get(0).getTextRuns().get(0);
rt3.setFontFamily("Courier New");
rt3.setFontSize(8d);
box3.setText(
"SlideShow ppt = new SlideShow();\u000b" +
"Slide slide = ppt.createSlide();\u000b" +
"\u000b" +
"TextBox box2 = new TextBox();\u000b" +
"box2.setHorizontalAlignment(TextBox.AlignCenter);\u000b" +
"box2.setVerticalAlignment(TextBox.AnchorMiddle);\u000b" +
"box2.getTextRun().setText(\"Java Code\");\u000b" +
"box2.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" +
"box2.setLineColor(Color.black);\u000b" +
"box2.setLineWidth(0.75);\u000b" +
"box2.setAnchor(new Rectangle(66, 243, 170, 170));\u000b" +
"slide.addShape(box2);\u000b" +
"\u000b" +
"TextBox box3 = new TextBox();\u000b" +
"box3.setHorizontalAlignment(TextBox.AlignCenter);\u000b" +
"box3.setVerticalAlignment(TextBox.AnchorMiddle);\u000b" +
"box3.getTextRun().setText(\"*.ppt file\");\u000b" +
"box3.setLineWidth(0.75);\u000b" +
"box3.setLineColor(Color.black);\u000b" +
"box3.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" +
"box3.setAnchor(new Rectangle(473, 243, 170, 170));\u000b" +
"slide.addShape(box3);\u000b" +
"\u000b" +
"AutoShape box4 = new AutoShape(ShapeTypes.Arrow);\u000b" +
"box4.getFill().setForegroundColor(new Color(187, 224, 227));\u000b" +
"box4.setLineWidth(0.75);\u000b" +
"box4.setLineColor(Color.black);\u000b" +
"box4.setAnchor(new Rectangle(253, 288, 198, 85));\u000b" +
"slide.addShape(box4);\u000b" +
"\u000b" +
"FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\u000b" +
"ppt.write(out);\u000b" +
"out.close();");
box3.setAnchor(new Rectangle(30, 150, 618, 411));
box3.setHorizontalCentered(true);
}
public static void slide7(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box2 = slide.createTextBox();
box2.setHorizontalCentered(true);
box2.setVerticalAlignment(VerticalAlignment.MIDDLE);
box2.setText("Java Code");
box2.setFillColor(new Color(187, 224, 227));
box2.setStrokeStyle(0.75, Color.black);
box2.setAnchor(new Rectangle(66, 243, 170, 170));
TextBox<?,?> box3 = slide.createTextBox();
box3.setHorizontalCentered(true);
box3.setVerticalAlignment(VerticalAlignment.MIDDLE);
box3.setText("*.ppt file");
box3.setFillColor(new Color(187, 224, 227));
box3.setStrokeStyle(0.75, Color.black);
box3.setAnchor(new Rectangle(473, 243, 170, 170));
AutoShape<?,?> box4 = slide.createAutoShape();
box4.setShapeType(ShapeType.RIGHT_ARROW);
box4.setFillColor(new Color(187, 224, 227));
box4.setStrokeStyle(0.75, Color.black);
box4.setAnchor(new Rectangle(253, 288, 198, 85));
}
public static void slide8(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.TITLE);
box1.setText("Wait, there is more!");
box1.setAnchor(new Rectangle(36, 21, 648, 90));
TextBox<?,?> box2 = slide.createTextBox();
box2.setTextPlaceholder(TextPlaceholder.BODY);
box2.setText(
"Rich text\r" +
"Tables\r" +
"Pictures (JPEG, PNG, BMP, WMF, PICT)\r" +
"Comprehensive formatting features");
box2.setAnchor(new Rectangle(36, 126, 648, 356));
}
public static void slide9(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.TITLE);
box1.setText("HSLF in Action - 3");
box1.setAnchor(new Rectangle(36, 20, 648, 50));
TextBox<?,?> box2 = slide.createTextBox();
box2.getTextParagraphs().get(0).getTextRuns().get(0).setFontSize(18d);
box2.setText("PPGraphics2D: PowerPoint Graphics2D driver");
box2.setAnchor(new Rectangle(178, 70, 387, 30));
TextBox<?,?> box3 = slide.createTextBox();
TextRun rt3 = box3.getTextParagraphs().get(0).getTextRuns().get(0);
rt3.setFontFamily("Courier New");
rt3.setFontSize(8d);
box3.setText(
"//bar chart data. The first value is the bar color, the second is the width\u000b" +
"Object[] def = new Object[]{\u000b" +
" Color.yellow, new Integer(100),\u000b" +
" Color.green, new Integer(150),\u000b" +
" Color.gray, new Integer(75),\u000b" +
" Color.red, new Integer(200),\u000b" +
"};\u000b" +
"\u000b" +
"SlideShow ppt = new SlideShow();\u000b" +
"Slide slide = ppt.createSlide();\u000b" +
"\u000b" +
"ShapeGroup group = new ShapeGroup();\u000b" +
"//define position of the drawing in the slide\u000b" +
"Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);\u000b" +
"group.setAnchor(bounds);\u000b" +
"slide.addShape(group);\u000b" +
"Graphics2D graphics = new PPGraphics2D(group);\u000b" +
"\u000b" +
"//draw a simple bar graph\u000b" +
"int x = bounds.x + 50, y = bounds.y + 50;\u000b" +
"graphics.setFont(new Font(\"Arial\", Font.BOLD, 10));\u000b" +
"for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {\u000b" +
" graphics.setColor(Color.black);\u000b" +
" int width = ((Integer)def[i+1]).intValue();\u000b" +
" graphics.drawString(\"Q\" + idx, x-20, y+20);\u000b" +
" graphics.drawString(width + \"%\", x + width + 10, y + 20);\u000b" +
" graphics.setColor((Color)def[i]);\u000b" +
" graphics.fill(new Rectangle(x, y, width, 30));\u000b" +
" y += 40;\u000b" +
"}\u000b" +
"graphics.setColor(Color.black);\u000b" +
"graphics.setFont(new Font(\"Arial\", Font.BOLD, 14));\u000b" +
"graphics.draw(bounds);\u000b" +
"graphics.drawString(\"Performance\", x + 70, y + 40);\u000b" +
"\u000b" +
"FileOutputStream out = new FileOutputStream(\"hslf-demo.ppt\");\u000b" +
"ppt.write(out);\u000b" +
"out.close();");
box3.setAnchor(new Rectangle(96, 110, 499, 378));
box3.setHorizontalCentered(true);
}
public static void slide10(SlideShow<?,?> ppt) throws IOException {
//bar chart data. The first value is the bar color, the second is the width
Object[] def = new Object[]{
Color.yellow, 100,
Color.green, 150,
Color.gray, 75,
Color.red, 200,
};
Slide<?,?> slide = ppt.createSlide();
GroupShape<?,?> group = slide.createGroup();
//define position of the drawing in the slide
Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
group.setAnchor(bounds);
Graphics2D graphics = new SLGraphics(group);
//draw a simple bar graph
int x = bounds.x + 50, y = bounds.y + 50;
graphics.setFont(new Font("Arial", Font.BOLD, 10));
for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {
graphics.setColor(Color.black);
int width = ((Integer)def[i+1]).intValue();
graphics.drawString("Q" + idx, x-20, y+20);
graphics.drawString(width + "%", x + width + 10, y + 20);
graphics.setColor((Color)def[i]);
graphics.fill(new Rectangle(x, y, width, 30));
y += 40;
}
graphics.setColor(Color.black);
graphics.setFont(new Font("Arial", Font.BOLD, 14));
graphics.draw(bounds);
graphics.drawString("Performance", x + 70, y + 40);
}
public static void slide11(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.TITLE);
box1.setText("HSLF Development Plans");
box1.setAnchor(new Rectangle(36, 21, 648, 90));
TextBox<?,?> box2 = slide.createTextBox();
box2.setTextPlaceholder(TextPlaceholder.BODY);
box2.setText(
"Support for more PowerPoint functionality\r" +
"Rendering slides into java.awt.Graphics2D\r" +
"A way to export slides into images or other formats\r" +
"Integration with Apache FOP - Formatting Objects Processor\r" +
"Transformation of XSL-FO into PPT\r" +
"PPT2PDF transcoder"
);
List<? extends TextParagraph<?,?,?>> tp = box2.getTextParagraphs();
for (int i : new byte[]{0,1,3}) {
tp.get(i).getTextRuns().get(0).setFontSize(28d);
}
for (int i : new byte[]{2,4,5}) {
tp.get(i).getTextRuns().get(0).setFontSize(24d);
tp.get(i).setIndentLevel(1);
}
box2.setAnchor(new Rectangle(36, 126, 648, 400));
}
public static void slide12(SlideShow<?,?> ppt) throws IOException {
Slide<?,?> slide = ppt.createSlide();
TextBox<?,?> box1 = slide.createTextBox();
box1.setTextPlaceholder(TextPlaceholder.CENTER_TITLE);
box1.setText("Questions?");
box1.setAnchor(new Rectangle(54, 167, 612, 115));
TextBox<?,?> box2 = slide.createTextBox();
box2.setTextPlaceholder(TextPlaceholder.CENTER_BODY);
box2.setText(
"http://poi.apache.org/hslf/\r" +
"http://people.apache.org/~yegor");
box2.setAnchor(new Rectangle(108, 306, 504, 138));
}
}

View File

@ -1,62 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.io.FileOutputStream;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTextBox;
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
/**
* How to create a single-level bulleted list
* and change some of the bullet attributes
*
* @author Yegor Kozlov
*/
public final class BulletsDemo {
public static void main(String[] args) throws Exception {
HSLFSlideShow ppt = new HSLFSlideShow();
HSLFSlide slide = ppt.createSlide();
HSLFTextBox shape = new HSLFTextBox();
HSLFTextParagraph rt = shape.getTextParagraphs().get(0);
rt.getTextRuns().get(0).setFontSize(42d);
rt.setBullet(true);
rt.setIndent(0d); //bullet offset
rt.setLeftMargin(50d); //text offset (should be greater than bullet offset)
rt.setBulletChar('\u263A'); //bullet character
shape.setText(
"January\r" +
"February\r" +
"March\r" +
"April");
slide.addShape(shape);
shape.setAnchor(new java.awt.Rectangle(50, 50, 500, 300)); //position of the text box in the slide
slide.addShape(shape);
FileOutputStream out = new FileOutputStream("bullets.ppt");
ppt.write(out);
out.close();
}
}

View File

@ -1,64 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hslf.usermodel.HSLFHyperlink;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTextBox;
/**
* Demonstrates how to create hyperlinks in PowerPoint presentations
*/
public abstract class CreateHyperlink {
public static void main(String[] args) throws IOException {
HSLFSlideShow ppt = new HSLFSlideShow();
HSLFSlide slideA = ppt.createSlide();
ppt.createSlide();
HSLFSlide slideC = ppt.createSlide();
// link to a URL
HSLFTextBox textBox1 = slideA.createTextBox();
textBox1.setText("Apache POI");
textBox1.setAnchor(new Rectangle(100, 100, 200, 50));
HSLFHyperlink link1 = textBox1.getTextParagraphs().get(0).getTextRuns().get(0).createHyperlink();
link1.linkToUrl("http://www.apache.org");
link1.setLabel(textBox1.getText());
// link to another slide
HSLFTextBox textBox2 = slideA.createTextBox();
textBox2.setText("Go to slide #3");
textBox2.setAnchor(new Rectangle(100, 300, 200, 50));
HSLFHyperlink link2 = textBox2.getTextParagraphs().get(0).getTextRuns().get(0).createHyperlink();
link2.linkToSlide(slideC);
FileOutputStream out = new FileOutputStream("hyperlink.ppt");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -1,127 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import org.apache.poi.hslf.model.OLEShape;
import org.apache.poi.hslf.usermodel.HSLFObjectData;
import org.apache.poi.hslf.usermodel.HSLFPictureData;
import org.apache.poi.hslf.usermodel.HSLFPictureShape;
import org.apache.poi.hslf.usermodel.HSLFShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFSoundData;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.Range;
/**
* Demonstrates how you can extract misc embedded data from a ppt file
*
* @author Yegor Kozlov
*/
public final class DataExtraction {
public static void main(String args[]) throws Exception {
if (args.length == 0) {
usage();
return;
}
FileInputStream is = new FileInputStream(args[0]);
HSLFSlideShow ppt = new HSLFSlideShow(is);
is.close();
//extract all sound files embedded in this presentation
HSLFSoundData[] sound = ppt.getSoundData();
for (int i = 0; i < sound.length; i++) {
String type = sound[i].getSoundType(); //*.wav
String name = sound[i].getSoundName(); //typically file name
byte[] data = sound[i].getData(); //raw bytes
//save the sound on disk
FileOutputStream out = new FileOutputStream(name + type);
out.write(data);
out.close();
}
int oleIdx=-1, picIdx=-1;
for (HSLFSlide slide : ppt.getSlides()) {
//extract embedded OLE documents
for (HSLFShape shape : slide.getShapes()) {
if (shape instanceof OLEShape) {
oleIdx++;
OLEShape ole = (OLEShape) shape;
HSLFObjectData data = ole.getObjectData();
String name = ole.getInstanceName();
if ("Worksheet".equals(name)) {
//read xls
@SuppressWarnings({ "unused", "resource" })
HSSFWorkbook wb = new HSSFWorkbook(data.getData());
} else if ("Document".equals(name)) {
HWPFDocument doc = new HWPFDocument(data.getData());
//read the word document
Range r = doc.getRange();
for(int k = 0; k < r.numParagraphs(); k++) {
Paragraph p = r.getParagraph(k);
System.out.println(p.text());
}
//save on disk
FileOutputStream out = new FileOutputStream(name + "-("+(oleIdx)+").doc");
doc.write(out);
out.close();
} else {
FileOutputStream out = new FileOutputStream(ole.getProgID() + "-"+(oleIdx+1)+".dat");
InputStream dis = data.getData();
byte[] chunk = new byte[2048];
int count;
while ((count = dis.read(chunk)) >= 0) {
out.write(chunk,0,count);
}
is.close();
out.close();
}
}
//Pictures
else if (shape instanceof HSLFPictureShape) {
picIdx++;
HSLFPictureShape p = (HSLFPictureShape) shape;
HSLFPictureData data = p.getPictureData();
String ext = data.getType().extension;
FileOutputStream out = new FileOutputStream("pict-" + picIdx + ext);
out.write(data.getData());
out.close();
}
}
}
}
private static void usage(){
System.out.println("Usage: DataExtraction ppt");
}
}

View File

@ -1,85 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import org.apache.poi.hslf.model.PPGraphics2D;
import org.apache.poi.hslf.usermodel.HSLFGroupShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Demonstrates how to draw into a slide using the HSLF Graphics2D driver.
*
* @author Yegor Kozlov
*/
public final class Graphics2DDemo {
/**
* A simple bar chart demo
*/
public static void main(String[] args) throws Exception {
HSLFSlideShow ppt = new HSLFSlideShow();
//bar chart data. The first value is the bar color, the second is the width
Object[] def = new Object[]{
Color.yellow, 40,
Color.green, 60,
Color.gray, 30,
Color.red, 80,
};
HSLFSlide slide = ppt.createSlide();
HSLFGroupShape group = new HSLFGroupShape();
//define position of the drawing in the slide
Rectangle bounds = new java.awt.Rectangle(200, 100, 350, 300);
group.setAnchor(bounds);
group.setInteriorAnchor(new java.awt.Rectangle(0, 0, 100, 100));
slide.addShape(group);
Graphics2D graphics = new PPGraphics2D(group);
//draw a simple bar graph
int x = 10, y = 10;
graphics.setFont(new Font("Arial", Font.BOLD, 10));
for (int i = 0, idx = 1; i < def.length; i+=2, idx++) {
graphics.setColor(Color.black);
int width = ((Integer)def[i+1]).intValue();
graphics.drawString("Q" + idx, x-5, y+10);
graphics.drawString(width + "%", x + width+3, y + 10);
graphics.setColor((Color)def[i]);
graphics.fill(new Rectangle(x, y, width, 10));
y += 15;
}
graphics.setColor(Color.black);
graphics.setFont(new Font("Arial", Font.BOLD, 14));
graphics.draw(group.getInteriorAnchor());
graphics.drawString("Performance", x + 30, y + 10);
FileOutputStream out = new FileOutputStream("hslf-graphics.ppt");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -1,49 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hslf.model.HeadersFooters;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Demonstrates how to set headers / footers
*/
public abstract class HeadersFootersDemo {
public static void main(String[] args) throws IOException {
HSLFSlideShow ppt = new HSLFSlideShow();
HeadersFooters slideHeaders = ppt.getSlideHeadersFooters();
slideHeaders.setFootersText("Created by POI-HSLF");
slideHeaders.setSlideNumberVisible(true);
slideHeaders.setDateTimeText("custom date time");
HeadersFooters notesHeaders = ppt.getNotesHeadersFooters();
notesHeaders.setFootersText("My notes footers");
notesHeaders.setHeaderText("My notes header");
ppt.createSlide();
FileOutputStream out = new FileOutputStream("headers_footers.ppt");
ppt.write(out);
out.close();
}
}

View File

@ -1,83 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.io.FileInputStream;
import java.util.List;
import java.util.Locale;
import org.apache.poi.hslf.usermodel.HSLFHyperlink;
import org.apache.poi.hslf.usermodel.HSLFShape;
import org.apache.poi.hslf.usermodel.HSLFSimpleShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTextParagraph;
import org.apache.poi.hslf.usermodel.HSLFTextRun;
/**
* Demonstrates how to read hyperlinks from a presentation
*
* @author Yegor Kozlov
*/
public final class Hyperlinks {
public static void main(String[] args) throws Exception {
for (int i = 0; i < args.length; i++) {
FileInputStream is = new FileInputStream(args[i]);
HSLFSlideShow ppt = new HSLFSlideShow(is);
is.close();
for (HSLFSlide slide : ppt.getSlides()) {
System.out.println("\nslide " + slide.getSlideNumber());
// read hyperlinks from the slide's text runs
System.out.println("- reading hyperlinks from the text runs");
for (List<HSLFTextParagraph> paras : slide.getTextParagraphs()) {
for (HSLFTextParagraph para : paras) {
for (HSLFTextRun run : para) {
HSLFHyperlink link = run.getHyperlink();
if (link != null) {
System.out.println(toStr(link, run.getRawText()));
}
}
}
}
// in PowerPoint you can assign a hyperlink to a shape without text,
// for example to a Line object. The code below demonstrates how to
// read such hyperlinks
System.out.println("- reading hyperlinks from the slide's shapes");
for (HSLFShape sh : slide.getShapes()) {
if (sh instanceof HSLFSimpleShape) {
HSLFHyperlink link = ((HSLFSimpleShape)sh).getHyperlink();
if (link != null) {
System.out.println(toStr(link, null));
}
}
}
}
ppt.close();
}
}
static String toStr(HSLFHyperlink link, String rawText) {
//in ppt end index is inclusive
String formatStr = "title: %1$s, address: %2$s" + (rawText == null ? "" : ", start: %3$s, end: %4$s, substring: %5$s");
return String.format(Locale.ROOT, formatStr, link.getLabel(), link.getAddress(), link.getStartIndex(), link.getEndIndex(), rawText);
}
}

View File

@ -1,106 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import javax.imageio.ImageIO;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
/**
* Demonstrates how you can use HSLF to convert each slide into a PNG image
*
* @author Yegor Kozlov
*/
public final class PPT2PNG {
public static void main(String args[]) throws Exception {
if (args.length == 0) {
usage();
return;
}
int slidenum = -1;
float scale = 1;
String file = null;
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("-")) {
if ("-scale".equals(args[i])){
scale = Float.parseFloat(args[++i]);
} else if ("-slide".equals(args[i])) {
slidenum = Integer.parseInt(args[++i]);
}
} else {
file = args[i];
}
}
if(file == null){
usage();
return;
}
FileInputStream is = new FileInputStream(file);
HSLFSlideShow ppt = new HSLFSlideShow(is);
is.close();
Dimension pgsize = ppt.getPageSize();
int width = (int)(pgsize.width*scale);
int height = (int)(pgsize.height*scale);
for (HSLFSlide slide : ppt.getSlides()) {
if (slidenum != -1 && slidenum != slide.getSlideNumber()) continue;
String title = slide.getTitle();
System.out.println("Rendering slide "+slide.getSlideNumber() + (title == null ? "" : ": " + title));
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = img.createGraphics();
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
graphics.setPaint(Color.white);
graphics.fill(new Rectangle2D.Float(0, 0, width, height));
graphics.scale((double)width/pgsize.width, (double)height/pgsize.height);
slide.draw(graphics);
String fname = file.replaceAll("\\.ppt", "-" + slide.getSlideNumber() + ".png");
FileOutputStream out = new FileOutputStream(fname);
ImageIO.write(img, "png", out);
out.close();
}
}
private static void usage(){
System.out.println("Usage: PPT2PNG [-scale <scale> -slide <num>] ppt");
}
}

View File

@ -1,66 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.hslf.record.InteractiveInfoAtom;
import org.apache.poi.hslf.record.RecordTypes;
import org.apache.poi.hslf.usermodel.HSLFShape;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFSoundData;
/**
* For each slide iterate over shapes and found associated sound data.
*/
public class SoundFinder {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream(args[0]);
HSLFSlideShow ppt = new HSLFSlideShow(fis);
HSLFSoundData[] sounds = ppt.getSoundData();
for (HSLFSlide slide : ppt.getSlides()) {
for (HSLFShape shape : slide.getShapes()) {
int soundRef = getSoundReference(shape);
if(soundRef == -1) continue;
System.out.println("Slide["+slide.getSlideNumber()+"], shape["+shape.getShapeId()+"], soundRef: "+soundRef);
System.out.println(" " + sounds[soundRef].getSoundName());
System.out.println(" " + sounds[soundRef].getSoundType());
}
}
ppt.close();
fis.close();
}
/**
* Check if a given shape is associated with a sound.
* @return 0-based reference to a sound in the sound collection
* or -1 if the shape is not associated with a sound
*/
protected static int getSoundReference(HSLFShape shape){
int soundRef = -1;
//dive into the shape container and search for InteractiveInfoAtom
InteractiveInfoAtom info = shape.getClientDataRecord(RecordTypes.InteractiveInfo.typeID);
if (info != null && info.getAction() == InteractiveInfoAtom.ACTION_MEDIA) {
soundRef = info.getSoundRef();
}
return soundRef;
}
}

View File

@ -1,130 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
import java.awt.Color;
import java.io.FileOutputStream;
import org.apache.poi.hslf.usermodel.HSLFSlide;
import org.apache.poi.hslf.usermodel.HSLFSlideShow;
import org.apache.poi.hslf.usermodel.HSLFTable;
import org.apache.poi.hslf.usermodel.HSLFTableCell;
import org.apache.poi.hslf.usermodel.HSLFTextRun;
import org.apache.poi.sl.draw.DrawTableShape;
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
import org.apache.poi.sl.usermodel.VerticalAlignment;
/**
* Demonstrates how to create tables
*
* @author Yegor Kozlov
*/
public final class TableDemo {
public static void main(String[] args) throws Exception {
//test data for the first taable
String[][] txt1 = {
{"INPUT FILE", "NUMBER OF RECORDS"},
{"Item File", "11,559"},
{"Vendor File", "502"},
{"Purchase History File - # of PO\u2019s\r(12/01/04 - 05/31/06)", "12,852"},
{"Purchase History File - # of PO Lines\r(12/01/04 - 05/31/06)", "53,523" },
{"Total PO History Spend", "$10,172,038"}
};
HSLFSlideShow ppt = new HSLFSlideShow();
HSLFSlide slide = ppt.createSlide();
//six rows, two columns
HSLFTable table1 = slide.createTable(6, 2);
for (int i = 0; i < txt1.length; i++) {
for (int j = 0; j < txt1[i].length; j++) {
HSLFTableCell cell = table1.getCell(i, j);
HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
rt.setFontFamily("Arial");
rt.setFontSize(10d);
if(i == 0){
cell.getFill().setForegroundColor(new Color(227, 227, 227));
} else {
rt.setBold(true);
}
cell.setVerticalAlignment(VerticalAlignment.MIDDLE);
cell.setHorizontalCentered(true);
cell.setText(txt1[i][j]);
}
}
DrawTableShape dts1 = new DrawTableShape(table1);
dts1.setAllBorders(1.0, Color.black);
table1.setColumnWidth(0, 300);
table1.setColumnWidth(1, 150);
int pgWidth = ppt.getPageSize().width;
table1.moveTo((pgWidth - table1.getAnchor().getWidth())/2., 100.);
//test data for the second taable
String[][] txt2 = {
{"Data Source"},
{"CAS Internal Metrics - Item Master Summary\r" +
"CAS Internal Metrics - Vendor Summary\r" +
"CAS Internal Metrics - PO History Summary"}
};
//two rows, one column
HSLFTable table2 = slide.createTable(2, 1);
for (int i = 0; i < txt2.length; i++) {
for (int j = 0; j < txt2[i].length; j++) {
HSLFTableCell cell = table2.getCell(i, j);
HSLFTextRun rt = cell.getTextParagraphs().get(0).getTextRuns().get(0);
rt.setFontSize(10d);
rt.setFontFamily("Arial");
if(i == 0){
cell.getFill().setForegroundColor(new Color(0, 51, 102));
rt.setFontColor(Color.white);
rt.setBold(true);
rt.setFontSize(14d);
cell.setHorizontalCentered(true);
} else {
rt.getTextParagraph().setBullet(true);
rt.setFontSize(12d);
rt.getTextParagraph().setTextAlign(TextAlign.LEFT);
cell.setHorizontalCentered(false);
}
cell.setVerticalAlignment(VerticalAlignment.MIDDLE);
cell.setText(txt2[i][j]);
}
}
table2.setColumnWidth(0, 300);
table2.setRowHeight(0, 30);
table2.setRowHeight(1, 70);
DrawTableShape dts2 = new DrawTableShape(table2);
dts2.setOutsideBorders(Color.black, 1.0);
table2.moveTo(200, 400);
FileOutputStream out = new FileOutputStream("hslf-table.ppt");
ppt.write(out);
out.close();
ppt.close();
}
}

View File

@ -1,171 +0,0 @@
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hsmf.examples;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import org.apache.poi.hsmf.MAPIMessage;
import org.apache.poi.hsmf.datatypes.AttachmentChunks;
import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
/**
* Reads one or several Outlook MSG files and for each of them creates
* a text file from available chunks and a directory that contains
* attachments.
*
* @author Bruno Girin
*/
public class Msg2txt {
/**
* The stem used to create file names for the text file and the directory
* that contains the attachments.
*/
private String fileNameStem;
/**
* The Outlook MSG file being processed.
*/
private MAPIMessage msg;
public Msg2txt(String fileName) throws IOException {
fileNameStem = fileName;
if(fileNameStem.endsWith(".msg") || fileNameStem.endsWith(".MSG")) {
fileNameStem = fileNameStem.substring(0, fileNameStem.length() - 4);
}
msg = new MAPIMessage(fileName);
}
/**
* Processes the message.
*
* @throws IOException if an exception occurs while writing the message out
*/
public void processMessage() throws IOException {
String txtFileName = fileNameStem + ".txt";
String attDirName = fileNameStem + "-att";
PrintWriter txtOut = null;
try {
txtOut = new PrintWriter(txtFileName);
try {
String displayFrom = msg.getDisplayFrom();
txtOut.println("From: "+displayFrom);
} catch (ChunkNotFoundException e) {
// ignore
}
try {
String displayTo = msg.getDisplayTo();
txtOut.println("To: "+displayTo);
} catch (ChunkNotFoundException e) {
// ignore
}
try {
String displayCC = msg.getDisplayCC();
txtOut.println("CC: "+displayCC);
} catch (ChunkNotFoundException e) {
// ignore
}
try {
String displayBCC = msg.getDisplayBCC();
txtOut.println("BCC: "+displayBCC);
} catch (ChunkNotFoundException e) {
// ignore
}
try {
String subject = msg.getSubject();
txtOut.println("Subject: "+subject);
} catch (ChunkNotFoundException e) {
// ignore
}
try {
String body = msg.getTextBody();
txtOut.println(body);
} catch (ChunkNotFoundException e) {
System.err.println("No message body");
}
AttachmentChunks[] attachments = msg.getAttachmentFiles();
if(attachments.length > 0) {
File d = new File(attDirName);
if(d.mkdir()) {
for(AttachmentChunks attachment : attachments) {
processAttachment(attachment, d);
}
} else {
System.err.println("Can't create directory "+attDirName);
}
}
} finally {
if(txtOut != null) {
txtOut.close();
}
}
}
/**
* Processes a single attachment: reads it from the Outlook MSG file and
* writes it to disk as an individual file.
*
* @param attachment the chunk group describing the attachment
* @param dir the directory in which to write the attachment file
* @throws IOException when any of the file operations fails
*/
public void processAttachment(AttachmentChunks attachment,
File dir) throws IOException {
String fileName = attachment.attachFileName.toString();
if(attachment.attachLongFileName != null) {
fileName = attachment.attachLongFileName.toString();
}
File f = new File(dir, fileName);
OutputStream fileOut = null;
try {
fileOut = new FileOutputStream(f);
fileOut.write(attachment.attachData.getValue());
} finally {
if(fileOut != null) {
fileOut.close();
}
}
}
/**
* Processes the list of arguments as a list of names of Outlook MSG files.
*
* @param args the list of MSG files to process
*/
public static void main(String[] args) {
if(args.length <= 0) {
System.err.println("No files names provided");
} else {
for(int i = 0; i < args.length; i++) {
try {
Msg2txt processor = new Msg2txt(args[i]);
processor.processMessage();
} catch (IOException e) {
System.err.println("Could not process "+args[i]+": "+e);
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More