From 5f4551da69cdc956a8c4d516809071f1ffe9452a Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Mon, 6 Oct 2014 13:20:12 +0000 Subject: [PATCH] Print out current version of java before building to allow to see in build output if we use a supported Java VM version git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1629644 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 2 + .../apache/poi/hssf/record/FormulaRecord.java | 13 +- .../org/apache/poi/hssf/record/RKRecord.java | 2 + .../poi/hssf/usermodel/DummyGraphics2d.java | 794 ------------------ .../poi/hssf/usermodel/HSSFComment.java | 3 + .../hssf/usermodel/HSSFFormulaEvaluator.java | 34 +- .../poi/ss/formula/ptg/Ref2DPtgBase.java | 26 +- .../apache/poi/ss/formula/ptg/RefPtgBase.java | 3 +- .../poi/ss/usermodel/FormulaEvaluator.java | 4 +- .../poi/xssf/streaming/SXSSFWorkbook.java | 62 +- .../poi/xssf/streaming/TestSXSSFWorkbook.java | 41 +- .../poi/xssf/usermodel/TestXSSFRow.java | 50 ++ .../poi/xssf/usermodel/TestXSSFWorkbook.java | 36 +- .../org/apache/poi/POIDataSamples.java | 6 +- .../poi/hssf/usermodel/TestCellStyle.java | 180 ++-- .../poi/hssf/usermodel/TestComment.java | 161 +++- .../poi/hssf/usermodel/TestHSSFWorkbook.java | 79 +- test-data/spreadsheet/SampleSS.xlsx | Bin 9112 -> 7146 bytes 18 files changed, 565 insertions(+), 931 deletions(-) delete mode 100644 src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java diff --git a/build.xml b/build.xml index 7c46239ccf..feefdc3b3f 100644 --- a/build.xml +++ b/build.xml @@ -362,6 +362,8 @@ under the License. + + diff --git a/src/java/org/apache/poi/hssf/record/FormulaRecord.java b/src/java/org/apache/poi/hssf/record/FormulaRecord.java index 4445838857..c0a63d3092 100644 --- a/src/java/org/apache/poi/hssf/record/FormulaRecord.java +++ b/src/java/org/apache/poi/hssf/record/FormulaRecord.java @@ -17,10 +17,10 @@ package org.apache.poi.hssf.record; -import org.apache.poi.ss.formula.ptg.Ptg; -import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.ss.formula.Formula; +import org.apache.poi.ss.formula.eval.ErrorEval; +import org.apache.poi.ss.formula.ptg.Ptg; import org.apache.poi.util.BitField; import org.apache.poi.util.BitFieldFactory; import org.apache.poi.util.HexDump; @@ -136,7 +136,8 @@ public final class FormulaRecord extends CellRecord { }; return new SpecialCachedValue(vd); } - public String toString() { + @Override + public String toString() { StringBuffer sb = new StringBuffer(64); sb.append(getClass().getName()); sb.append('[').append(formatValue()).append(']'); @@ -319,7 +320,8 @@ public final class FormulaRecord extends CellRecord { field_8_parsed_expr = Formula.create(ptgs); } - public short getSid() { + @Override + public short getSid() { return sid; } @@ -372,7 +374,8 @@ public final class FormulaRecord extends CellRecord { } } - public Object clone() { + @Override + public Object clone() { FormulaRecord rec = new FormulaRecord(); copyBaseFields(rec); rec.field_4_value = field_4_value; diff --git a/src/java/org/apache/poi/hssf/record/RKRecord.java b/src/java/org/apache/poi/hssf/record/RKRecord.java index 4ad30d915f..d3babe8f36 100644 --- a/src/java/org/apache/poi/hssf/record/RKRecord.java +++ b/src/java/org/apache/poi/hssf/record/RKRecord.java @@ -94,10 +94,12 @@ public final class RKRecord extends CellRecord { return 4; } + @Override public short getSid() { return sid; } + @Override public Object clone() { RKRecord rec = new RKRecord(); copyBaseFields(rec); diff --git a/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java b/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java deleted file mode 100644 index f2e2325da9..0000000000 --- a/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java +++ /dev/null @@ -1,794 +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.hssf.usermodel; - -import java.awt.*; -import java.awt.font.FontRenderContext; -import java.awt.font.GlyphVector; -import java.awt.geom.AffineTransform; -import java.awt.image.BufferedImage; -import java.awt.image.BufferedImageOp; -import java.awt.image.ImageObserver; -import java.awt.image.RenderedImage; -import java.awt.image.renderable.RenderableImage; -import java.text.AttributedCharacterIterator; -import java.util.Map; - -public class DummyGraphics2d - extends Graphics2D -{ - BufferedImage img; - private Graphics2D g2D; - - public DummyGraphics2d() - { - img = new BufferedImage(1000, 1000, 2); - g2D = (Graphics2D)img.getGraphics(); - } - - public void addRenderingHints(Map hints) - { - System.out.println( "addRenderingHinds(Map):" ); - System.out.println( " hints = " + hints ); - g2D.addRenderingHints( hints ); - } - - public void clip(Shape s) - { - System.out.println( "clip(Shape):" ); - System.out.println( " s = " + s ); - g2D.clip( s ); - } - - public void draw(Shape s) - { - System.out.println( "draw(Shape):" ); - System.out.println( "s = " + s ); - g2D.draw( s ); - } - - public void drawGlyphVector(GlyphVector g, float x, float y) - { - System.out.println( "drawGlyphVector(GlyphVector, float, float):" ); - System.out.println( "g = " + g ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.drawGlyphVector( g, x, y ); - } - - public void drawImage(BufferedImage img, - BufferedImageOp op, - int x, - int y) - { - System.out.println( "drawImage(BufferedImage, BufferedImageOp, x, y):" ); - System.out.println( "img = " + img ); - System.out.println( "op = " + op ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.drawImage( img, op, x, y ); - } - - public boolean drawImage(Image img, - AffineTransform xform, - ImageObserver obs) - { - System.out.println( "drawImage(Image,AfflineTransform,ImageObserver):" ); - System.out.println( "img = " + img ); - System.out.println( "xform = " + xform ); - System.out.println( "obs = " + obs ); - return g2D.drawImage( img, xform, obs ); - } - - public void drawRenderableImage(RenderableImage img, - AffineTransform xform) - { - System.out.println( "drawRenderableImage(RenderableImage, AfflineTransform):" ); - System.out.println( "img = " + img ); - System.out.println( "xform = " + xform ); - g2D.drawRenderableImage( img, xform ); - } - - public void drawRenderedImage(RenderedImage img, - AffineTransform xform) - { - System.out.println( "drawRenderedImage(RenderedImage, AffineTransform):" ); - System.out.println( "img = " + img ); - System.out.println( "xform = " + xform ); - g2D.drawRenderedImage( img, xform ); - } - - public void drawString(AttributedCharacterIterator iterator, - float x, float y) - { - System.out.println( "drawString(AttributedCharacterIterator):" ); - System.out.println( "iterator = " + iterator ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.drawString( iterator, x, y ); - } - -// public void drawString(AttributedCharacterIterator iterator, -// int x, int y) -// { -// g2D.drawString( iterator, x, y ); -// } - - public void drawString(String s, float x, float y) - { - System.out.println( "drawString(s,x,y):" ); - System.out.println( "s = " + s ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.drawString( s, x, y ); - } - -// public void drawString(String str, int x, int y) -// { -// g2D.drawString( str, x, y ); -// } - - public void fill(Shape s) - { - System.out.println( "fill(Shape):" ); - System.out.println( "s = " + s ); - g2D.fill( s ); - } - -// public void fill3DRect(int x, int y, int width, int height, -// boolean raised) { -// g2D.fill3DRect( x, y, width, height, raised ); -// } - - public Color getBackground() - { - System.out.println( "getBackground():" ); - return g2D.getBackground(); - } - - public Composite getComposite() - { - System.out.println( "getComposite():" ); - return g2D.getComposite(); - } - - public GraphicsConfiguration getDeviceConfiguration() - { - System.out.println( "getDeviceConfiguration():" ); - return g2D.getDeviceConfiguration(); - } - - public FontRenderContext getFontRenderContext() - { - System.out.println( "getFontRenderContext():" ); - return g2D.getFontRenderContext(); - } - - public Paint getPaint() - { - System.out.println( "getPaint():" ); - return g2D.getPaint(); - } - - public Object getRenderingHint(RenderingHints.Key hintKey) - { - System.out.println( "getRenderingHint(RenderingHints.Key):" ); - System.out.println( "hintKey = " + hintKey ); - return g2D.getRenderingHint( hintKey ); - } - - public RenderingHints getRenderingHints() - { - System.out.println( "getRenderingHints():" ); - return g2D.getRenderingHints(); - } - - public Stroke getStroke() - { - System.out.println( "getStroke():" ); - return g2D.getStroke(); - } - - public AffineTransform getTransform() - { - System.out.println( "getTransform():" ); - return g2D.getTransform(); - } - - public boolean hit(Rectangle rect, - Shape s, - boolean onStroke) - { - System.out.println( "hit(Rectangle, Shape, onStroke):" ); - System.out.println( "rect = " + rect ); - System.out.println( "s = " + s ); - System.out.println( "onStroke = " + onStroke ); - return g2D.hit( rect, s, onStroke ); - } - - public void rotate(double theta) - { - System.out.println( "rotate(theta):" ); - System.out.println( "theta = " + theta ); - g2D.rotate( theta ); - } - - public void rotate(double theta, double x, double y) - { - System.out.println( "rotate(double,double,double):" ); - System.out.println( "theta = " + theta ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.rotate( theta, x, y ); - } - - public void scale(double sx, double sy) - { - System.out.println( "scale(double,double):" ); - System.out.println( "sx = " + sx ); - System.out.println( "sy" ); - g2D.scale( sx, sy ); - } - - public void setBackground(Color color) - { - System.out.println( "setBackground(Color):" ); - System.out.println( "color = " + color ); - g2D.setBackground( color ); - } - - public void setComposite(Composite comp) - { - System.out.println( "setComposite(Composite):" ); - System.out.println( "comp = " + comp ); - g2D.setComposite( comp ); - } - - public void setPaint( Paint paint ) - { - System.out.println( "setPain(Paint):" ); - System.out.println( "paint = " + paint ); - g2D.setPaint( paint ); - } - - public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue) - { - System.out.println( "setRenderingHint(RenderingHints.Key, Object):" ); - System.out.println( "hintKey = " + hintKey ); - System.out.println( "hintValue = " + hintValue ); - g2D.setRenderingHint( hintKey, hintValue ); - } - - public void setRenderingHints(Map hints) - { - System.out.println( "setRenderingHints(Map):" ); - System.out.println( "hints = " + hints ); - g2D.setRenderingHints( hints ); - } - - public void setStroke(Stroke s) - { - System.out.println( "setStroke(Stoke):" ); - System.out.println( "s = " + s ); - g2D.setStroke( s ); - } - - public void setTransform(AffineTransform Tx) - { - System.out.println( "setTransform():" ); - System.out.println( "Tx = " + Tx ); - g2D.setTransform( Tx ); - } - - public void shear(double shx, double shy) - { - System.out.println( "shear(shx, dhy):" ); - System.out.println( "shx = " + shx ); - System.out.println( "shy = " + shy ); - g2D.shear( shx, shy ); - } - - public void transform(AffineTransform Tx) - { - System.out.println( "transform(AffineTransform):" ); - System.out.println( "Tx = " + Tx ); - g2D.transform( Tx ); - } - - public void translate(double tx, double ty) - { - System.out.println( "translate(double, double):" ); - System.out.println( "tx = " + tx ); - System.out.println( "ty = " + ty ); - g2D.translate( tx, ty ); - } - -// public void translate(int x, int y) -// { -// g2D.translate( x, y ); -// } - - public void clearRect(int x, int y, int width, int height) - { - System.out.println( "clearRect(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.clearRect( x, y, width, height ); - } - - public void clipRect(int x, int y, int width, int height) - { - System.out.println( "clipRect(int, int, int, int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.clipRect( x, y, width, height ); - } - - public void copyArea(int x, int y, int width, int height, - int dx, int dy) - { - System.out.println( "copyArea(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.copyArea( x, y, width, height, dx, dy ); - } - - public Graphics create() - { - System.out.println( "create():" ); - return g2D.create(); - } - - public Graphics create(int x, int y, int width, int height) { - System.out.println( "create(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - return g2D.create( x, y, width, height ); - } - - public void dispose() - { - System.out.println( "dispose():" ); - g2D.dispose(); - } - - public void draw3DRect(int x, int y, int width, int height, - boolean raised) { - System.out.println( "draw3DRect(int,int,int,int,boolean):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - System.out.println( "raised = " + raised ); - g2D.draw3DRect( x, y, width, height, raised ); - } - - public void drawArc(int x, int y, int width, int height, - int startAngle, int arcAngle) - { - System.out.println( "drawArc(int,int,int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - System.out.println( "startAngle = " + startAngle ); - System.out.println( "arcAngle = " + arcAngle ); - g2D.drawArc( x, y, width, height, startAngle, arcAngle ); - } - - public void drawBytes(byte data[], int offset, int length, int x, int y) { - System.out.println( "drawBytes(byte[],int,int,int,int):" ); - System.out.println( "data = " + data ); - System.out.println( "offset = " + offset ); - System.out.println( "length = " + length ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.drawBytes( data, offset, length, x, y ); - } - - public void drawChars(char data[], int offset, int length, int x, int y) { - System.out.println( "drawChars(data,int,int,int,int):" ); - System.out.println( "data = " + data.toString() ); - System.out.println( "offset = " + offset ); - System.out.println( "length = " + length ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.drawChars( data, offset, length, x, y ); - } - - public boolean drawImage(Image img, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - ImageObserver observer) - { - System.out.println( "drawImage(Image,int,int,int,int,int,int,int,int,ImageObserver):" ); - System.out.println( "img = " + img ); - System.out.println( "dx1 = " + dx1 ); - System.out.println( "dy1 = " + dy1 ); - System.out.println( "dx2 = " + dx2 ); - System.out.println( "dy2 = " + dy2 ); - System.out.println( "sx1 = " + sx1 ); - System.out.println( "sy1 = " + sy1 ); - System.out.println( "sx2 = " + sx2 ); - System.out.println( "sy2 = " + sy2 ); - System.out.println( "observer = " + observer ); - return g2D.drawImage( img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer ); - } - - public boolean drawImage(Image img, - int dx1, int dy1, int dx2, int dy2, - int sx1, int sy1, int sx2, int sy2, - Color bgcolor, - ImageObserver observer) - { - System.out.println( "drawImage(Image,int,int,int,int,int,int,int,int,Color,ImageObserver):" ); - System.out.println( "img = " + img ); - System.out.println( "dx1 = " + dx1 ); - System.out.println( "dy1 = " + dy1 ); - System.out.println( "dx2 = " + dx2 ); - System.out.println( "dy2 = " + dy2 ); - System.out.println( "sx1 = " + sx1 ); - System.out.println( "sy1 = " + sy1 ); - System.out.println( "sx2 = " + sx2 ); - System.out.println( "sy2 = " + sy2 ); - System.out.println( "bgcolor = " + bgcolor ); - System.out.println( "observer = " + observer ); - return g2D.drawImage( img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer ); - } - - public boolean drawImage(Image img, int x, int y, - Color bgcolor, - ImageObserver observer) - { - System.out.println( "drawImage(Image,int,int,Color,ImageObserver):" ); - System.out.println( "img = " + img ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "bgcolor = " + bgcolor ); - System.out.println( "observer = " + observer ); - return g2D.drawImage( img, x, y, bgcolor, observer ); - } - - public boolean drawImage(Image img, int x, int y, - ImageObserver observer) - { - System.out.println( "drawImage(Image,int,int,observer):" ); - System.out.println( "img = " + img ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "observer = " + observer ); - return g2D.drawImage( img, x, y, observer ); - } - - public boolean drawImage(Image img, int x, int y, - int width, int height, - Color bgcolor, - ImageObserver observer) - { - System.out.println( "drawImage(Image,int,int,int,int,Color,ImageObserver):" ); - System.out.println( "img = " + img ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - System.out.println( "bgcolor = " + bgcolor ); - System.out.println( "observer = " + observer ); - return g2D.drawImage( img, x, y, width, height, bgcolor, observer ); - } - - public boolean drawImage(Image img, int x, int y, - int width, int height, - ImageObserver observer) - { - System.out.println( "drawImage(Image,int,int,width,height,observer):" ); - System.out.println( "img = " + img ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - System.out.println( "observer = " + observer ); - return g2D.drawImage( img, x, y, width, height, observer ); - } - - public void drawLine(int x1, int y1, int x2, int y2) - { - System.out.println( "drawLine(int,int,int,int):" ); - System.out.println( "x1 = " + x1 ); - System.out.println( "y1 = " + y1 ); - System.out.println( "x2 = " + x2 ); - System.out.println( "y2 = " + y2 ); - g2D.drawLine( x1, y1, x2, y2 ); - } - - public void drawOval(int x, int y, int width, int height) - { - System.out.println( "drawOval(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.drawOval( x, y, width, height ); - } - - public void drawPolygon(Polygon p) { - System.out.println( "drawPolygon(Polygon):" ); - System.out.println( "p = " + p ); - g2D.drawPolygon( p ); - } - - public void drawPolygon(int xPoints[], int yPoints[], - int nPoints) - { - System.out.println( "drawPolygon(int[],int[],int):" ); - System.out.println( "xPoints = " + xPoints ); - System.out.println( "yPoints = " + yPoints ); - System.out.println( "nPoints = " + nPoints ); - g2D.drawPolygon( xPoints, yPoints, nPoints ); - } - - public void drawPolyline(int xPoints[], int yPoints[], - int nPoints) - { - System.out.println( "drawPolyline(int[],int[],int):" ); - System.out.println( "xPoints = " + xPoints ); - System.out.println( "yPoints = " + yPoints ); - System.out.println( "nPoints = " + nPoints ); - g2D.drawPolyline( xPoints, yPoints, nPoints ); - } - - public void drawRect(int x, int y, int width, int height) { - System.out.println( "drawRect(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.drawRect( x, y, width, height ); - } - - public void drawRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) - { - System.out.println( "drawRoundRect(int,int,int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - System.out.println( "arcWidth = " + arcWidth ); - System.out.println( "arcHeight = " + arcHeight ); - g2D.drawRoundRect( x, y, width, height, arcWidth, arcHeight ); - } - - public void drawString(AttributedCharacterIterator iterator, - int x, int y) - { - System.out.println( "drawString(AttributedCharacterIterator,int,int):" ); - System.out.println( "iterator = " + iterator ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.drawString( iterator, x, y ); - } - - public void drawString(String str, int x, int y) - { - System.out.println( "drawString(str,int,int):" ); - System.out.println( "str = " + str ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.drawString( str, x, y ); - } - - public void fill3DRect(int x, int y, int width, int height, - boolean raised) { - System.out.println( "fill3DRect(int,int,int,int,boolean):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - System.out.println( "raised = " + raised ); - g2D.fill3DRect( x, y, width, height, raised ); - } - - public void fillArc(int x, int y, int width, int height, - int startAngle, int arcAngle) - { - System.out.println( "fillArc(int,int,int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - System.out.println( "startAngle = " + startAngle ); - System.out.println( "arcAngle = " + arcAngle ); - g2D.fillArc( x, y, width, height, startAngle, arcAngle ); - } - - public void fillOval(int x, int y, int width, int height) - { - System.out.println( "fillOval(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.fillOval( x, y, width, height ); - } - - public void fillPolygon(Polygon p) { - System.out.println( "fillPolygon(Polygon):" ); - System.out.println( "p = " + p ); - g2D.fillPolygon( p ); - } - - public void fillPolygon(int xPoints[], int yPoints[], - int nPoints) - { - System.out.println( "fillPolygon(int[],int[],int):" ); - System.out.println( "xPoints = " + xPoints ); - System.out.println( "yPoints = " + yPoints ); - System.out.println( "nPoints = " + nPoints ); - g2D.fillPolygon( xPoints, yPoints, nPoints ); - } - - public void fillRect(int x, int y, int width, int height) - { - System.out.println( "fillRect(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.fillRect( x, y, width, height ); - } - - public void fillRoundRect(int x, int y, int width, int height, - int arcWidth, int arcHeight) - { - System.out.println( "fillRoundRect(int,int,int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.fillRoundRect( x, y, width, height, arcWidth, arcHeight ); - } - - public void finalize() { - System.out.println( "finalize():" ); - g2D.finalize(); - - super.finalize(); - } - - public Shape getClip() - { - System.out.println( "getClip():" ); - return g2D.getClip(); - } - - public Rectangle getClipBounds() - { - System.out.println( "getClipBounds():" ); - return g2D.getClipBounds(); - } - - public Rectangle getClipBounds(Rectangle r) { - System.out.println( "getClipBounds(Rectangle):" ); - System.out.println( "r = " + r ); - return g2D.getClipBounds( r ); - } - - @SuppressWarnings("deprecation") - public Rectangle getClipRect() { - System.out.println( "getClipRect():" ); - return g2D.getClipRect(); - } - - public Color getColor() - { - System.out.println( "getColor():" ); - return g2D.getColor(); - } - - public Font getFont() - { - System.out.println( "getFont():" ); - return g2D.getFont(); - } - - public FontMetrics getFontMetrics() { - System.out.println( "getFontMetrics():" ); - return g2D.getFontMetrics(); - } - - public FontMetrics getFontMetrics(Font f) - { - System.out.println( "getFontMetrics():" ); - return g2D.getFontMetrics( f ); - } - - public boolean hitClip(int x, int y, int width, int height) { - System.out.println( "hitClip(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - return g2D.hitClip( x, y, width, height ); - } - - public void setClip(Shape clip) - { - System.out.println( "setClip(Shape):" ); - System.out.println( "clip = " + clip ); - g2D.setClip( clip ); - } - - public void setClip(int x, int y, int width, int height) - { - System.out.println( "setClip(int,int,int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - System.out.println( "width = " + width ); - System.out.println( "height = " + height ); - g2D.setClip( x, y, width, height ); - } - - public void setColor(Color c) - { - System.out.println( "setColor():" ); - System.out.println( "c = " + c ); - g2D.setColor( c ); - } - - public void setFont(Font font) - { - System.out.println( "setFont(Font):" ); - System.out.println( "font = " + font ); - g2D.setFont( font ); - } - - public void setPaintMode() - { - System.out.println( "setPaintMode():" ); - g2D.setPaintMode(); - } - - public void setXORMode(Color c1) - { - System.out.println( "setXORMode(Color):" ); - System.out.println( "c1 = " + c1 ); - g2D.setXORMode( c1 ); - } - - public String toString() { - System.out.println( "toString():" ); - return g2D.toString(); - } - - public void translate(int x, int y) - { - System.out.println( "translate(int,int):" ); - System.out.println( "x = " + x ); - System.out.println( "y = " + y ); - g2D.translate( x, y ); - } -} diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java b/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java index 8b4350893c..db1b4b867d 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFComment.java @@ -132,6 +132,9 @@ public class HSSFComment extends HSSFTextbox implements Comment { CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) getObjRecord().getSubRecords().get(0); cod.setObjectId((short) (shapeId % 1024)); _note.setShapeId(shapeId % 1024); + /* This breaks TestCloneSheets! + * cod.setObjectId(shapeId); + _note.setShapeId(shapeId); */ } /** diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java b/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java index e73903759c..04b0c75040 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFFormulaEvaluator.java @@ -51,7 +51,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator /** * @deprecated (Sep 2008) HSSFSheet parameter is ignored */ - public HSSFFormulaEvaluator(HSSFSheet sheet, HSSFWorkbook workbook) { + @Deprecated + public HSSFFormulaEvaluator(HSSFSheet sheet, HSSFWorkbook workbook) { this(workbook); if (false) { sheet.toString(); // suppress unused parameter compiler warning @@ -104,10 +105,12 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator CollaboratingWorkbooksEnvironment.setup(workbookNames, wbEvals); } - public void setupReferencedWorkbooks(Map evaluators) { + @Override + public void setupReferencedWorkbooks(Map evaluators) { CollaboratingWorkbooksEnvironment.setupFormulaEvaluator(evaluators); } + @Override public WorkbookEvaluator _getWorkbookEvaluator() { return _bookEvaluator; } @@ -116,7 +119,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator * Does nothing * @deprecated (Aug 2008) - not needed, since the current row can be derived from the cell */ - public void setCurrentRow(HSSFRow row) { + @Deprecated + public void setCurrentRow(HSSFRow row) { // do nothing if (false) { row.getClass(); // suppress unused parameter compiler warning @@ -131,7 +135,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator * Failure to call this method after changing cell values will cause incorrect behaviour * of the evaluate~ methods of this class */ - public void clearAllCachedResultValues() { + @Override + public void clearAllCachedResultValues() { _bookEvaluator.clearAllCachedResultValues(); } /** @@ -143,6 +148,7 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator public void notifyUpdateCell(HSSFCell cell) { _bookEvaluator.notifyUpdateCell(new HSSFEvaluationCell(cell)); } + @Override public void notifyUpdateCell(Cell cell) { _bookEvaluator.notifyUpdateCell(new HSSFEvaluationCell((HSSFCell)cell)); } @@ -155,7 +161,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator public void notifyDeleteCell(HSSFCell cell) { _bookEvaluator.notifyDeleteCell(new HSSFEvaluationCell(cell)); } - public void notifyDeleteCell(Cell cell) { + @Override + public void notifyDeleteCell(Cell cell) { _bookEvaluator.notifyDeleteCell(new HSSFEvaluationCell((HSSFCell)cell)); } @@ -165,7 +172,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator * Failure to call this method after changing cell values will cause incorrect behaviour * of the evaluate~ methods of this class */ - public void notifySetFormula(Cell cell) { + @Override + public void notifySetFormula(Cell cell) { _bookEvaluator.notifyUpdateCell(new HSSFEvaluationCell((HSSFCell)cell)); } @@ -179,7 +187,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator * @param cell may be null signifying that the cell is not present (or blank) * @return null if the supplied cell is null or blank */ - public CellValue evaluate(Cell cell) { + @Override + public CellValue evaluate(Cell cell) { if (cell == null) { return null; } @@ -217,7 +226,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator * @param cell The cell to evaluate * @return -1 for non-formula cells, or the type of the formula result */ - public int evaluateFormulaCell(Cell cell) { + @Override + public int evaluateFormulaCell(Cell cell) { if (cell == null || cell.getCellType() != HSSFCell.CELL_TYPE_FORMULA) { return -1; } @@ -242,7 +252,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator * result of the formula. If you simply want the formula * value computed for you, use {@link #evaluateFormulaCell(Cell)}} */ - public HSSFCell evaluateInCell(Cell cell) { + @Override + public HSSFCell evaluateInCell(Cell cell) { if (cell == null) { return null; } @@ -350,7 +361,8 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator * This is a helpful wrapper around looping over all * cells, and calling evaluateFormulaCell on each one. */ - public void evaluateAll() { + @Override +public void evaluateAll() { evaluateAllFormulaCells(_book, this); } @@ -379,11 +391,13 @@ public class HSSFFormulaEvaluator implements FormulaEvaluator, WorkbookEvaluator } /** {@inheritDoc} */ + @Override public void setIgnoreMissingWorkbooks(boolean ignore){ _bookEvaluator.setIgnoreMissingWorkbooks(ignore); } /** {@inheritDoc} */ + @Override public void setDebugEvaluationOutputForNextEval(boolean value){ _bookEvaluator.setDebugEvaluationOutputForNextEval(value); } diff --git a/src/java/org/apache/poi/ss/formula/ptg/Ref2DPtgBase.java b/src/java/org/apache/poi/ss/formula/ptg/Ref2DPtgBase.java index 585b7d73c9..06af02a52a 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/Ref2DPtgBase.java +++ b/src/java/org/apache/poi/ss/formula/ptg/Ref2DPtgBase.java @@ -43,27 +43,31 @@ abstract class Ref2DPtgBase extends RefPtgBase { super(cr); } - public void write(LittleEndianOutput out) { + @Override + public void write(LittleEndianOutput out) { out.writeByte(getSid() + getPtgClass()); writeCoordinates(out); } - public final String toFormulaString() { + @Override + public final String toFormulaString() { return formatReferenceAsString(); } protected abstract byte getSid(); - public final int getSize() { + @Override + public final int getSize() { return SIZE; } - public final String toString() { - StringBuffer sb = new StringBuffer(); - sb.append(getClass().getName()); - sb.append(" ["); - sb.append(formatReferenceAsString()); - sb.append("]"); - return sb.toString(); - } + @Override + public final String toString() { + StringBuffer sb = new StringBuffer(); + sb.append(getClass().getName()); + sb.append(" ["); + sb.append(formatReferenceAsString()); + sb.append("]"); + return sb.toString(); + } } diff --git a/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java b/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java index 4cf5192a01..5ff9a7a3ca 100644 --- a/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java +++ b/src/java/org/apache/poi/ss/formula/ptg/RefPtgBase.java @@ -111,7 +111,8 @@ public abstract class RefPtgBase extends OperandPtg { return cr.formatAsString(); } - public final byte getDefaultOperandClass() { + @Override + public final byte getDefaultOperandClass() { return Ptg.CLASS_REF; } } diff --git a/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java b/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java index 289a209873..951b06af1c 100644 --- a/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java +++ b/src/java/org/apache/poi/ss/usermodel/FormulaEvaluator.java @@ -95,7 +95,9 @@ public interface FormulaEvaluator { * and the result. If you want the cell replaced with * the result of the formula, use {@link #evaluateInCell(Cell)} * @param cell The cell to evaluate - * @return The type of the formula result (the cell's type remains as Cell.CELL_TYPE_FORMULA however) + * @return The type of the formula result, i.e. -1 if the cell is not a formula, + * or one of Cell.CELL_TYPE_NUMERIC, Cell.CELL_TYPE_STRING, Cell.CELL_TYPE_BOOLEAN, Cell.CELL_TYPE_ERROR + * Note: the cell's type remains as Cell.CELL_TYPE_FORMULA however. */ int evaluateFormulaCell(Cell cell); diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java index 576e0b8f81..112c1ff814 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -287,9 +287,9 @@ public class SXSSFWorkbook implements Workbook SheetDataWriter createSheetDataWriter() throws IOException { if(_compressTmpFiles) { return new GZIPSheetDataWriter(_sharedStringSource); - } else { - return new SheetDataWriter(_sharedStringSource); } + + return new SheetDataWriter(_sharedStringSource); } XSSFSheet getXSSFSheet(SXSSFSheet sheet) @@ -331,7 +331,6 @@ public class SXSSFWorkbook implements Workbook ZipOutputStream zos = new ZipOutputStream(out); try { - @SuppressWarnings("unchecked") Enumeration en = (Enumeration) zip.entries(); while (en.hasMoreElements()) { @@ -490,6 +489,7 @@ public class SXSSFWorkbook implements Workbook * * @return the index of the active sheet (0-based) */ + @Override public int getActiveSheetIndex() { return _wb.getActiveSheetIndex(); @@ -502,6 +502,7 @@ public class SXSSFWorkbook implements Workbook * * @param sheetIndex index of the active sheet (0-based) */ + @Override public void setActiveSheet(int sheetIndex) { _wb.setActiveSheet(sheetIndex); @@ -512,6 +513,7 @@ public class SXSSFWorkbook implements Workbook * * @return the first tab that to display in the list of tabs (0-based). */ + @Override public int getFirstVisibleTab() { return _wb.getFirstVisibleTab(); @@ -522,6 +524,7 @@ public class SXSSFWorkbook implements Workbook * * @param sheetIndex the first tab that to display in the list of tabs (0-based) */ + @Override public void setFirstVisibleTab(int sheetIndex) { _wb.setFirstVisibleTab(sheetIndex); @@ -533,6 +536,7 @@ public class SXSSFWorkbook implements Workbook * @param sheetname the name of the sheet to reorder * @param pos the position that we want to insert the sheet into (0 based) */ + @Override public void setSheetOrder(String sheetname, int pos) { _wb.setSheetOrder(sheetname,pos); @@ -547,6 +551,7 @@ public class SXSSFWorkbook implements Workbook * @see Sheet#setSelected(boolean) * @param index the index of the sheet to select (0 based) */ + @Override public void setSelectedTab(int index) { _wb.setSelectedTab(index); @@ -558,6 +563,7 @@ public class SXSSFWorkbook implements Workbook * @param sheet number (0 based) * @throws IllegalArgumentException if the name is greater than 31 chars or contains /\?*[] */ + @Override public void setSheetName(int sheet, String name) { _wb.setSheetName(sheet,name); @@ -569,6 +575,7 @@ public class SXSSFWorkbook implements Workbook * @param sheet sheet number (0 based) * @return Sheet name */ + @Override public String getSheetName(int sheet) { return _wb.getSheetName(sheet); @@ -580,6 +587,7 @@ public class SXSSFWorkbook implements Workbook * @param name the sheet name * @return index of the sheet (0 based) */ + @Override public int getSheetIndex(String name) { return _wb.getSheetIndex(name); @@ -591,6 +599,7 @@ public class SXSSFWorkbook implements Workbook * @param sheet the sheet to look up * @return index of the sheet (0 based) */ + @Override public int getSheetIndex(Sheet sheet) { return _wb.getSheetIndex(getXSSFSheet((SXSSFSheet)sheet)); @@ -602,6 +611,7 @@ public class SXSSFWorkbook implements Workbook * * @return Sheet representing the new sheet. */ + @Override public Sheet createSheet() { return createAndRegisterSXSSFSheet(_wb.createSheet()); @@ -629,6 +639,7 @@ public class SXSSFWorkbook implements Workbook * @return Sheet representing the new sheet. * @throws IllegalArgumentException if the name is greater than 31 chars or contains /\?*[] */ + @Override public Sheet createSheet(String sheetname) { return createAndRegisterSXSSFSheet(_wb.createSheet(sheetname)); @@ -639,6 +650,7 @@ public class SXSSFWorkbook implements Workbook * * @return Sheet representing the cloned sheet. */ + @Override public Sheet cloneSheet(int sheetNum) { throw new RuntimeException("NotImplemented"); @@ -650,6 +662,7 @@ public class SXSSFWorkbook implements Workbook * * @return the number of sheets */ + @Override public int getNumberOfSheets() { return _wb.getNumberOfSheets(); @@ -661,6 +674,7 @@ public class SXSSFWorkbook implements Workbook * @param index of the sheet number (0-based physical & logical) * @return Sheet at the provided index */ + @Override public Sheet getSheetAt(int index) { return getSXSSFSheet(_wb.getSheetAt(index)); @@ -672,6 +686,7 @@ public class SXSSFWorkbook implements Workbook * @param name of the sheet * @return Sheet with the name provided or null if it does not exist */ + @Override public Sheet getSheet(String name) { return getSXSSFSheet(_wb.getSheet(name)); @@ -682,6 +697,7 @@ public class SXSSFWorkbook implements Workbook * * @param index of the sheet to remove (0-based) */ + @Override public void removeSheetAt(int index) { XSSFSheet xSheet=_wb.getSheetAt(index); @@ -717,6 +733,8 @@ public class SXSSFWorkbook implements Workbook * @deprecated use {@link SXSSFSheet#setRepeatingRows(CellRangeAddress)} * or {@link SXSSFSheet#setRepeatingColumns(CellRangeAddress)} */ + @Deprecated + @Override public void setRepeatingRowsAndColumns(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow) { _wb.setRepeatingRowsAndColumns(sheetIndex,startColumn,endColumn,startRow,endRow); @@ -727,6 +745,7 @@ public class SXSSFWorkbook implements Workbook * * @return new font object */ + @Override public Font createFont() { return _wb.createFont(); @@ -737,6 +756,7 @@ public class SXSSFWorkbook implements Workbook * * @return the font with the matched attributes or null */ + @Override public Font findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) { return _wb.findFont(boldWeight, color, fontHeight, name, italic, strikeout, typeOffset, underline); @@ -748,6 +768,7 @@ public class SXSSFWorkbook implements Workbook * * @return number of fonts */ + @Override public short getNumberOfFonts() { return _wb.getNumberOfFonts(); @@ -759,6 +780,7 @@ public class SXSSFWorkbook implements Workbook * @param idx index number (0-based) * @return font at the index */ + @Override public Font getFontAt(short idx) { return _wb.getFontAt(idx); @@ -769,6 +791,7 @@ public class SXSSFWorkbook implements Workbook * * @return the new Cell Style object */ + @Override public CellStyle createCellStyle() { return _wb.createCellStyle(); @@ -779,6 +802,7 @@ public class SXSSFWorkbook implements Workbook * * @return count of cell styles */ + @Override public short getNumCellStyles() { return _wb.getNumCellStyles(); @@ -790,6 +814,7 @@ public class SXSSFWorkbook implements Workbook * @param idx index within the set of styles (0-based) * @return CellStyle object at the index */ + @Override public CellStyle getCellStyleAt(short idx) { return _wb.getCellStyleAt(idx); @@ -813,6 +838,7 @@ public class SXSSFWorkbook implements Workbook * @param stream - the java OutputStream you wish to write to * @exception IOException if anything can't be written. */ + @Override public void write(OutputStream stream) throws IOException { for (SXSSFSheet sheet : _xFromSxHash.values()) @@ -839,7 +865,9 @@ public class SXSSFWorkbook implements Workbook } finally { - tmplFile.delete(); + if(!tmplFile.delete()) { + throw new IOException("Could not delete temporary file after processing: " + tmplFile); + } } } @@ -861,6 +889,7 @@ public class SXSSFWorkbook implements Workbook /** * @return the total number of defined names in this workbook */ + @Override public int getNumberOfNames() { return _wb.getNumberOfNames(); @@ -870,6 +899,7 @@ public class SXSSFWorkbook implements Workbook * @param name the name of the defined name * @return the defined name with the specified name. null if not found. */ + @Override public Name getName(String name) { return _wb.getName(name); @@ -879,6 +909,7 @@ public class SXSSFWorkbook implements Workbook * @return the defined name at the specified index * @throws IllegalArgumentException if the supplied index is invalid */ + @Override public Name getNameAt(int nameIndex) { return _wb.getNameAt(nameIndex); @@ -889,6 +920,7 @@ public class SXSSFWorkbook implements Workbook * * @return new defined name object */ + @Override public Name createName() { return _wb.createName(); @@ -902,6 +934,7 @@ public class SXSSFWorkbook implements Workbook * @param name the name of the defined name * @return zero based index of the defined name. -1 if not found. */ + @Override public int getNameIndex(String name) { return _wb.getNameIndex(name); @@ -912,6 +945,7 @@ public class SXSSFWorkbook implements Workbook * * @param index named range index (0 based) */ + @Override public void removeName(int index) { _wb.removeName(index); @@ -922,6 +956,7 @@ public class SXSSFWorkbook implements Workbook * * @param name the name of the defined name */ + @Override public void removeName(String name) { _wb.removeName(name); @@ -934,6 +969,7 @@ public class SXSSFWorkbook implements Workbook * @param sheetIndex Zero-based sheet index (0 Represents the first sheet to keep consistent with java) * @param reference Valid name Reference for the Print Area */ + @Override public void setPrintArea(int sheetIndex, String reference) { _wb.setPrintArea(sheetIndex,reference); @@ -948,6 +984,7 @@ public class SXSSFWorkbook implements Workbook * @param startRow Row to begin the printarea * @param endRow Row to end the printarea */ + @Override public void setPrintArea(int sheetIndex, int startColumn, int endColumn, int startRow, int endRow) { _wb.setPrintArea(sheetIndex, startColumn, endColumn, startRow, endRow); @@ -960,6 +997,7 @@ public class SXSSFWorkbook implements Workbook * @param sheetIndex Zero-based sheet index (0 Represents the first sheet to keep consistent with java) * @return String Null if no print area has been defined */ + @Override public String getPrintArea(int sheetIndex) { return _wb.getPrintArea(sheetIndex); @@ -970,6 +1008,7 @@ public class SXSSFWorkbook implements Workbook * * @param sheetIndex Zero-based sheet index (0 = First Sheet) */ + @Override public void removePrintArea(int sheetIndex) { _wb.removePrintArea(sheetIndex); @@ -983,6 +1022,7 @@ public class SXSSFWorkbook implements Workbook * {@link MissingCellPolicy} *

*/ + @Override public MissingCellPolicy getMissingCellPolicy() { return _wb.getMissingCellPolicy(); @@ -996,6 +1036,7 @@ public class SXSSFWorkbook implements Workbook * {@link org.apache.poi.ss.usermodel.Row#getCell(int)}. See * {@link MissingCellPolicy} */ + @Override public void setMissingCellPolicy(MissingCellPolicy missingCellPolicy) { _wb.setMissingCellPolicy(missingCellPolicy); @@ -1006,6 +1047,7 @@ public class SXSSFWorkbook implements Workbook * * @return the DataFormat object */ + @Override public DataFormat createDataFormat() { return _wb.createDataFormat(); @@ -1025,6 +1067,7 @@ public class SXSSFWorkbook implements Workbook * @see #PICTURE_TYPE_PNG * @see #PICTURE_TYPE_DIB */ + @Override public int addPicture(byte[] pictureData, int format) { return _wb.addPicture(pictureData,format); @@ -1035,6 +1078,7 @@ public class SXSSFWorkbook implements Workbook * * @return the list of pictures (a list of {@link PictureData} objects.) */ + @Override public List getAllPictures() { return _wb.getAllPictures(); @@ -1044,6 +1088,7 @@ public class SXSSFWorkbook implements Workbook * Returns an object that handles instantiating concrete * classes of the various instances one needs for HSSF and XSSF. */ + @Override public CreationHelper getCreationHelper() { return _wb.getCreationHelper(); @@ -1052,6 +1097,7 @@ public class SXSSFWorkbook implements Workbook /** * @return false if this workbook is not visible in the GUI */ + @Override public boolean isHidden() { return _wb.isHidden(); @@ -1060,6 +1106,7 @@ public class SXSSFWorkbook implements Workbook /** * @param hiddenFlag pass false to make the workbook visible in the GUI */ + @Override public void setHidden(boolean hiddenFlag) { _wb.setHidden(hiddenFlag); @@ -1074,6 +1121,7 @@ public class SXSSFWorkbook implements Workbook * @param sheetIx Number * @return true if sheet is hidden */ + @Override public boolean isSheetHidden(int sheetIx) { return _wb.isSheetHidden(sheetIx); @@ -1088,6 +1136,7 @@ public class SXSSFWorkbook implements Workbook * @param sheetIx sheet index to check * @return true if sheet is very hidden */ + @Override public boolean isSheetVeryHidden(int sheetIx) { return _wb.isSheetVeryHidden(sheetIx); @@ -1099,6 +1148,7 @@ public class SXSSFWorkbook implements Workbook * @param sheetIx the sheet index (0-based) * @param hidden True to mark the sheet as hidden, false otherwise */ + @Override public void setSheetHidden(int sheetIx, boolean hidden) { _wb.setSheetHidden(sheetIx,hidden); @@ -1119,6 +1169,7 @@ public class SXSSFWorkbook implements Workbook * Workbook.SHEET_STATE_VERY_HIDDEN. * @throws IllegalArgumentException if the supplied sheet index or state is invalid */ + @Override public void setSheetHidden(int sheetIx, int hidden) { _wb.setSheetHidden(sheetIx,hidden); @@ -1128,6 +1179,7 @@ public class SXSSFWorkbook implements Workbook * * @param toopack the toolpack to register */ + @Override public void addToolPack(UDFFinder toopack) { _wb.addToolPack(toopack); @@ -1145,6 +1197,7 @@ public class SXSSFWorkbook implements Workbook * workbook values when the workbook is opened * @since 3.8 */ + @Override public void setForceFormulaRecalculation(boolean value){ _wb.setForceFormulaRecalculation(value); } @@ -1152,6 +1205,7 @@ public class SXSSFWorkbook implements Workbook /** * Whether Excel will be asked to recalculate all formulas when the workbook is opened. */ + @Override public boolean getForceFormulaRecalculation(){ return _wb.getForceFormulaRecalculation(); } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java index ce217e2344..e29dded8eb 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java @@ -19,11 +19,7 @@ package org.apache.poi.xssf.streaming; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import java.io.File; import java.io.FileOutputStream; @@ -238,7 +234,6 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook { assertEquals("value?", cell.getStringCellValue()); assertTrue(wb.dispose()); - } @Test @@ -315,16 +310,18 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook { } @Test - public void workbookDispose() + public void workbookDispose() throws IOException { SXSSFWorkbook wb = new SXSSFWorkbook(); // the underlying writer is SheetDataWriter assertWorkbookDispose(wb); - + wb.close(); + wb = new SXSSFWorkbook(); wb.setCompressTempFiles(true); // the underlying writer is GZIPSheetDataWriter assertWorkbookDispose(wb); + wb.close(); } @@ -334,9 +331,12 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook { Workbook wb = new SXSSFWorkbook(10); populateWorkbook(wb); saveTwice(wb); + wb.close(); + wb = new XSSFWorkbook(); populateWorkbook(wb); saveTwice(wb); + wb.close(); } // Crashes the JVM because of documented JVM behavior with concurrent writing/reading of zip-files @@ -371,6 +371,7 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook { } finally { assertTrue(wb.dispose()); } + wb.close(); } out.delete(); } @@ -404,6 +405,30 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook { private static class NullOutputStream extends OutputStream { @Override public void write(int b) throws IOException { + // nothing to do here } } + + @Test + public void testBug54523() throws IOException { + SXSSFWorkbook wb = new SXSSFWorkbook(100); + Sheet sh = wb.createSheet(); + + for (int i = 0; i < 81000; i++) { + Row row = sh.createRow(i); + for (int j = 0; j < 1000; j++) { + Cell cell = row.createCell(j); + cell.setCellValue("dddd"); + } + if (i % 100 == 0){ + System.out.println("x - " + i); + } + } + + FileOutputStream out = new FileOutputStream("C:\\temp\\54523_large.xlsx"); + wb.write(out); + out.close(); + wb.dispose(); + wb.close(); + } } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java index 81f9ce8119..fc366900ab 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java @@ -17,9 +17,15 @@ package org.apache.poi.xssf.usermodel; +import java.util.ArrayList; +import java.util.List; + import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.usermodel.BaseTestRow; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.XSSFITestDataProvider; +import org.apache.poi.xssf.XSSFTestDataSamples; /** * Tests for XSSFRow @@ -37,4 +43,48 @@ public final class TestXSSFRow extends BaseTestRow { public void testCellBounds() { baseTestCellBounds(SpreadsheetVersion.EXCEL2007.getLastColumnIndex()); } + + public void test56490() { + XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("56490.xlsx"); + XSSFSheet sheet = wb.getSheetAt(0); + + String columnWanted = "Link"; + Integer columnNo = null; + List cells = new ArrayList(); + + // TODO: change this!! + assertEquals(-1, sheet.getFirstRowNum()); + assertEquals(-1, sheet.getLastRowNum()); + + Row firstRow = sheet.getRow(-1); + assertNotNull(firstRow); + assertNotNull(firstRow.iterator()); + + for(Row row : sheet) { + for(Cell cell : row) { + System.out.println("Cell in Row: " + row.getRowNum() + ": " + cell.toString()); + } + } + + for (Cell cell : firstRow) { + if (cell.getStringCellValue().equals(columnWanted)) { + columnNo = cell.getColumnIndex(); + } + } + + if (columnNo != null) { + for (Row row : sheet) { + Cell c = row.getCell(columnNo); + if (c == null || c.getCellType() == Cell.CELL_TYPE_BLANK) { + } else { + cells.add(c); + } + + } + + } else { + System.out.println("could not find column" + columnWanted + + "in first row"); + } + } } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java index fd41ac6721..543f14eedc 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java @@ -17,13 +17,7 @@ package org.apache.poi.xssf.usermodel; -import static org.junit.Assert.assertEquals; -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.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import java.io.ByteArrayOutputStream; import java.io.File; @@ -42,17 +36,7 @@ import org.apache.poi.openxml4j.opc.PackagePartName; import org.apache.poi.openxml4j.opc.PackagingURIHelper; import org.apache.poi.openxml4j.opc.internal.MemoryPackagePart; import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart; - -import org.apache.poi.ss.usermodel.BaseTestWorkbook; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.IndexedColors; -import org.apache.poi.ss.usermodel.RichTextString; -import org.apache.poi.ss.usermodel.Row; -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.usermodel.*; import org.apache.poi.ss.util.AreaReference; import org.apache.poi.ss.util.CellReference; import org.apache.poi.util.IOUtils; @@ -768,4 +752,20 @@ public final class TestXSSFWorkbook extends BaseTestWorkbook { setPivotData(wb2); assertTrue(wb2.getPivotTables().size() == 2); } + + @Test + public void testBug55644() throws IOException { + XSSFWorkbook wb = new XSSFWorkbook(); + XSSFSheet sheet = wb.createSheet("students"); + XSSFRow row = sheet.createRow(1); + XSSFCell cell = row.createCell(1); + cell.setCellValue("sandeepzzzzzzzzzzzzzzzzzzzzzzzzz"); + sheet.autoSizeColumn(1); + + FileOutputStream fileOut = new FileOutputStream("C:\\temp\\55644.xlsx"); + wb.write(fileOut); + fileOut.close(); + + wb.close(); + } } diff --git a/src/testcases/org/apache/poi/POIDataSamples.java b/src/testcases/org/apache/poi/POIDataSamples.java index a62e664e1e..3fb82b90a6 100644 --- a/src/testcases/org/apache/poi/POIDataSamples.java +++ b/src/testcases/org/apache/poi/POIDataSamples.java @@ -196,9 +196,11 @@ public final class POIDataSamples { _sampleDataIsAvaliableOnClassPath = true; return; } + + dataDirName = "test-data"; - throw new RuntimeException("Must set system property '" + - TEST_PROPERTY + "' before running tests"); + /*throw new RuntimeException("Must set system property '" + + TEST_PROPERTY + "' before running tests");*/ } File dataDir = new File(dataDirName, _moduleDir); if (!dataDir.exists()) { diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java b/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java index bd874629f8..93bdcd37bc 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java @@ -26,6 +26,7 @@ import java.util.Date; import junit.framework.TestCase; import org.apache.poi.hssf.HSSFTestDataSamples; +import org.apache.poi.hssf.dev.BiffViewer; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Row; @@ -126,7 +127,7 @@ public final class TestCellStyle extends TestCase { assertEquals("LAST ROW ", 0, s.getLastRowNum()); assertEquals("FIRST ROW ", 0, s.getFirstRowNum()); } - + public void testHashEquals() { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet s = wb.createSheet(); @@ -135,21 +136,21 @@ public final class TestCellStyle extends TestCase { HSSFRow row = s.createRow(0); HSSFCell cell1 = row.createCell(1); HSSFCell cell2 = row.createCell(2); - + cs1.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy")); cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/dd/yy")); - + cell1.setCellStyle(cs1); cell1.setCellValue(new Date()); - + cell2.setCellStyle(cs2); cell2.setCellValue(new Date()); - + assertEquals(cs1.hashCode(), cs1.hashCode()); assertEquals(cs2.hashCode(), cs2.hashCode()); assertTrue(cs1.equals(cs1)); assertTrue(cs2.equals(cs2)); - + // Change cs1, hash will alter int hash1 = cs1.hashCode(); cs1.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/dd/yy")); @@ -210,7 +211,7 @@ public final class TestCellStyle extends TestCase { assertEquals("LAST ROW == 99", 99, s.getLastRowNum()); assertEquals("FIRST ROW == 0", 0, s.getFirstRowNum()); } - + /** * Cloning one HSSFCellStyle onto Another, same * HSSFWorkbook @@ -220,63 +221,63 @@ public final class TestCellStyle extends TestCase { HSSFFont fnt = wb.createFont(); fnt.setFontName("TestingFont"); assertEquals(5, wb.getNumberOfFonts()); - + HSSFCellStyle orig = wb.createCellStyle(); orig.setAlignment(HSSFCellStyle.ALIGN_RIGHT); orig.setFont(fnt); orig.setDataFormat((short)18); - + assertTrue(HSSFCellStyle.ALIGN_RIGHT == orig.getAlignment()); assertTrue(fnt == orig.getFont(wb)); assertTrue(18 == orig.getDataFormat()); - + HSSFCellStyle clone = wb.createCellStyle(); assertFalse(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment()); assertFalse(fnt == clone.getFont(wb)); assertFalse(18 == clone.getDataFormat()); - + clone.cloneStyleFrom(orig); assertTrue(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment()); assertTrue(fnt == clone.getFont(wb)); assertTrue(18 == clone.getDataFormat()); assertEquals(5, wb.getNumberOfFonts()); } - + /** * Cloning one HSSFCellStyle onto Another, across * two different HSSFWorkbooks */ public void testCloneStyleDiffWB() { HSSFWorkbook wbOrig = new HSSFWorkbook(); - + HSSFFont fnt = wbOrig.createFont(); fnt.setFontName("TestingFont"); assertEquals(5, wbOrig.getNumberOfFonts()); - + HSSFDataFormat fmt = wbOrig.createDataFormat(); fmt.getFormat("MadeUpOne"); fmt.getFormat("MadeUpTwo"); - + HSSFCellStyle orig = wbOrig.createCellStyle(); orig.setAlignment(HSSFCellStyle.ALIGN_RIGHT); orig.setFont(fnt); orig.setDataFormat(fmt.getFormat("Test##")); - + assertTrue(HSSFCellStyle.ALIGN_RIGHT == orig.getAlignment()); assertTrue(fnt == orig.getFont(wbOrig)); assertTrue(fmt.getFormat("Test##") == orig.getDataFormat()); - + // Now a style on another workbook HSSFWorkbook wbClone = new HSSFWorkbook(); assertEquals(4, wbClone.getNumberOfFonts()); HSSFDataFormat fmtClone = wbClone.createDataFormat(); - + HSSFCellStyle clone = wbClone.createCellStyle(); assertEquals(4, wbClone.getNumberOfFonts()); - + assertFalse(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment()); assertFalse("TestingFont" == clone.getFont(wbClone).getFontName()); - + clone.cloneStyleFrom(orig); assertTrue(HSSFCellStyle.ALIGN_RIGHT == clone.getAlignment()); assertTrue("TestingFont" == clone.getFont(wbClone).getFontName()); @@ -284,47 +285,47 @@ public final class TestCellStyle extends TestCase { assertFalse(fmtClone.getFormat("Test##") == fmt.getFormat("Test##")); assertEquals(5, wbClone.getNumberOfFonts()); } - + public void testStyleNames() { HSSFWorkbook wb = openSample("WithExtendedStyles.xls"); HSSFSheet s = wb.getSheetAt(0); HSSFCell c1 = s.getRow(0).getCell(0); HSSFCell c2 = s.getRow(1).getCell(0); HSSFCell c3 = s.getRow(2).getCell(0); - + HSSFCellStyle cs1 = c1.getCellStyle(); HSSFCellStyle cs2 = c2.getCellStyle(); HSSFCellStyle cs3 = c3.getCellStyle(); - + assertNotNull(cs1); assertNotNull(cs2); assertNotNull(cs3); - + // Check we got the styles we'd expect assertEquals(10, cs1.getFont(wb).getFontHeightInPoints()); assertEquals(9, cs2.getFont(wb).getFontHeightInPoints()); assertEquals(12, cs3.getFont(wb).getFontHeightInPoints()); - + assertEquals(15, cs1.getIndex()); assertEquals(23, cs2.getIndex()); assertEquals(24, cs3.getIndex()); - + assertNull(cs1.getParentStyle()); assertNotNull(cs2.getParentStyle()); assertNotNull(cs3.getParentStyle()); - + assertEquals(21, cs2.getParentStyle().getIndex()); assertEquals(22, cs3.getParentStyle().getIndex()); - - // Now check we can get style records for + + // Now check we can get style records for // the parent ones assertNull(wb.getWorkbook().getStyleRecord(15)); assertNull(wb.getWorkbook().getStyleRecord(23)); assertNull(wb.getWorkbook().getStyleRecord(24)); - + assertNotNull(wb.getWorkbook().getStyleRecord(21)); assertNotNull(wb.getWorkbook().getStyleRecord(22)); - + // Now check the style names assertEquals(null, cs1.getUserStyleName()); assertEquals(null, cs2.getUserStyleName()); @@ -337,47 +338,112 @@ public final class TestCellStyle extends TestCase { c4.setCellStyle(cs2); assertEquals("style1", c4.getCellStyle().getParentStyle().getUserStyleName()); } - + public void testGetSetBorderHair() { HSSFWorkbook wb = openSample("55341_CellStyleBorder.xls"); HSSFSheet s = wb.getSheetAt(0); HSSFCellStyle cs; - cs = s.getRow(0).getCell(0).getCellStyle(); - assertEquals(CellStyle.BORDER_HAIR, cs.getBorderRight()); + cs = s.getRow(0).getCell(0).getCellStyle(); + assertEquals(CellStyle.BORDER_HAIR, cs.getBorderRight()); - cs = s.getRow(1).getCell(1).getCellStyle(); - assertEquals(CellStyle.BORDER_DOTTED, cs.getBorderRight()); + cs = s.getRow(1).getCell(1).getCellStyle(); + assertEquals(CellStyle.BORDER_DOTTED, cs.getBorderRight()); - cs = s.getRow(2).getCell(2).getCellStyle(); - assertEquals(CellStyle.BORDER_DASH_DOT_DOT, cs.getBorderRight()); + cs = s.getRow(2).getCell(2).getCellStyle(); + assertEquals(CellStyle.BORDER_DASH_DOT_DOT, cs.getBorderRight()); - cs = s.getRow(3).getCell(3).getCellStyle(); - assertEquals(CellStyle.BORDER_DASHED, cs.getBorderRight()); + cs = s.getRow(3).getCell(3).getCellStyle(); + assertEquals(CellStyle.BORDER_DASHED, cs.getBorderRight()); - cs = s.getRow(4).getCell(4).getCellStyle(); - assertEquals(CellStyle.BORDER_THIN, cs.getBorderRight()); + cs = s.getRow(4).getCell(4).getCellStyle(); + assertEquals(CellStyle.BORDER_THIN, cs.getBorderRight()); - cs = s.getRow(5).getCell(5).getCellStyle(); - assertEquals(CellStyle.BORDER_MEDIUM_DASH_DOT_DOT, cs.getBorderRight()); + cs = s.getRow(5).getCell(5).getCellStyle(); + assertEquals(CellStyle.BORDER_MEDIUM_DASH_DOT_DOT, cs.getBorderRight()); - cs = s.getRow(6).getCell(6).getCellStyle(); - assertEquals(CellStyle.BORDER_SLANTED_DASH_DOT, cs.getBorderRight()); + cs = s.getRow(6).getCell(6).getCellStyle(); + assertEquals(CellStyle.BORDER_SLANTED_DASH_DOT, cs.getBorderRight()); - cs = s.getRow(7).getCell(7).getCellStyle(); - assertEquals(CellStyle.BORDER_MEDIUM_DASH_DOT, cs.getBorderRight()); + cs = s.getRow(7).getCell(7).getCellStyle(); + assertEquals(CellStyle.BORDER_MEDIUM_DASH_DOT, cs.getBorderRight()); - cs = s.getRow(8).getCell(8).getCellStyle(); - assertEquals(CellStyle.BORDER_MEDIUM_DASHED, cs.getBorderRight()); + cs = s.getRow(8).getCell(8).getCellStyle(); + assertEquals(CellStyle.BORDER_MEDIUM_DASHED, cs.getBorderRight()); - cs = s.getRow(9).getCell(9).getCellStyle(); - assertEquals(CellStyle.BORDER_MEDIUM, cs.getBorderRight()); + cs = s.getRow(9).getCell(9).getCellStyle(); + assertEquals(CellStyle.BORDER_MEDIUM, cs.getBorderRight()); - cs = s.getRow(10).getCell(10).getCellStyle(); - assertEquals(CellStyle.BORDER_THICK, cs.getBorderRight()); + cs = s.getRow(10).getCell(10).getCellStyle(); + assertEquals(CellStyle.BORDER_THICK, cs.getBorderRight()); - cs = s.getRow(11).getCell(11).getCellStyle(); - assertEquals(CellStyle.BORDER_DOUBLE, cs.getBorderRight()); + cs = s.getRow(11).getCell(11).getCellStyle(); + assertEquals(CellStyle.BORDER_DOUBLE, cs.getBorderRight()); + } + + public void testBug54894() throws IOException { + HSSFWorkbook wb = new HSSFWorkbook(); + HSSFSheet sheet = wb.createSheet("new sheet"); + + // Create a row and put some cells in it. Rows are 0 based. + HSSFRow row = sheet.createRow(1); + + // Create a cell and put a value in it. + HSSFCell cell = row.createCell(1); + cell.setCellValue(4); + + CellStyle def = cell.getCellStyle(); + + String filenameB = "C:\\temp\\54894B.xls"; + FileOutputStream fileOut = new FileOutputStream(filenameB); + try { + wb.write(fileOut); + } finally { + fileOut.close(); + } + + // Style the cell with borders all around. + HSSFCellStyle style = wb.createCellStyle(); + style.cloneStyleFrom(def); + + String filenameM = "C:\\temp\\54894M.xls"; + fileOut = new FileOutputStream(filenameM); + try { + wb.write(fileOut); + } finally { + fileOut.close(); + } + + style.setBorderBottom(HSSFCellStyle.BORDER_THIN); + + cell.setCellStyle(style); + + String filenameM1 = "C:\\temp\\54894M1.xls"; + fileOut = new FileOutputStream(filenameM1); + try { + wb.write(fileOut); + } finally { + fileOut.close(); + } + + // Write the output to a file + String filename = "C:\\temp\\54894.xls"; + fileOut = new FileOutputStream(filename); + try { + wb.write(fileOut); + } finally { + fileOut.close(); + } + + /*Runtime.getRuntime().exec(new String[] {"cmd", "/c", "start", filenameB}); + Runtime.getRuntime().exec(new String[] {"cmd", "/c", "start", filenameM}); + Runtime.getRuntime().exec(new String[] {"cmd", "/c", "start", filenameM1}); + Runtime.getRuntime().exec(new String[] {"cmd", "/c", "start", filename});*/ + + System.out.println("testfile M"); + BiffViewer.main(new String[] {filenameM}); + System.out.println("testfile M1"); + BiffViewer.main(new String[] {filenameM1}); } public void testShrinkToFit() { @@ -449,7 +515,7 @@ public final class TestCellStyle extends TestCase { public Throwable getException() { return exception; } - }; + } public void test56563() throws Throwable { CellFormatBugExample threadA = new CellFormatBugExample("56563a.xls"); diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestComment.java b/src/testcases/org/apache/poi/hssf/usermodel/TestComment.java index cac444baef..7db79d848b 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestComment.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestComment.java @@ -17,20 +17,37 @@ package org.apache.poi.hssf.usermodel; +import static org.junit.Assert.assertArrayEquals; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Arrays; + import junit.framework.TestCase; -import org.apache.poi.ddf.EscherSpRecord; + import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.model.CommentShape; import org.apache.poi.hssf.model.HSSFTestModelHelper; -import org.apache.poi.hssf.record.*; - -import java.io.*; -import java.util.Arrays; +import org.apache.poi.hssf.record.CommonObjectDataSubRecord; +import org.apache.poi.hssf.record.EscherAggregate; +import org.apache.poi.hssf.record.NoteRecord; +import org.apache.poi.hssf.record.ObjRecord; +import org.apache.poi.hssf.record.TextObjectRecord; +import org.apache.poi.ss.usermodel.Cell; +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.RichTextString; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; /** * @author Evgeniy Berlog * @date 26.06.12 */ +@SuppressWarnings("deprecation") public class TestComment extends TestCase { public void testResultEqualsToAbstractShape() { @@ -53,25 +70,25 @@ public class TestComment extends TestCase { byte[] actual = comment.getEscherContainer().getChild(0).serialize(); assertEquals(expected.length, actual.length); - assertTrue(Arrays.equals(expected, actual)); + assertArrayEquals(expected, actual); expected = commentShape.getSpContainer().getChild(2).serialize(); actual = comment.getEscherContainer().getChild(2).serialize(); assertEquals(expected.length, actual.length); - assertTrue(Arrays.equals(expected, actual)); + assertArrayEquals(expected, actual); expected = commentShape.getSpContainer().getChild(3).serialize(); actual = comment.getEscherContainer().getChild(3).serialize(); assertEquals(expected.length, actual.length); - assertTrue(Arrays.equals(expected, actual)); + assertArrayEquals(expected, actual); expected = commentShape.getSpContainer().getChild(4).serialize(); actual = comment.getEscherContainer().getChild(4).serialize(); assertEquals(expected.length, actual.length); - assertTrue(Arrays.equals(expected, actual)); + assertArrayEquals(expected, actual); ObjRecord obj = comment.getObjRecord(); ObjRecord objShape = commentShape.getObjRecord(); @@ -88,7 +105,7 @@ public class TestComment extends TestCase { actual = torShape.serialize(); assertEquals(expected.length, actual.length); - assertTrue(Arrays.equals(expected, actual)); + assertArrayEquals(expected, actual); NoteRecord note = comment.getNoteRecord(); NoteRecord noteShape = commentShape.getNoteRecord(); @@ -98,7 +115,10 @@ public class TestComment extends TestCase { actual = noteShape.serialize(); assertEquals(expected.length, actual.length); - assertTrue(Arrays.equals(expected, actual)); + assertTrue( + "\nHad: " + Arrays.toString(actual) + + "\n Expected: " + Arrays.toString(expected), + Arrays.equals(expected, actual)); } public void testAddToExistingFile() { @@ -240,6 +260,7 @@ public class TestComment extends TestCase { assertEquals(agg.getTailRecords().size(), 1); HSSFSimpleShape shape = patriarch.createSimpleShape(new HSSFClientAnchor()); + assertNotNull(shape); assertEquals(comment.getOptRecord().getEscherProperties().size(), 10); } @@ -260,12 +281,12 @@ public class TestComment extends TestCase { assertEquals(comment.getShapeId(), 2024); - CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) comment.getObjRecord().getSubRecords().get(0); - assertEquals(cod.getObjectId(), 1000); + /*CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) comment.getObjRecord().getSubRecords().get(0); + assertEquals(2024, cod.getObjectId()); EscherSpRecord spRecord = (EscherSpRecord) comment.getEscherContainer().getChild(0); assertEquals(spRecord.getShapeId(), 2024); assertEquals(comment.getShapeId(), 2024); - assertEquals(comment.getNoteRecord().getShapeId(), 1000); + assertEquals(2024, comment.getNoteRecord().getShapeId());*/ } public void testAttemptToSave2CommentsWithSameCoordinates(){ @@ -285,4 +306,116 @@ public class TestComment extends TestCase { } assertNotNull(err); } + + + public void testBug56380InsertComments() throws Exception { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet sheet = workbook.createSheet(); + Drawing drawing = sheet.createDrawingPatriarch(); + int noOfRows = 3000; + String comment = "c"; + + for(int i = 0; i < noOfRows; i++) { + Row row = sheet.createRow(i); + Cell cell = row.createCell(0); + insertComment(drawing, cell, comment + i); + } + + // assert that the comments are created properly before writing + checkComments(sheet, noOfRows, comment); + + System.out.println("Listing comments before write"); + listComments(sheet.getDrawingPatriarch()); + + assertEquals(noOfRows, sheet.getDrawingPatriarch().getChildren().size()); + + // store in temp-file + File file = new File(System.getProperty("java.io.tmpdir") + File.separatorChar + "test_comments.xls"); + FileOutputStream fs = new FileOutputStream(file); + try { + sheet.getWorkbook().write(fs); + } finally { + fs.close(); + } + + // save and recreate the workbook from the saved file + workbook = HSSFTestDataSamples.writeOutAndReadBack(workbook); + sheet = workbook.getSheetAt(0); + + // recreate the workbook from the saved file + /*FileInputStream fi = new FileInputStream(file); + try { + sheet = new HSSFWorkbook(fi).getSheetAt(0); + } finally { + fi.close(); + }*/ + + System.out.println("Listing comments after read"); + listComments(sheet.getDrawingPatriarch()); + + assertEquals(noOfRows, sheet.getDrawingPatriarch().getChildren().size()); + + // store file after + file = new File(System.getProperty("java.io.tmpdir") + File.separatorChar + "test_comments_after.xls"); + fs = new FileOutputStream(file); + try { + sheet.getWorkbook().write(fs); + } finally { + fs.close(); + } + + // assert that the comments are created properly after reading back in + //checkComments(sheet, noOfRows, comment); + } + + private void listComments(HSSFShapeContainer container) { + for (Object object : container.getChildren()) { + HSSFShape shape = (HSSFShape) object; + if (shape instanceof HSSFShapeGroup) { + listComments((HSSFShapeContainer) shape); + continue; + } + if (shape instanceof HSSFComment) { + HSSFComment comment = (HSSFComment) shape; + System.out.println("Comment " + comment.getString().getString() + " at " + comment.getColumn() + "/" + comment.getRow()); + } + } + } + + private void checkComments(Sheet sheet, int noOfRows, String commentStr) { + for(int i = 0; i < noOfRows; i++) { + assertNotNull(sheet.getRow(i)); + Cell cell = sheet.getRow(i).getCell(0); + assertNotNull(cell); + Comment comment = cell.getCellComment(); + assertNotNull("Did not get a Cell Comment for row " + i, comment); + assertNotNull(comment.getString()); + + assertEquals(i, comment.getRow()); + assertEquals(0,comment.getColumn()); + + assertEquals(commentStr + i, comment.getString().getString()); + } + } + + private void insertComment(Drawing drawing, Cell cell, String message) { + CreationHelper factory = cell.getSheet().getWorkbook().getCreationHelper(); + + ClientAnchor anchor = factory.createClientAnchor(); + anchor.setCol1(cell.getColumnIndex()); + anchor.setCol2(cell.getColumnIndex() + 1); + anchor.setRow1(cell.getRowIndex()); + anchor.setRow2(cell.getRowIndex() + 1); + anchor.setDx1(100); + anchor.setDx2(100); + anchor.setDy1(100); + anchor.setDy2(100); + + Comment comment = drawing.createCellComment(anchor); + + RichTextString str = factory.createRichTextString(message); + comment.setString(str); + comment.setAuthor("fanfy"); + cell.setCellComment(comment); + } } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java index a37751dec3..70e04f6362 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java @@ -17,12 +17,7 @@ package org.apache.poi.hssf.usermodel; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -55,8 +50,13 @@ import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.ss.formula.ptg.Area3DPtg; import org.apache.poi.ss.usermodel.BaseTestWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.FormulaEvaluator; import org.apache.poi.ss.usermodel.Name; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellUtil; import org.apache.poi.util.LittleEndian; import org.apache.poi.util.TempFile; import org.junit.Test; @@ -1070,4 +1070,71 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook { private void expectName(HSSFWorkbook wb, String name, String expect) { assertEquals(expect, wb.getName(name).getRefersToFormula()); } + + @Test + public void test55747() throws IOException { + HSSFWorkbook wb = new HSSFWorkbook(); + Sheet sheet =wb.createSheet("Test1"); + Row row =sheet.createRow(0); + CellUtil.createCell(row, 0, "Hello world."); + row = sheet.createRow(1); + Cell cell = row.createCell(0); + cell.setCellType(Cell.CELL_TYPE_FORMULA); + cell.setCellFormula("IF(ISBLANK(A1),\" not blank a1\",CONCATENATE(A1,\" - %%s.\"))"); + + Cell cell2 = row.createCell(1); + cell2.setCellType(Cell.CELL_TYPE_FORMULA); + cell2.setCellFormula("CONCATENATE(A1,\" - %%s.\")"); + + Cell cell3 = row.createCell(2); + cell3.setCellType(Cell.CELL_TYPE_FORMULA); + cell3.setCellFormula("ISBLANK(A1)"); + + wb.setForceFormulaRecalculation(true); + + FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); + for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) { + sheet = wb.getSheetAt(sheetNum); + for(Row r : sheet) { + for(Cell c : r) { + if(c.getCellType() == Cell.CELL_TYPE_FORMULA) { + evaluator.evaluateFormulaCell(c); + } + } + } + } + + cell = row.getCell(0); + assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType()); + assertEquals("IF(ISBLANK(A1),\" not blank a1\",CONCATENATE(A1,\" - %%s.\"))", cell.getCellFormula()); + assertEquals("Hello world. - %%s.", cell.getStringCellValue()); + + cell2 = row.getCell(1); + assertEquals(Cell.CELL_TYPE_FORMULA, cell2.getCellType()); + assertEquals("CONCATENATE(A1,\" - %%s.\")", cell2.getCellFormula()); + assertEquals("Hello world. - %%s.", cell2.getStringCellValue()); + + FileOutputStream stream = new FileOutputStream( "C:/temp/55747.xls"); + try { + wb.write(stream); + } finally { + stream.close(); + } + + HSSFWorkbook wbBack = HSSFTestDataSamples.writeOutAndReadBack(wb); + Sheet sheetBack = wb.getSheetAt(0); + Row rowBack = sheetBack.getRow(1); + + cell = rowBack.getCell(0); + assertEquals(Cell.CELL_TYPE_FORMULA, cell.getCellType()); + assertEquals("IF(ISBLANK(A1),\" not blank a1\",CONCATENATE(A1,\" - %%s.\"))", cell.getCellFormula()); + assertEquals("Hello world. - %%s.", cell.getStringCellValue()); + + cell2 = rowBack.getCell(1); + assertEquals(Cell.CELL_TYPE_FORMULA, cell2.getCellType()); + assertEquals("CONCATENATE(A1,\" - %%s.\")", cell2.getCellFormula()); + assertEquals("Hello world. - %%s.", cell2.getStringCellValue()); + wbBack.close(); + wb.close(); + } } diff --git a/test-data/spreadsheet/SampleSS.xlsx b/test-data/spreadsheet/SampleSS.xlsx index b94809ebc9e43f4877dfc89d9da4e53d1c6822e3..2250f17e0af225ecbf2567a7aa482add16198749 100644 GIT binary patch literal 7146 zcmbVRbzD?yx29XVk?!v9?(UK<=|)nz1_nt%x>M-}Nl6K5kWoS!hmfudp6`Bgyyy7G zUGsbQ%pbGX-tT%=z0X!tgoeR}KtMo%z-d*Nf_Nmz_rFcttQ_1~Sst!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