From: Yegor Kozlov
* To create a new Conditional Formatting set use the following approach:
*
diff --git a/src/java/org/apache/poi/ss/usermodel/SheetConditionalFormatting.java b/src/java/org/apache/poi/ss/usermodel/SheetConditionalFormatting.java
index 37387c8da1..e20a8f74b6 100644
--- a/src/java/org/apache/poi/ss/usermodel/SheetConditionalFormatting.java
+++ b/src/java/org/apache/poi/ss/usermodel/SheetConditionalFormatting.java
@@ -46,7 +46,7 @@ public interface SheetConditionalFormatting {
*
* @param regions - list of rectangular regions to apply conditional formatting rules
* @param rule1 - the first rule
- * @param rule1 - the second rule
+ * @param rule2 - the second rule
*
* @return index of the newly created Conditional Formatting object
*/
diff --git a/src/java/org/apache/poi/ss/usermodel/Workbook.java b/src/java/org/apache/poi/ss/usermodel/Workbook.java
index 3ee44fdc1f..ce117f4cde 100644
--- a/src/java/org/apache/poi/ss/usermodel/Workbook.java
+++ b/src/java/org/apache/poi/ss/usermodel/Workbook.java
@@ -129,13 +129,15 @@ public interface Workbook {
/**
* Set the sheet name.
- *
+ *
+ * See {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)}
+ * for a safe way to create valid names
+ *
+ * See {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)} + * for a safe way to create valid names + *
* @param sheetname sheetname to set for the sheet. * @return Sheet representing the new sheet. * @throws IllegalArgumentException if the name is null or invalid * or workbook already contains a sheet with this name - * @see {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)} - * for a safe way to create valid names + * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal) */ Sheet createSheet(String sheetname); diff --git a/src/java/org/apache/poi/util/LittleEndian.java b/src/java/org/apache/poi/util/LittleEndian.java index bf654baa07..c07c4beb30 100644 --- a/src/java/org/apache/poi/util/LittleEndian.java +++ b/src/java/org/apache/poi/util/LittleEndian.java @@ -573,7 +573,7 @@ public class LittleEndian implements LittleEndianConsts * * @param data * the byte array - * @param offset + * @param startOffset * a starting offset into the byte array * @param value * the short (16-bit) values diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java index b46ae8b2bc..1d3ed4e11e 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/RenderableShape.java @@ -65,7 +65,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; -import java.util.List; /** * Encapsulates logic to translate DrawingML objects to Java2D @@ -142,10 +141,10 @@ class RenderableShape { String blipId = blip.getEmbed(); PackageRelationship rel = parentPart.getRelationship(blipId); if (rel != null) { - XSLFImageRendener renderer = null; + XSLFImageRenderer renderer = null; if (graphics != null) - renderer = (XSLFImageRendener) graphics.getRenderingHint(XSLFRenderingHint.IMAGE_RENDERER); - if (renderer == null) renderer = new XSLFImageRendener(); + renderer = (XSLFImageRenderer) graphics.getRenderingHint(XSLFRenderingHint.IMAGE_RENDERER); + if (renderer == null) renderer = new XSLFImageRenderer(); try { BufferedImage img = renderer.readImage(parentPart.getRelatedPart(rel)); diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java index 3f7d88b870..4018d4d214 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFConnectorShape.java @@ -77,8 +77,7 @@ public class XSLFConnectorShape extends XSLFSimpleShape { /** - * YK: dashing of lines is suppressed for now. - * @return + * YK: shadows of lines are suppressed for now. */ @Override public XSLFShadow getShadow() { diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFontManager.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFontManager.java index e61933fb37..cc5fc6c2d5 100644 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFontManager.java +++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFFontManager.java @@ -29,7 +29,7 @@ public interface XSLFFontManager { /** * select a font to be used to paint text * - * @param family the font family as defined in the .pptx file. + * @param typeface the font family as defined in the .pptx file. * This can be unknown or missing in the graphic environment. * * @return the font to be used to paint text diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFImageRendener.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFImageRendener.java deleted file mode 100644 index 06ba185135..0000000000 --- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFImageRendener.java +++ /dev/null @@ -1,108 +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.xslf.usermodel; - -import org.apache.poi.openxml4j.opc.PackagePart; -import org.apache.poi.util.Beta; - -import javax.imageio.ImageIO; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.geom.AffineTransform; -import java.awt.geom.Rectangle2D; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * For now this class renders only images supported by the javax.imageio.ImageIO - * framework. Subclasses can override this class to support other formats, for - * example, Use Apache batik to render WMF: - * - *
- *
- * @Override
- * public class MyImageRendener extends XSLFImageRendener{
- * public boolean drawImage(Graphics2D graphics, XSLFPictureData data, Rectangle2D anchor){
- * boolean ok = super.drawImage(graphics, data, anchor);
- * if(!ok){
- * // see what type of image we are
- * String contentType = data.getPackagePart().getContentType();
- * if(contentType.equals("image/wmf")){
- * // use Apache Batik to handle WMF
- * // see http://xmlgraphics.apache.org/batik/
- * }
- *
- * }
- * return ok;
- * }
- * }
- *
- *
- *
- * and then pass this class to your instance of java.awt.Graphics2D:
- *
- *
- *
- * graphics.setRenderingHint(XSLFRenderingHint.IMAGE_RENDERER, new MyImageRendener());
- *
- *
- *
- * @author Yegor Kozlov
- */
-@Beta
-public class XSLFImageRendener {
-
- /**
- * Render picture data into the supplied graphics
- *
- * @return true if the picture data was succesfully renderered
- */
- public boolean drawImage(Graphics2D graphics, XSLFPictureData data,
- Rectangle2D anchor) {
- try {
- BufferedImage img = ImageIO.read(data.getPackagePart().getInputStream());
- double sx = anchor.getWidth()/img.getWidth();
- double sy = anchor.getHeight()/img.getHeight();
- double tx = anchor.getX();
- double ty = anchor.getY();
- AffineTransform at = new AffineTransform(sx, 0, 0, sy, tx, ty) ;
-
- graphics.drawRenderedImage(img, at);
-
- return true;
- } catch (Exception e) {
- return false;
- }
-
- }
-
- /**
- * Create a buffered image from the supplied package part.
- * This method is called to create texture paints.
- *
- * @return a BufferedImage
containing the decoded
- * contents of the input, or null
.
- */
- public BufferedImage readImage(PackagePart packagePart) throws IOException {
- return ImageIO.read(packagePart.getInputStream());
- }
-}
\ No newline at end of file
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFImageRenderer.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFImageRenderer.java
new file mode 100644
index 0000000000..f180aba207
--- /dev/null
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFImageRenderer.java
@@ -0,0 +1,107 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.xslf.usermodel;
+
+import org.apache.poi.openxml4j.opc.PackagePart;
+import org.apache.poi.util.Beta;
+
+import javax.imageio.ImageIO;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * For now this class renders only images supported by the javax.imageio.ImageIO
+ * framework. Subclasses can override this class to support other formats, for
+ * example, Use Apache batik to render WMF:
+ *
+ *
+ *
+ * public class MyImageRendener extends XSLFImageRendener{
+ * public boolean drawImage(Graphics2D graphics, XSLFPictureData data, Rectangle2D anchor){
+ * boolean ok = super.drawImage(graphics, data, anchor);
+ * if(!ok){
+ * // see what type of image we are
+ * String contentType = data.getPackagePart().getContentType();
+ * if(contentType.equals("image/wmf")){
+ * // use Apache Batik to handle WMF
+ * // see http://xmlgraphics.apache.org/batik/
+ * }
+ *
+ * }
+ * return ok;
+ * }
+ * }
+ *
+ *
+ *
+ * and then pass this class to your instance of java.awt.Graphics2D:
+ *
+ *
+ *
+ * graphics.setRenderingHint(XSLFRenderingHint.IMAGE_RENDERER, new MyImageRendener());
+ *
+ *
+ *
+ * @author Yegor Kozlov
+ */
+@Beta
+public class XSLFImageRenderer {
+
+ /**
+ * Render picture data into the supplied graphics
+ *
+ * @return true if the picture data was successfully rendered
+ */
+ public boolean drawImage(Graphics2D graphics, XSLFPictureData data,
+ Rectangle2D anchor) {
+ try {
+ BufferedImage img = ImageIO.read(data.getPackagePart().getInputStream());
+ double sx = anchor.getWidth()/img.getWidth();
+ double sy = anchor.getHeight()/img.getHeight();
+ double tx = anchor.getX();
+ double ty = anchor.getY();
+ AffineTransform at = new AffineTransform(sx, 0, 0, sy, tx, ty) ;
+
+ graphics.drawRenderedImage(img, at);
+
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+
+ }
+
+ /**
+ * Create a buffered image from the supplied package part.
+ * This method is called to create texture paints.
+ *
+ * @return a BufferedImage
containing the decoded
+ * contents of the input, or null
.
+ */
+ public BufferedImage readImage(PackagePart packagePart) throws IOException {
+ return ImageIO.read(packagePart.getInputStream());
+ }
+}
\ No newline at end of file
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
index 75cc4d15d0..8ad48364ce 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java
@@ -22,7 +22,6 @@ package org.apache.poi.xslf.usermodel;
import org.apache.poi.POIXMLException;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
-import org.apache.poi.openxml4j.opc.TargetMode;
import org.apache.poi.util.Beta;
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlip;
import org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties;
@@ -126,8 +125,8 @@ public class XSLFPictureShape extends XSLFSimpleShape {
XSLFPictureData data = getPictureData();
if(data == null) return;
- XSLFImageRendener renderer = (XSLFImageRendener)graphics.getRenderingHint(XSLFRenderingHint.IMAGE_RENDERER);
- if(renderer == null) renderer = new XSLFImageRendener();
+ XSLFImageRenderer renderer = (XSLFImageRenderer)graphics.getRenderingHint(XSLFRenderingHint.IMAGE_RENDERER);
+ if(renderer == null) renderer = new XSLFImageRenderer();
RenderableShape rShape = new RenderableShape(this);
Rectangle2D anchor = rShape.getAnchor(graphics);
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFRenderingHint.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFRenderingHint.java
index 715530c67c..fe68385688 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFRenderingHint.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFRenderingHint.java
@@ -44,7 +44,7 @@ public class XSLFRenderingHint extends RenderingHints.Key {
/**
* Use a custom image rendener
*
- * @see XSLFImageRendener
+ * @see XSLFImageRenderer
*/
public static final XSLFRenderingHint IMAGE_RENDERER = new XSLFRenderingHint(3);
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
index ec733a1c98..d575e05324 100644
--- a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
+++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
@@ -65,7 +65,6 @@ public class SheetDataWriter {
* Create a writer for the sheet data.
*
* @param fd the file to write to
- * @return
*/
public Writer createWriter(File fd)throws IOException {
return new BufferedWriter(new FileWriter(fd));
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
index 896be63bd0..0f8d3d70d0 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
@@ -558,12 +558,15 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable+ * See {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)} + * for a safe way to create valid names + *
* @param sheetname sheetname to set for the sheet. * @return Sheet representing the new sheet. * @throws IllegalArgumentException if the name is null or invalid * or workbook already contains a sheet with this name - * @see {@link org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal)} - * for a safe way to create valid names + * @see org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(String nameProposal) */ public XSSFSheet createSheet(String sheetname) { if (sheetname == null) { @@ -1190,9 +1193,8 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable