#64411 - Provide JigSaw modules

- use classpath-build for Java 8, otherwise use modulepath
- save module-info classes to source, when using Java 9+ environment
- rename example packages - otherwise package clashes occured in the tests
- move agile encryption from ooxml to main.
  remove EncryptionInfo XmlBeans and schema and use custom xml marshalling
- move ooxml test classes which reside in the same package as their tested main class
- rename base test classes to "BaseTest..." - temporarily I've used a light version of the main test classes to test scratchpad / ooxml
- build.xml - fixed the Rhino javascript errors of the dependency-macros
- DrawTextParagraph - fixed StringIndexOutOfBounds when logging set to debug level
- use JigSaw provider interface (= Java ServiceLoader), i.e. it wasn't possible (without openening everything), to access ooxml factory classes from main factory stub

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1880164 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2020-07-22 22:08:33 +00:00
parent 800da8b290
commit c0f9941604
312 changed files with 3562 additions and 1985 deletions

1310
build.xml

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.crypt.examples;
package org.apache.poi.examples.crypt;
import java.io.File;
import java.nio.file.Files;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
package org.apache.poi.examples.hpsf;
import java.io.File;
import java.io.FileOutputStream;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
package org.apache.poi.examples.hpsf;
import java.io.File;
import java.io.FileNotFoundException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
package org.apache.poi.examples.hpsf;
import java.io.File;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
package org.apache.poi.examples.hpsf;
import java.io.File;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
package org.apache.poi.examples.hpsf;
import java.io.File;
import java.io.FileOutputStream;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hpsf.examples;
package org.apache.poi.examples.hpsf;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.awt.Color;
import java.awt.Dimension;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.awt.Rectangle;
import java.io.FileOutputStream;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.io.FileInputStream;
import java.io.FileOutputStream;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.awt.Color;
import java.awt.Font;

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.io.FileInputStream;
import java.util.List;

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.io.FileInputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hslf.examples;
package org.apache.poi.examples.hslf;
import java.awt.Color;
import java.io.FileOutputStream;
@ -64,7 +64,7 @@ public final class TableDemo {
}
}
}
static void create1stTable(HSLFSlide slide) {
//six rows, two columns
HSLFTable table1 = slide.createTable(6, 2);

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hsmf.examples;
package org.apache.poi.examples.hsmf;
import java.io.File;
import java.io.FileOutputStream;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.eventusermodel.examples;
package org.apache.poi.examples.hssf.eventusermodel;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

View File

@ -16,8 +16,8 @@
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
/* Placeholder - this is now handled in the Common SS example **/
public class AddDimensionedImage extends org.apache.poi.ss.examples.AddDimensionedImage {
public class AddDimensionedImage extends org.apache.poi.examples.ss.AddDimensionedImage {
}

View File

@ -15,9 +15,9 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,10 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFComment;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
@ -31,9 +34,6 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Demonstrates how to work with excel cell comments.<p>
*

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,16 +15,16 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFCell;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
/**
* Illustrates how to create cell values.
*

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.Closeable;
import java.io.FileInputStream;

View File

@ -16,7 +16,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileInputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileInputStream;
import java.io.FileOutputStream;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -16,7 +16,7 @@
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.File;
import java.io.FileOutputStream;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,9 +15,9 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;

View File

@ -15,14 +15,24 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import org.apache.poi.hssf.usermodel.*;
import java.awt.*;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.RenderingHints;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.EscherGraphics;
import org.apache.poi.hssf.usermodel.EscherGraphics2d;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFShapeGroup;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
/**
* Demonstrates the use of the EscherGraphics2d library.
*

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.Closeable;
import java.io.FileOutputStream;
@ -54,7 +54,7 @@ public class Outlines implements Closeable {
wb.write(fileOut);
}
}
@Override
public void close() throws IOException {
wb.close();

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileInputStream;
import java.io.FileOutputStream;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,9 +15,9 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
package org.apache.poi.examples.hssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,15 +15,15 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.usermodel.examples;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFSheet;
package org.apache.poi.examples.hssf.usermodel;
import java.io.IOException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
/**
* Sets the zoom magnication for a sheet.

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.hwpf;
package org.apache.poi.examples.hwpf;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -26,6 +26,7 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.model.StyleDescription;
import org.apache.poi.hwpf.model.StyleSheet;
import org.apache.poi.hwpf.usermodel.CharacterRun;

View File

@ -16,7 +16,7 @@
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.File;
import java.io.FileOutputStream;

View File

@ -14,13 +14,20 @@ 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.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.util.Calendar;

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.File;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.File;
import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.io.IOException;
@ -42,12 +42,12 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
* case; the data could appear on a separate sheet. If this were done, then the
* names for the regions would have to be different, they would have to include
* the name of the sheet.
*
* There are two keys to this technique. The first is the use of named area or
*
* There are two keys to this technique. The first is the use of named area or
* regions of cells to hold the data for the drop down lists and the second is
* making use of the INDIRECT() function to convert a name into the addresses
* of the cells it refers to.
*
*
* Note that whilst this class builds just two linked drop down lists, there is
* nothing to prevent more being created. Quite simply, use the value selected
* by the user in one drop down list to determine what is shown in another and the
@ -114,16 +114,16 @@ public class LinkedDropDownLists {
* the cells on rows two, three and four will be used to populate the second
* drop down list, just which row will be determined by the choice the user
* makes in the first drop down list.
*
*
* In all cases, the approach is to create a row, create and populate cells
* with data and then specify a name that identifies those cells. With the
* exception of the first range, the names that are chosen for each range
* of cells are quite important. In short, each of the options the user
* of cells are quite important. In short, each of the options the user
* could select in the first drop down list is used as the name for another
* range of cells. Thus, in this example, the user can select either
* range of cells. Thus, in this example, the user can select either
* 'Animal', 'Vegetable' or 'Mineral' in the first drop down and so the
* sheet contains ranges named 'ANIMAL', 'VEGETABLE' and 'MINERAL'.
*
*
* @param dataSheet An instance of a class that implements the Sheet Sheet
* interface (HSSFSheet or XSSFSheet).
*/

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.File;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.util.HashMap;

View File

@ -16,7 +16,7 @@
* limitations under the License.
* ====================================================================
*/
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.FileOutputStream;
import java.util.HashMap;

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples;
package org.apache.poi.examples.ss;
import java.io.BufferedWriter;

View File

@ -14,19 +14,19 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples.formula;
package org.apache.poi.examples.ss.formula;
import org.apache.poi.ss.formula.OperationEvaluationContext ;
import org.apache.poi.ss.formula.eval.ErrorEval ;
import org.apache.poi.ss.formula.eval.EvaluationException ;
import org.apache.poi.ss.formula.eval.NumberEval ;
import org.apache.poi.ss.formula.eval.OperandResolver ;
import org.apache.poi.ss.formula.eval.ValueEval ;
import org.apache.poi.ss.formula.functions.FreeRefFunction ;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
/**
* A simple user-defined function to calculate principal and interest.
*
*
* @author Jon Svede ( jon [at] loquatic [dot] com )
* @author Brian Bush ( brian [dot] bush [at] nrel [dot] gov )
*
@ -35,9 +35,9 @@ public class CalculateMortgage implements FreeRefFunction {
@Override
public ValueEval evaluate( ValueEval[] args, OperationEvaluationContext ec ) {
// verify that we have enough data
if (args.length != 3) {
if (args.length != 3) {
return ErrorEval.VALUE_INVALID;
}
@ -45,33 +45,33 @@ public class CalculateMortgage implements FreeRefFunction {
double principal, rate, years, result;
try {
// extract values as ValueEval
ValueEval v1 = OperandResolver.getSingleValue( args[0],
ec.getRowIndex(),
ValueEval v1 = OperandResolver.getSingleValue( args[0],
ec.getRowIndex(),
ec.getColumnIndex() ) ;
ValueEval v2 = OperandResolver.getSingleValue( args[1],
ec.getRowIndex(),
ValueEval v2 = OperandResolver.getSingleValue( args[1],
ec.getRowIndex(),
ec.getColumnIndex() ) ;
ValueEval v3 = OperandResolver.getSingleValue( args[2],
ec.getRowIndex(),
ValueEval v3 = OperandResolver.getSingleValue( args[2],
ec.getRowIndex(),
ec.getColumnIndex() ) ;
// get data as doubles
principal = OperandResolver.coerceValueToDouble( v1 ) ;
principal = OperandResolver.coerceValueToDouble( v1 ) ;
rate = OperandResolver.coerceValueToDouble( v2 ) ;
years = OperandResolver.coerceValueToDouble( v3 ) ;
result = calculateMortgagePayment( principal, rate, years ) ;
System.out.println( "Result = " + result ) ;
checkValue(result);
} catch (EvaluationException e) {
return e.getErrorEval();
}
return new NumberEval( result ) ;
}
public double calculateMortgagePayment( double p, double r, double y ) {
double i = r / 12 ;
double n = y * 12 ;
@ -87,5 +87,5 @@ public class CalculateMortgage implements FreeRefFunction {
if (Double.isNaN(result) || Double.isInfinite(result)) {
throw new EvaluationException(ErrorEval.NUM_ERROR);
}
}
}
}

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples.formula;
package org.apache.poi.examples.ss.formula;
import java.io.File;
import java.util.ArrayList;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.ss.examples.formula;
package org.apache.poi.examples.ss.formula;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples.formula;
package org.apache.poi.examples.ss.formula;
import java.io.File;

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples.html;
package org.apache.poi.examples.ss.html;
import java.util.Formatter;

View File

@ -15,12 +15,12 @@
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples.html;
import org.apache.poi.ss.usermodel.CellStyle;
package org.apache.poi.examples.ss.html;
import java.util.Formatter;
import org.apache.poi.ss.usermodel.CellStyle;
/**
* This interface is used where code wants to be independent of the workbook
* formats. If you are writing such code, you can add a method to this

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples.html;
package org.apache.poi.examples.ss.html;
import java.io.BufferedReader;
import java.io.Closeable;

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ss.examples.html;
package org.apache.poi.examples.ss.html;
import java.util.Formatter;

View File

@ -19,4 +19,4 @@
* This package contains an example that uses POI to convert a workbook into
* an HTML representation of the data. It can use both XSSF and HSSF workbooks.
*/
package org.apache.poi.ss.examples.html;
package org.apache.poi.examples.ss.html;

View File

@ -1,46 +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.examples.util;
import java.io.File;
import org.apache.poi.util.TempFile;
public final class TempFileUtils {
private TempFileUtils() {
}
@SuppressWarnings("java:S106")
public static void checkTempFiles() {
String tmpDir = System.getProperty(TempFile.JAVA_IO_TMPDIR) + "/poifiles";
File tempDir = new File(tmpDir);
if(tempDir.exists()) {
String[] tempFiles = tempDir.list();
if(tempFiles != null && tempFiles.length > 0) {
System.out.println("found files in poi temp dir " + tempDir.getAbsolutePath());
for(String filename : tempFiles) {
System.out.println("file: " + filename);
}
}
} else {
System.out.println("unable to find poi temp dir");
}
}
}

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel;
package org.apache.poi.examples.xslf;
import java.io.BufferedReader;
import java.io.FileInputStream;
@ -37,6 +37,9 @@ import org.apache.poi.xddf.usermodel.chart.XDDFChartData;
import org.apache.poi.xddf.usermodel.chart.XDDFDataSource;
import org.apache.poi.xddf.usermodel.chart.XDDFDataSourcesFactory;
import org.apache.poi.xddf.usermodel.chart.XDDFNumericalDataSource;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFChart;
import org.apache.poi.xslf.usermodel.XSLFSlide;
/**
* Build a bar chart from a template pptx

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel;
package org.apache.poi.examples.xslf;
import java.awt.geom.Rectangle2D;
import java.io.BufferedReader;
@ -45,6 +45,11 @@ import org.apache.poi.xddf.usermodel.chart.XDDFDataSource;
import org.apache.poi.xddf.usermodel.chart.XDDFDataSourcesFactory;
import org.apache.poi.xddf.usermodel.chart.XDDFNumericalDataSource;
import org.apache.poi.xddf.usermodel.chart.XDDFValueAxis;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFChart;
import org.apache.poi.xslf.usermodel.XSLFGraphicFrame;
import org.apache.poi.xslf.usermodel.XSLFShape;
import org.apache.poi.xslf.usermodel.XSLFSlide;
/**
* Build a chart without reading template file

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel;
package org.apache.poi.examples.xslf;
import java.awt.Dimension;
import java.io.FileInputStream;
@ -26,6 +26,12 @@ import java.io.InputStream;
import java.io.PrintStream;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFPictureData;
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
import org.apache.poi.xslf.usermodel.XSLFShape;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFTextShape;
/**
* Demonstrates how you can extract data from a .pptx file

View File

@ -17,11 +17,14 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel;
package org.apache.poi.examples.xslf;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
/**
* Merge multiple pptx presentations together
*/

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel;
package org.apache.poi.examples.xslf;
import java.io.BufferedReader;
import java.io.FileInputStream;
@ -34,6 +34,9 @@ import org.apache.poi.xddf.usermodel.chart.XDDFDataSource;
import org.apache.poi.xddf.usermodel.chart.XDDFDataSourcesFactory;
import org.apache.poi.xddf.usermodel.chart.XDDFNumericalDataSource;
import org.apache.poi.xddf.usermodel.chart.XDDFPieChartData;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFChart;
import org.apache.poi.xslf.usermodel.XSLFSlide;
/**
* Build a pie chart from a template pptx

View File

@ -14,14 +14,22 @@
* 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;
package org.apache.poi.examples.xslf;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.xslf.usermodel.SlideLayout;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFSlideLayout;
import org.apache.poi.xslf.usermodel.XSLFSlideMaster;
import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
import org.apache.poi.xslf.usermodel.XSLFTextShape;
/**
* Demonstrates how to create slides with predefined layout
* and fill the placeholder shapes

View File

@ -14,16 +14,22 @@
* 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;
package org.apache.poi.examples.xslf;
import java.awt.Color;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFTextBox;
import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
import org.apache.poi.xslf.usermodel.XSLFTextRun;
/**
* Basic paragraph and text formatting
*/

View File

@ -14,16 +14,19 @@
* 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;
package org.apache.poi.examples.xslf;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.sl.usermodel.Placeholder;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFTextShape;
/**
* How to set slide title

View File

@ -14,10 +14,10 @@
* 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;
package org.apache.poi.examples.xslf;
import java.awt.Color;
import java.awt.Rectangle;
@ -26,6 +26,13 @@ import java.io.IOException;
import org.apache.poi.sl.usermodel.TableCell.BorderEdge;
import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFTable;
import org.apache.poi.xslf.usermodel.XSLFTableCell;
import org.apache.poi.xslf.usermodel.XSLFTableRow;
import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
import org.apache.poi.xslf.usermodel.XSLFTextRun;
/**
* PPTX Tables

View File

@ -14,16 +14,19 @@
* 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;
package org.apache.poi.examples.xslf;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.sl.usermodel.PictureData.PictureType;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFPictureData;
import org.apache.poi.xslf.usermodel.XSLFSlide;
/**
* Images

View File

@ -17,12 +17,18 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel;
package org.apache.poi.examples.xslf;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFHyperlink;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFTextBox;
import org.apache.poi.xslf.usermodel.XSLFTextRun;
/**
* Hyperlinks
*/

View File

@ -14,10 +14,10 @@
* 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;
package org.apache.poi.examples.xslf;
import java.awt.Color;
import java.awt.Rectangle;
@ -25,6 +25,11 @@ import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.sl.usermodel.AutoNumberingScheme;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFTextBox;
import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
import org.apache.poi.xslf.usermodel.XSLFTextRun;
/**
* Bullets and numbering

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel.tutorial;
package org.apache.poi.examples.xslf.tutorial;
import java.io.FileInputStream;

View File

@ -17,7 +17,9 @@
* ====================================================================
*/
package org.apache.poi.xslf.usermodel.tutorial;
package org.apache.poi.examples.xslf.tutorial;
import java.io.FileOutputStream;
import org.apache.poi.xslf.usermodel.SlideLayout;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
@ -26,8 +28,6 @@ import org.apache.poi.xslf.usermodel.XSLFSlideLayout;
import org.apache.poi.xslf.usermodel.XSLFSlideMaster;
import org.apache.poi.xslf.usermodel.XSLFTextShape;
import java.io.FileOutputStream;
/**
* Create slides from pre-defined slide layouts
*/

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.eventusermodel.examples;
package org.apache.poi.examples.xssf.eventusermodel;
import java.io.InputStream;
import java.util.Iterator;
@ -26,7 +26,6 @@ import javax.xml.parsers.ParserConfigurationException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.util.XMLHelper;
import org.apache.poi.xssf.eventusermodel.XLSX2CSV;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.xml.sax.Attributes;
@ -133,11 +132,11 @@ public class FromHowTo {
throws SAXException {
// Process the last contents as required.
// Do now, as characters() may be called more than once
if(nextIsString && !lastContents.trim().isEmpty()) {
if(nextIsString) {
Integer idx = Integer.valueOf(lastContents);
lastContents = lruCache.get(idx);
if (lastContents == null && !lruCache.containsKey(idx)) {
lastContents = sst.getItemAt(idx).toString();
lastContents = sst.getItemAt(idx).getString();
lruCache.put(idx, lastContents);
}
nextIsString = false;

View File

@ -17,15 +17,15 @@
* ====================================================================
*/
package org.apache.poi.xssf.eventusermodel.examples;
package org.apache.poi.examples.xssf.eventusermodel;
import java.io.InputStream;
import org.apache.poi.examples.xssf.usermodel.LoadPasswordProtectedXlsx;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.poifs.crypt.temp.AesZipFileZipEntrySource;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.eventusermodel.XSSFReader.SheetIterator;
import org.apache.poi.xssf.usermodel.examples.LoadPasswordProtectedXlsx;
/**
* An example that loads a password protected workbook and counts the sheets.

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.eventusermodel;
package org.apache.poi.examples.xssf.eventusermodel;
import java.io.File;
import java.io.IOException;
@ -31,6 +31,9 @@ import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.XMLHelper;
import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler;
import org.apache.poi.xssf.eventusermodel.XSSFSheetXMLHandler.SheetContentsHandler;
import org.apache.poi.xssf.extractor.XSSFEventBasedExcelExtractor;
import org.apache.poi.xssf.model.SharedStrings;
@ -132,7 +135,7 @@ public class XLSX2CSV {
//noinspection ResultOfMethodCallIgnored
Double.parseDouble(formattedValue);
output.append(formattedValue);
} catch (Exception e) {
} catch (NumberFormatException e) {
output.append('"');
output.append(formattedValue);
output.append('"');

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.streaming.examples;
package org.apache.poi.examples.xssf.streaming;
import java.io.FileInputStream;
import java.io.IOException;
@ -30,12 +30,12 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
import org.xml.sax.SAXException;
/**
* This demonstrates how a hybrid approach to workbook read can be taken, using
* This demonstrates how a hybrid approach to workbook read can be taken, using
* a mix of traditional XSSF and streaming one particular worksheet (perhaps one
* which is too big for the ordinary DOM parse).
*/
public class HybridStreaming {
private static final String SHEET_TO_STREAM = "large sheet";
public static void main(String[] args) throws IOException, SAXException {
@ -61,15 +61,15 @@ public class HybridStreaming {
private static SheetContentsHandler createSheetContentsHandler() {
return new SheetContentsHandler() {
@Override
public void startRow(int rowNum) {
}
@Override
public void endRow(int rowNum) {
}
@Override
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
}

View File

@ -15,7 +15,7 @@
limitations under the License.
==================================================================== */
package org.apache.poi.xssf.streaming.examples;
package org.apache.poi.examples.xssf.streaming;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -17,7 +17,7 @@
* ====================================================================
*/
package org.apache.poi.xssf.streaming.examples;
package org.apache.poi.examples.xssf.streaming;
import java.io.FileOutputStream;
import java.io.IOException;

View File

@ -14,7 +14,7 @@ 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.xssf.usermodel.examples;
package org.apache.poi.examples.xssf.usermodel;
import java.io.FileOutputStream;
import java.io.IOException;
@ -37,7 +37,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTRowImpl;
* Shows how various alignment options work.
*
* Modified by Cristian Petrula, Romania on May 26, 2010
* New method was added centerAcrossSelection to center a column content over
* New method was added centerAcrossSelection to center a column content over
* one selection using {@link HorizontalAlignment#CENTER_SELECTION}
* To create this method example was change for XSSF only and the previous
* AligningCells.java example has been moved into the SS examples folder.

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