aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2009-08-18 16:50:24 +0000
committerJosh Micich <josh@apache.org>2009-08-18 16:50:24 +0000
commita2cd9a942e1cc575254690ea4b7e9053cade05b3 (patch)
treefa09862bf8c587477e49d375596babc643004c74 /src/ooxml/java/org/apache
parent95afcef9e6ae7728b1629c54bc6acc96e0674454 (diff)
downloadpoi-a2cd9a942e1cc575254690ea4b7e9053cade05b3.tar.gz
poi-a2cd9a942e1cc575254690ea4b7e9053cade05b3.zip
Fixed compiler warnings - unnecessary else
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@805492 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache')
-rwxr-xr-xsrc/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java142
-rwxr-xr-xsrc/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java7
-rwxr-xr-xsrc/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java9
-rwxr-xr-xsrc/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java14
-rwxr-xr-xsrc/ooxml/java/org/apache/poi/util/PackageHelper.java32
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java6
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java199
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java251
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java122
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java77
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java63
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java17
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java14
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java71
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java17
-rw-r--r--src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java12
-rw-r--r--src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java6
-rwxr-xr-xsrc/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java6
18 files changed, 522 insertions, 543 deletions
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
index 582fe507a2..aeea4dccbc 100755
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
@@ -35,11 +35,10 @@ import org.apache.poi.openxml4j.util.Nullable;
/**
* Represents the core properties part of a package.
- *
+ *
* @author Julien Chable
- * @version 1.0
*/
-public class PackagePropertiesPart extends PackagePart implements
+public final class PackagePropertiesPart extends PackagePart implements
PackageProperties {
public final static String NAMESPACE_DC_URI = "http://purl.org/dc/elements/1.1/";
@@ -52,7 +51,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Constructor.
- *
+ *
* @param pack
* Container package.
* @param partName
@@ -67,7 +66,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* A categorization of the content of this package.
- *
+ *
* [Example: Example values for this property might include: Resume, Letter,
* Financial Forecast, Proposal, Technical Presentation, and so on. This
* value might be used by an application's user interface to facilitate
@@ -77,7 +76,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* The status of the content.
- *
+ *
* [Example: Values might include "Draft", "Reviewed", and "Final". end
* example]
*/
@@ -86,7 +85,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* The type of content represented, generally defined by a specific use and
* intended audience.
- *
+ *
* [Example: Values might include "Whitepaper", "Security Bulletin", and
* "Exam". end example] [Note: This property is distinct from MIME content
* types as defined in RFC 2616. end note]
@@ -105,7 +104,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* An explanation of the content of the resource.
- *
+ *
* [Example: Values might include an abstract, table of contents, reference
* to a graphical representation of content, and a free-text account of the
* content. end example]
@@ -126,7 +125,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* The language of the intellectual content of the resource.
- *
+ *
* [Note: IETF RFC 3066 provides guidance on encoding to represent
* languages. end note]
*/
@@ -135,7 +134,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* The user who performed the last modification. The identification is
* environment-specific.
- *
+ *
* [Example: A name, email address, or employee ID. end example] It is
* recommended that this value be as concise as possible.
*/
@@ -153,7 +152,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* The revision number.
- *
+ *
* [Example: This value might indicate the number of saves or revisions,
* provided the application updates it after each revision. end example]
*/
@@ -180,7 +179,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get the category property.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getCategoryProperty()
*/
public Nullable<String> getCategoryProperty() {
@@ -189,7 +188,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get content status.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getContentStatusProperty()
*/
public Nullable<String> getContentStatusProperty() {
@@ -198,7 +197,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get content type.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getContentTypeProperty()
*/
public Nullable<String> getContentTypeProperty() {
@@ -207,7 +206,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get created date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getCreatedProperty()
*/
public Nullable<Date> getCreatedProperty() {
@@ -216,7 +215,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get created date formated into a String.
- *
+ *
* @return A string representation of the created date.
*/
public String getCreatedPropertyString() {
@@ -225,7 +224,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get creator.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getCreatorProperty()
*/
public Nullable<String> getCreatorProperty() {
@@ -234,7 +233,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get description.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getDescriptionProperty()
*/
public Nullable<String> getDescriptionProperty() {
@@ -243,7 +242,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get identifier.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getIdentifierProperty()
*/
public Nullable<String> getIdentifierProperty() {
@@ -252,7 +251,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get keywords.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getKeywordsProperty()
*/
public Nullable<String> getKeywordsProperty() {
@@ -261,7 +260,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get the language.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getLanguageProperty()
*/
public Nullable<String> getLanguageProperty() {
@@ -270,7 +269,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get the author of last modifications.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getLastModifiedByProperty()
*/
public Nullable<String> getLastModifiedByProperty() {
@@ -279,7 +278,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get last printed date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getLastPrintedProperty()
*/
public Nullable<Date> getLastPrintedProperty() {
@@ -288,7 +287,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get last printed date formated into a String.
- *
+ *
* @return A string representation of the last printed date.
*/
public String getLastPrintedPropertyString() {
@@ -297,7 +296,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get modified date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getModifiedProperty()
*/
public Nullable<Date> getModifiedProperty() {
@@ -306,19 +305,19 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get modified date formated into a String.
- *
+ *
* @return A string representation of the modified date.
*/
public String getModifiedPropertyString() {
- if (!modified.hasValue())
- return getDateValue(new Nullable<Date>(new Date()));
- else
+ if (modified.hasValue()) {
return getDateValue(modified);
+ }
+ return getDateValue(new Nullable<Date>(new Date()));
}
/**
* Get revision.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getRevisionProperty()
*/
public Nullable<String> getRevisionProperty() {
@@ -327,7 +326,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get subject.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getSubjectProperty()
*/
public Nullable<String> getSubjectProperty() {
@@ -336,7 +335,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get title.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getTitleProperty()
*/
public Nullable<String> getTitleProperty() {
@@ -345,7 +344,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Get version.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#getVersionProperty()
*/
public Nullable<String> getVersionProperty() {
@@ -354,7 +353,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set the category.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setCategoryProperty(java.lang.String)
*/
public void setCategoryProperty(String category) {
@@ -363,7 +362,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set the content status.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setContentStatusProperty(java.lang.String)
*/
public void setContentStatusProperty(String contentStatus) {
@@ -372,7 +371,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set the content type.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setContentTypeProperty(java.lang.String)
*/
public void setContentTypeProperty(String contentType) {
@@ -381,7 +380,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set the created date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setCreatedProperty(org.apache.poi.openxml4j.util.Nullable)
*/
public void setCreatedProperty(String created) {
@@ -395,7 +394,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set the created date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setCreatedProperty(org.apache.poi.openxml4j.util.Nullable)
*/
public void setCreatedProperty(Nullable<Date> created) {
@@ -405,7 +404,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set the creator.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setCreatorProperty(java.lang.String)
*/
public void setCreatorProperty(String creator) {
@@ -414,7 +413,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set the description.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setDescriptionProperty(java.lang.String)
*/
public void setDescriptionProperty(String description) {
@@ -423,7 +422,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set identifier.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setIdentifierProperty(java.lang.String)
*/
public void setIdentifierProperty(String identifier) {
@@ -432,7 +431,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set keywords.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setKeywordsProperty(java.lang.String)
*/
public void setKeywordsProperty(String keywords) {
@@ -441,7 +440,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set language.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setLanguageProperty(java.lang.String)
*/
public void setLanguageProperty(String language) {
@@ -450,7 +449,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set last modifications author.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setLastModifiedByProperty(java.lang.String)
*/
public void setLastModifiedByProperty(String lastModifiedBy) {
@@ -459,7 +458,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set last printed date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setLastPrintedProperty(org.apache.poi.openxml4j.util.Nullable)
*/
public void setLastPrintedProperty(String lastPrinted) {
@@ -473,7 +472,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set last printed date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setLastPrintedProperty(org.apache.poi.openxml4j.util.Nullable)
*/
public void setLastPrintedProperty(Nullable<Date> lastPrinted) {
@@ -483,7 +482,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set last modification date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setModifiedProperty(org.apache.poi.openxml4j.util.Nullable)
*/
public void setModifiedProperty(String modified) {
@@ -497,7 +496,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set last modification date.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setModifiedProperty(org.apache.poi.openxml4j.util.Nullable)
*/
public void setModifiedProperty(Nullable<Date> modified) {
@@ -507,7 +506,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set revision.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setRevisionProperty(java.lang.String)
*/
public void setRevisionProperty(String revision) {
@@ -516,7 +515,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set subject.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setSubjectProperty(java.lang.String)
*/
public void setSubjectProperty(String subject) {
@@ -525,7 +524,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set title.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setTitleProperty(java.lang.String)
*/
public void setTitleProperty(String title) {
@@ -534,7 +533,7 @@ public class PackagePropertiesPart extends PackagePart implements
/**
* Set version.
- *
+ *
* @see org.apache.poi.openxml4j.opc.PackageProperties#setVersionProperty(java.lang.String)
*/
public void setVersionProperty(String version) {
@@ -545,47 +544,46 @@ public class PackagePropertiesPart extends PackagePart implements
* Convert a strig value into a Nullable<String>
*/
private Nullable<String> setStringValue(String s) {
- if (s == null || s.equals(""))
+ if (s == null || s.equals("")) {
return new Nullable<String>();
- else
- return new Nullable<String>(s);
+ }
+ return new Nullable<String>(s);
}
/**
* Convert a string value represented a date into a Nullable<Date>.
- *
+ *
* @throws InvalidFormatException
* Throws if the date format isnot valid.
*/
private Nullable<Date> setDateValue(String s) throws InvalidFormatException {
- if (s == null || s.equals(""))
+ if (s == null || s.equals("")) {
return new Nullable<Date>();
- else {
- SimpleDateFormat df = new SimpleDateFormat(
- "yyyy-MM-dd'T'HH:mm:ss'Z'");
- Date d = df.parse(s, new ParsePosition(0));
- if (d == null)
- throw new InvalidFormatException("Date not well formated");
- return new Nullable<Date>(d);
}
+ SimpleDateFormat df = new SimpleDateFormat(
+ "yyyy-MM-dd'T'HH:mm:ss'Z'");
+ Date d = df.parse(s, new ParsePosition(0));
+ if (d == null) {
+ throw new InvalidFormatException("Date not well formated");
+ }
+ return new Nullable<Date>(d);
}
/**
* Convert a Nullable<Date> into a String.
- *
+ *
* @param d
* The Date to convert.
* @return The formated date or null.
* @see java.util.SimpleDateFormat
*/
private String getDateValue(Nullable<Date> d) {
- if (d == null || d.equals(""))
+ if (d == null || d.equals("")) {
return "";
- else {
- SimpleDateFormat df = new SimpleDateFormat(
- "yyyy-MM-dd'T'HH:mm:ss'Z'");
- return df.format(d.getValue());
}
+ SimpleDateFormat df = new SimpleDateFormat(
+ "yyyy-MM-dd'T'HH:mm:ss'Z'");
+ return df.format(d.getValue());
}
@Override
@@ -600,12 +598,12 @@ public class PackagePropertiesPart extends PackagePart implements
}
@Override
- public boolean save(OutputStream zos) throws OpenXML4JException {
+ public boolean save(OutputStream zos) {
throw new InvalidOperationException("Operation not authorized");
}
@Override
- public boolean load(InputStream ios) throws InvalidFormatException {
+ public boolean load(InputStream ios) {
throw new InvalidOperationException("Operation not authorized");
}
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java
index 7355c7e099..3491dc6424 100755
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java
@@ -34,7 +34,7 @@ import org.dom4j.Document;
/**
* Zip implementation of the ContentTypeManager.
- *
+ *
* @author Julien Chable
* @version 1.0
* @see ContentTypeManager
@@ -44,7 +44,7 @@ public class ZipContentTypeManager extends ContentTypeManager {
/**
* Delegate constructor to the super constructor.
- *
+ *
* @param in
* The input stream to parse to fill internal content type
* collections.
@@ -78,9 +78,8 @@ public class ZipContentTypeManager extends ContentTypeManager {
if (resultRead == -1) {
// end of file reached
break;
- } else {
- zos.write(buff, 0, resultRead);
}
+ zos.write(buff, 0, resultRead);
}
zos.closeEntry();
} catch (IOException ioe) {
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
index ab867ad250..5e72198f65 100755
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
@@ -58,8 +58,7 @@ public final class ZipHelper {
* @throws OpenXML4JException
* Throws if internal error occurs.
*/
- public static ZipEntry getCorePropertiesZipEntry(ZipPackage pkg)
- throws OpenXML4JException {
+ public static ZipEntry getCorePropertiesZipEntry(ZipPackage pkg) {
PackageRelationship corePropsRel = pkg.getRelationshipsByType(
PackageRelationshipTypes.CORE_PROPERTIES).getRelationship(0);
@@ -96,10 +95,10 @@ public final class ZipHelper {
public static String getOPCNameFromZipItemName(String zipItemName) {
if (zipItemName == null)
throw new IllegalArgumentException("zipItemName");
- if (zipItemName.startsWith(FORWARD_SLASH))
+ if (zipItemName.startsWith(FORWARD_SLASH)) {
return zipItemName;
- else
- return FORWARD_SLASH + zipItemName;
+ }
+ return FORWARD_SLASH + zipItemName;
}
/**
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java
index a86f56d0af..36719d3470 100755
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java
@@ -31,7 +31,6 @@ import org.dom4j.Namespace;
import org.dom4j.QName;
import org.dom4j.io.SAXReader;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
-import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.openxml4j.opc.PackageNamespaces;
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageProperties;
@@ -44,7 +43,6 @@ import org.apache.poi.openxml4j.opc.internal.ZipHelper;
* Package properties unmarshaller.
*
* @author Julien Chable
- * @version 1.0
*/
public final class PackagePropertiesUnmarshaller implements PartUnmarshaller {
@@ -110,15 +108,9 @@ public final class PackagePropertiesUnmarshaller implements PartUnmarshaller {
.getInputStream(context.getZipEntry());
} else if (context.getPackage() != null) {
// Try to retrieve the part inputstream from the URI
- ZipEntry zipEntry;
- try {
- zipEntry = ZipHelper
- .getCorePropertiesZipEntry((ZipPackage) context
- .getPackage());
- } catch (OpenXML4JException e) {
- throw new IOException(
- "Error while trying to get the part input stream.");
- }
+ ZipEntry zipEntry = ZipHelper
+ .getCorePropertiesZipEntry((ZipPackage) context
+ .getPackage());
in = ((ZipPackage) context.getPackage()).getZipArchive()
.getInputStream(zipEntry);
} else
diff --git a/src/ooxml/java/org/apache/poi/util/PackageHelper.java b/src/ooxml/java/org/apache/poi/util/PackageHelper.java
index 953a4ab866..3fefe53a03 100755
--- a/src/ooxml/java/org/apache/poi/util/PackageHelper.java
+++ b/src/ooxml/java/org/apache/poi/util/PackageHelper.java
@@ -14,6 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
+
package org.apache.poi.util;
import org.apache.poi.openxml4j.opc.*;
@@ -31,7 +32,7 @@ import java.net.URI;
*
* @author Yegor Kozlov
*/
-public class PackageHelper {
+public final class PackageHelper {
/**
* Clone the specified package.
@@ -74,10 +75,9 @@ public class PackageHelper {
if (rel.getRelationshipType().equals(PackageRelationshipTypes.CORE_PROPERTIES)) {
copyProperties(pkg.getPackageProperties(), dest.getPackageProperties());
continue;
- } else {
- dest.addRelationship(part.getPartName(), rel.getTargetMode(), rel.getRelationshipType());
- part_tgt = dest.createPart(part.getPartName(), part.getContentType());
}
+ dest.addRelationship(part.getPartName(), rel.getTargetMode(), rel.getRelationshipType());
+ part_tgt = dest.createPart(part.getPartName(), part.getContentType());
OutputStream out = part_tgt.getOutputStream();
IOUtils.copy(part.getInputStream(), out);
@@ -95,7 +95,7 @@ public class PackageHelper {
}
/**
- * Creates an empty file in the default temporary-file directory,
+ * Creates an empty file in the default temporary-file directory,
*/
public static File createTempFile() throws IOException {
File file = TempFile.createTempFile("poi-ooxml-", ".tmp");
@@ -117,18 +117,18 @@ public class PackageHelper {
part_tgt.addExternalRelationship(rel.getTargetURI().toString(), rel.getRelationshipType(), rel.getId());
//external relations don't have associated package parts
continue;
- } else {
- URI uri = rel.getTargetURI();
-
- if(uri.getRawFragment() != null) {
- part_tgt.addRelationship(uri, rel.getTargetMode(), rel.getRelationshipType(), rel.getId());
- continue;
- } else {
- PackagePartName relName = PackagingURIHelper.createPartName(rel.getTargetURI());
- p = pkg.getPart(relName);
- part_tgt.addRelationship(p.getPartName(), rel.getTargetMode(), rel.getRelationshipType(), rel.getId());
- }
}
+ URI uri = rel.getTargetURI();
+
+ if(uri.getRawFragment() != null) {
+ part_tgt.addRelationship(uri, rel.getTargetMode(), rel.getRelationshipType(), rel.getId());
+ continue;
+ }
+ PackagePartName relName = PackagingURIHelper.createPartName(rel.getTargetURI());
+ p = pkg.getPart(relName);
+ part_tgt.addRelationship(p.getPartName(), rel.getTargetMode(), rel.getRelationshipType(), rel.getId());
+
+
PackagePart dest;
diff --git a/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java b/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
index 0be0142d45..f408d936ce 100644
--- a/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
+++ b/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java
@@ -440,9 +440,9 @@ public class StylesTable extends POIXMLDocumentPart {
}
protected CTDxf getDxf(int idx) {
- if(dxfs.size()==0)
- return CTDxf.Factory.newInstance();
- else
+ if (dxfs.size()==0) {
+ return CTDxf.Factory.newInstance();
+ }
return dxfs.get(idx);
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
index f9c2bdf2bd..883d2696bb 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCell.java
@@ -33,8 +33,6 @@ import org.apache.poi.ss.formula.FormulaRenderer;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.xssf.model.StylesTable;
import org.apache.poi.xssf.model.SharedStringsTable;
-import org.apache.poi.util.POILogger;
-import org.apache.poi.util.POILogFactory;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellFormula;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellType;
@@ -55,7 +53,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellFormulaType;
* </p>
*/
public final class XSSFCell implements Cell {
- private static POILogger logger = POILogFactory.getLogger(XSSFCell.class);
private static final String FALSE_AS_STRING = "0";
private static final String TRUE_AS_STRING = "1";
@@ -64,28 +61,28 @@ public final class XSSFCell implements Cell {
* the xml bean containing information about the cell's location, value,
* data type, formatting, and formula
*/
- private final CTCell cell;
+ private final CTCell _cell;
/**
* the XSSFRow this cell belongs to
*/
- private final XSSFRow row;
+ private final XSSFRow _row;
/**
* 0-based column index
*/
- private int cellNum;
+ private int _cellNum;
/**
* Table of strings shared across this workbook.
* If two cells contain the same string, then the cell value is the same index into SharedStringsTable
*/
- private SharedStringsTable sharedStringSource;
+ private SharedStringsTable _sharedStringSource;
/**
* Table of cell styles shared across all cells in a workbook.
*/
- private StylesTable stylesSource;
+ private StylesTable _stylesSource;
/**
* Construct a XSSFCell.
@@ -94,27 +91,27 @@ public final class XSSFCell implements Cell {
* @param cell the xml bean containing information about the cell.
*/
protected XSSFCell(XSSFRow row, CTCell cell) {
- this.cell = cell;
- this.row = row;
+ _cell = cell;
+ _row = row;
if (cell.getR() != null) {
- this.cellNum = new CellReference(cell.getR()).getCol();
+ _cellNum = new CellReference(cell.getR()).getCol();
}
- this.sharedStringSource = row.getSheet().getWorkbook().getSharedStringSource();
- this.stylesSource = row.getSheet().getWorkbook().getStylesSource();
+ _sharedStringSource = row.getSheet().getWorkbook().getSharedStringSource();
+ _stylesSource = row.getSheet().getWorkbook().getStylesSource();
}
/**
* @return table of strings shared across this workbook
*/
protected SharedStringsTable getSharedStringSource() {
- return sharedStringSource;
+ return _sharedStringSource;
}
/**
* @return table of cell styles shared across this workbook
*/
protected StylesTable getStylesSource() {
- return stylesSource;
+ return _stylesSource;
}
/**
@@ -132,7 +129,7 @@ public final class XSSFCell implements Cell {
* @return the row this cell belongs to
*/
public XSSFRow getRow() {
- return row;
+ return _row;
}
/**
@@ -150,10 +147,10 @@ public final class XSSFCell implements Cell {
case CELL_TYPE_BLANK:
return false;
case CELL_TYPE_BOOLEAN:
- return cell.isSetV() && TRUE_AS_STRING.equals(cell.getV());
+ return _cell.isSetV() && TRUE_AS_STRING.equals(_cell.getV());
case CELL_TYPE_FORMULA:
//YK: should throw an exception if requesting boolean value from a non-boolean formula
- return cell.isSetV() && TRUE_AS_STRING.equals(cell.getV());
+ return _cell.isSetV() && TRUE_AS_STRING.equals(_cell.getV());
default:
throw typeMismatch(CELL_TYPE_BOOLEAN, cellType, false);
}
@@ -167,8 +164,8 @@ public final class XSSFCell implements Cell {
* will change the cell to a boolean cell and set its value.
*/
public void setCellValue(boolean value) {
- cell.setT(STCellType.B);
- cell.setV(value ? TRUE_AS_STRING : FALSE_AS_STRING);
+ _cell.setT(STCellType.B);
+ _cell.setV(value ? TRUE_AS_STRING : FALSE_AS_STRING);
}
/**
@@ -189,7 +186,7 @@ public final class XSSFCell implements Cell {
return 0.0;
case CELL_TYPE_FORMULA:
case CELL_TYPE_NUMERIC:
- return cell.isSetV() ? Double.parseDouble(cell.getV()) : 0.0;
+ return _cell.isSetV() ? Double.parseDouble(_cell.getV()) : 0.0;
default:
throw typeMismatch(CELL_TYPE_NUMERIC, cellType, false);
}
@@ -205,11 +202,11 @@ public final class XSSFCell implements Cell {
*/
public void setCellValue(double value) {
if(Double.isInfinite(value) || Double.isNaN(value)) {
- cell.setT(STCellType.E);
- cell.setV(FormulaError.NUM.getString());
+ _cell.setT(STCellType.E);
+ _cell.setV(FormulaError.NUM.getString());
} else {
- cell.setT(STCellType.N);
- cell.setV(String.valueOf(value));
+ _cell.setT(STCellType.N);
+ _cell.setV(String.valueOf(value));
}
}
@@ -242,20 +239,20 @@ public final class XSSFCell implements Cell {
rt = new XSSFRichTextString("");
break;
case CELL_TYPE_STRING:
- if (cell.getT() == STCellType.INLINE_STR) {
- if(cell.isSetIs()) {
+ if (_cell.getT() == STCellType.INLINE_STR) {
+ if(_cell.isSetIs()) {
//string is expressed directly in the cell definition instead of implementing the shared string table.
- rt = new XSSFRichTextString(cell.getIs());
- } else if (cell.isSetV()) {
+ rt = new XSSFRichTextString(_cell.getIs());
+ } else if (_cell.isSetV()) {
//cached result of a formula
- rt = new XSSFRichTextString(cell.getV());
+ rt = new XSSFRichTextString(_cell.getV());
} else {
rt = new XSSFRichTextString("");
}
} else {
- if (cell.isSetV()) {
- int idx = Integer.parseInt(cell.getV());
- rt = new XSSFRichTextString(sharedStringSource.getEntryAt(idx));
+ if (_cell.isSetV()) {
+ int idx = Integer.parseInt(_cell.getV());
+ rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(idx));
}
else {
rt = new XSSFRichTextString("");
@@ -263,12 +260,12 @@ public final class XSSFCell implements Cell {
}
break;
case CELL_TYPE_FORMULA:
- rt = new XSSFRichTextString(cell.isSetV() ? cell.getV() : "");
+ rt = new XSSFRichTextString(_cell.isSetV() ? _cell.getV() : "");
break;
default:
throw typeMismatch(CELL_TYPE_STRING, cellType, false);
}
- rt.setStylesTableReference(stylesSource);
+ rt.setStylesTableReference(_stylesSource);
return rt;
}
@@ -300,19 +297,19 @@ public final class XSSFCell implements Cell {
int cellType = getCellType();
switch(cellType){
case Cell.CELL_TYPE_FORMULA:
- cell.setV(str.getString());
- cell.setT(STCellType.STR);
+ _cell.setV(str.getString());
+ _cell.setT(STCellType.STR);
break;
default:
- if(cell.getT() == STCellType.INLINE_STR) {
+ if(_cell.getT() == STCellType.INLINE_STR) {
//set the 'pre-evaluated result
- cell.setV(str.getString());
+ _cell.setV(str.getString());
} else {
- cell.setT(STCellType.S);
+ _cell.setT(STCellType.S);
XSSFRichTextString rt = (XSSFRichTextString)str;
- rt.setStylesTableReference(stylesSource);
- int sRef = sharedStringSource.addEntry(rt.getCTRst());
- cell.setV(Integer.toString(sRef));
+ rt.setStylesTableReference(_stylesSource);
+ int sRef = _sharedStringSource.addEntry(rt.getCTRst());
+ _cell.setV(Integer.toString(sRef));
}
break;
}
@@ -328,12 +325,11 @@ public final class XSSFCell implements Cell {
int cellType = getCellType();
if(cellType != CELL_TYPE_FORMULA) throw typeMismatch(CELL_TYPE_FORMULA, cellType, false);
- CTCellFormula f = cell.getF();
+ CTCellFormula f = _cell.getF();
if(f.getT() == STCellFormulaType.SHARED){
return convertSharedFormula((int)f.getSi());
- } else {
- return f.getStringValue();
}
+ return f.getStringValue();
}
/**
@@ -368,10 +364,10 @@ public final class XSSFCell implements Cell {
* @throws IllegalArgumentException if the formula is invalid
*/
public void setCellFormula(String formula) {
- XSSFWorkbook wb = row.getSheet().getWorkbook();
+ XSSFWorkbook wb = _row.getSheet().getWorkbook();
if (formula == null) {
wb.onDeleteFormula(this);
- if(cell.isSetF()) cell.unsetF();
+ if(_cell.isSetF()) _cell.unsetF();
return;
}
@@ -381,8 +377,8 @@ public final class XSSFCell implements Cell {
CTCellFormula f = CTCellFormula.Factory.newInstance();
f.setStringValue(formula);
- cell.setF(f);
- if(cell.isSetV()) cell.unsetV();
+ _cell.setF(f);
+ if(_cell.isSetV()) _cell.unsetV();
}
/**
@@ -391,7 +387,7 @@ public final class XSSFCell implements Cell {
* @return zero-based column index of a column in a sheet.
*/
public int getColumnIndex() {
- return this.cellNum;
+ return this._cellNum;
}
/**
@@ -400,7 +396,7 @@ public final class XSSFCell implements Cell {
* @return zero-based row index of a row in the sheet that contains this cell
*/
public int getRowIndex() {
- return row.getRowNum();
+ return _row.getRowNum();
}
/**
@@ -409,7 +405,7 @@ public final class XSSFCell implements Cell {
* @return A1 style reference to the location of this cell
*/
public String getReference() {
- return cell.getR();
+ return _cell.getR();
}
/**
@@ -419,8 +415,8 @@ public final class XSSFCell implements Cell {
* <code>workbook.getCellStyleAt(0)</code>
*/
public XSSFCellStyle getCellStyle() {
- long idx = cell.isSetS() ? cell.getS() : 0;
- return stylesSource.getStyleAt((int)idx);
+ long idx = _cell.isSetS() ? _cell.getS() : 0;
+ return _stylesSource.getStyleAt((int)idx);
}
/**
@@ -432,13 +428,13 @@ public final class XSSFCell implements Cell {
*/
public void setCellStyle(CellStyle style) {
if(style == null) {
- if(cell.isSetS()) cell.unsetS();
+ if(_cell.isSetS()) _cell.unsetS();
} else {
XSSFCellStyle xStyle = (XSSFCellStyle)style;
- xStyle.verifyBelongsToStylesSource(stylesSource);
+ xStyle.verifyBelongsToStylesSource(_stylesSource);
- long idx = stylesSource.putStyle(xStyle);
- cell.setS(idx);
+ long idx = _stylesSource.putStyle(xStyle);
+ _cell.setS(idx);
}
}
@@ -455,7 +451,7 @@ public final class XSSFCell implements Cell {
*/
public int getCellType() {
- if (cell.getF() != null) {
+ if (_cell.getF() != null) {
return CELL_TYPE_FORMULA;
}
@@ -469,7 +465,7 @@ public final class XSSFCell implements Cell {
* on the cached value of the formula
*/
public int getCachedFormulaResultType() {
- if (cell.getF() == null) {
+ if (_cell.getF() == null) {
throw new IllegalStateException("Only formula cells have cached results");
}
@@ -480,11 +476,11 @@ public final class XSSFCell implements Cell {
* Detect cell type based on the "t" attribute of the CTCell bean
*/
private int getBaseCellType(boolean blankCells) {
- switch (cell.getT().intValue()) {
+ switch (_cell.getT().intValue()) {
case STCellType.INT_B:
return CELL_TYPE_BOOLEAN;
case STCellType.INT_N:
- if (!cell.isSetV() && blankCells) {
+ if (!_cell.isSetV() && blankCells) {
// ooxml does have a separate cell type of 'blank'. A blank cell gets encoded as
// (either not present or) a numeric cell with no value set.
// The formula evaluator (and perhaps other clients of this interface) needs to
@@ -500,7 +496,7 @@ public final class XSSFCell implements Cell {
case STCellType.INT_STR:
return CELL_TYPE_STRING;
default:
- throw new IllegalStateException("Illegal cell type: " + this.cell.getT());
+ throw new IllegalStateException("Illegal cell type: " + this._cell.getT());
}
}
@@ -570,7 +566,7 @@ public final class XSSFCell implements Cell {
int cellType = getCellType();
if(cellType != CELL_TYPE_ERROR) throw typeMismatch(CELL_TYPE_ERROR, cellType, false);
- return cell.getV();
+ return _cell.getV();
}
/**
* Get the value of the cell as an error code.
@@ -615,15 +611,15 @@ public final class XSSFCell implements Cell {
* cell and set its value.
*/
public void setCellErrorValue(FormulaError error) {
- cell.setT(STCellType.E);
- cell.setV(error.getString());
+ _cell.setT(STCellType.E);
+ _cell.setV(error.getString());
}
/**
* Sets this cell as the active cell for the worksheet.
*/
public void setAsActiveCell() {
- getSheet().setActiveCell(cell.getR());
+ getSheet().setActiveCell(_cell.getR());
}
/**
@@ -632,9 +628,9 @@ public final class XSSFCell implements Cell {
*/
private void setBlank(){
CTCell blank = CTCell.Factory.newInstance();
- blank.setR(cell.getR());
- blank.setS(cell.getS());
- cell.set(blank);
+ blank.setR(_cell.getR());
+ blank.setS(_cell.getS());
+ _cell.set(blank);
}
/**
@@ -644,9 +640,9 @@ public final class XSSFCell implements Cell {
*/
protected void setCellNum(int num) {
checkBounds(num);
- cellNum = num;
+ _cellNum = num;
String ref = new CellReference(getRowIndex(), getColumnIndex()).formatAsString();
- cell.setR(ref);
+ _cell.setR(ref);
}
/**
@@ -668,31 +664,31 @@ public final class XSSFCell implements Cell {
break;
case CELL_TYPE_BOOLEAN:
String newVal = convertCellValueToBoolean() ? TRUE_AS_STRING : FALSE_AS_STRING;
- cell.setT(STCellType.B);
- cell.setV(newVal);
+ _cell.setT(STCellType.B);
+ _cell.setV(newVal);
break;
case CELL_TYPE_NUMERIC:
- cell.setT(STCellType.N);
+ _cell.setT(STCellType.N);
break;
case CELL_TYPE_ERROR:
- cell.setT(STCellType.E);
+ _cell.setT(STCellType.E);
break;
case CELL_TYPE_STRING:
if(prevType != CELL_TYPE_STRING){
String str = convertCellValueToString();
XSSFRichTextString rt = new XSSFRichTextString(str);
- rt.setStylesTableReference(stylesSource);
- int sRef = sharedStringSource.addEntry(rt.getCTRst());
- cell.setV(Integer.toString(sRef));
+ rt.setStylesTableReference(_stylesSource);
+ int sRef = _sharedStringSource.addEntry(rt.getCTRst());
+ _cell.setV(Integer.toString(sRef));
}
- cell.setT(STCellType.S);
+ _cell.setT(STCellType.S);
break;
case CELL_TYPE_FORMULA:
- if(!cell.isSetF()){
+ if(!_cell.isSetF()){
CTCellFormula f = CTCellFormula.Factory.newInstance();
f.setStringValue("0");
- cell.setF(f);
- if(cell.isSetT()) cell.unsetT();
+ _cell.setF(f);
+ if(_cell.isSetT()) _cell.unsetT();
}
break;
default:
@@ -722,9 +718,8 @@ public final class XSSFCell implements Cell {
if (DateUtil.isCellDateFormatted(this)) {
DateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
return sdf.format(getDateCellValue());
- } else {
- return getNumericCellValue() + "";
}
+ return getNumericCellValue() + "";
case CELL_TYPE_STRING:
return getRichStringCellValue().toString();
default:
@@ -745,7 +740,7 @@ public final class XSSFCell implements Cell {
* <code>null</code> for blank cells.
*/
public String getRawValue() {
- return cell.getV();
+ return _cell.getV();
}
/**
@@ -792,7 +787,7 @@ public final class XSSFCell implements Cell {
* @return the cell comment associated with this cell or <code>null</code>
*/
public XSSFComment getCellComment() {
- return getSheet().getCellComment(row.getRowNum(), getColumnIndex());
+ return getSheet().getCellComment(_row.getRowNum(), getColumnIndex());
}
/**
@@ -802,7 +797,7 @@ public final class XSSFCell implements Cell {
* @param comment comment associated with this cell
*/
public void setCellComment(Comment comment) {
- String cellRef = new CellReference(row.getRowNum(), getColumnIndex()).formatAsString();
+ String cellRef = new CellReference(_row.getRowNum(), getColumnIndex()).formatAsString();
getSheet().setCellComment(cellRef, (XSSFComment)comment);
}
@@ -812,7 +807,7 @@ public final class XSSFCell implements Cell {
* @return hyperlink associated with this cell or <code>null</code> if not found
*/
public XSSFHyperlink getHyperlink() {
- return getSheet().getHyperlink(row.getRowNum(), cellNum);
+ return getSheet().getHyperlink(_row.getRowNum(), _cellNum);
}
/**
@@ -824,7 +819,7 @@ public final class XSSFCell implements Cell {
XSSFHyperlink link = (XSSFHyperlink)hyperlink;
// Assign to us
- link.setCellReference( new CellReference(row.getRowNum(), cellNum).formatAsString() );
+ link.setCellReference( new CellReference(_row.getRowNum(), _cellNum).formatAsString() );
// Add to the lists
getSheet().setCellHyperlink(link);
@@ -837,7 +832,7 @@ public final class XSSFCell implements Cell {
* @return the xml bean containing information about this cell
*/
public CTCell getCTCell(){
- return cell;
+ return _cell;
}
/**
@@ -857,14 +852,14 @@ public final class XSSFCell implements Cell {
switch (cellType) {
case CELL_TYPE_BOOLEAN:
- return TRUE_AS_STRING.equals(cell.getV());
+ return TRUE_AS_STRING.equals(_cell.getV());
case CELL_TYPE_STRING:
- int sstIndex = Integer.parseInt(cell.getV());
- XSSFRichTextString rt = new XSSFRichTextString(sharedStringSource.getEntryAt(sstIndex));
+ int sstIndex = Integer.parseInt(_cell.getV());
+ XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex));
String text = rt.getString();
- return Boolean.valueOf(text);
+ return Boolean.valueOf(text).booleanValue();
case CELL_TYPE_NUMERIC:
- return Double.parseDouble(cell.getV()) != 0;
+ return Double.parseDouble(_cell.getV()) != 0;
case CELL_TYPE_ERROR:
case CELL_TYPE_BLANK:
@@ -880,15 +875,15 @@ public final class XSSFCell implements Cell {
case CELL_TYPE_BLANK:
return "";
case CELL_TYPE_BOOLEAN:
- return TRUE_AS_STRING.equals(cell.getV()) ? "TRUE" : "FALSE";
+ return TRUE_AS_STRING.equals(_cell.getV()) ? "TRUE" : "FALSE";
case CELL_TYPE_STRING:
- int sstIndex = Integer.parseInt(cell.getV());
- XSSFRichTextString rt = new XSSFRichTextString(sharedStringSource.getEntryAt(sstIndex));
+ int sstIndex = Integer.parseInt(_cell.getV());
+ XSSFRichTextString rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(sstIndex));
return rt.getString();
case CELL_TYPE_NUMERIC:
- return String.valueOf(Double.parseDouble(cell.getV()));
+ return String.valueOf(Double.parseDouble(_cell.getV()));
case CELL_TYPE_ERROR:
- return cell.getV();
+ return _cell.getV();
case CELL_TYPE_FORMULA:
// should really evaluate, but HSSFCell can't call HSSFFormulaEvaluator
return "";
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
index 5ce05a176d..4987d6564f 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java
@@ -37,12 +37,12 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
*/
public class XSSFCellStyle implements CellStyle {
- private int cellXfId;
- private StylesTable stylesSource;
- private CTXf cellXf;
- private CTXf cellStyleXf;
- private XSSFFont font;
- private XSSFCellAlignment cellAlignment;
+ private int _cellXfId;
+ private StylesTable _stylesSource;
+ private CTXf _cellXf;
+ private CTXf _cellStyleXf;
+ private XSSFFont _font;
+ private XSSFCellAlignment _cellAlignment;
/**
* Creates a Cell Style from the supplied parts
@@ -51,35 +51,35 @@ public class XSSFCellStyle implements CellStyle {
* @param stylesSource Styles Source to work off
*/
public XSSFCellStyle(int cellXfId, int cellStyleXfId, StylesTable stylesSource) {
- this.cellXfId = cellXfId;
- this.stylesSource = stylesSource;
- this.cellXf = stylesSource.getCellXfAt(this.cellXfId);
- this.cellStyleXf = stylesSource.getCellStyleXfAt(cellStyleXfId);
+ _cellXfId = cellXfId;
+ _stylesSource = stylesSource;
+ _cellXf = stylesSource.getCellXfAt(this._cellXfId);
+ _cellStyleXf = stylesSource.getCellStyleXfAt(cellStyleXfId);
}
/**
* Used so that StylesSource can figure out our location
*/
public CTXf getCoreXf() {
- return cellXf;
+ return _cellXf;
}
/**
* Used so that StylesSource can figure out our location
*/
public CTXf getStyleXf() {
- return cellStyleXf;
+ return _cellStyleXf;
}
/**
* Creates an empty Cell Style
*/
public XSSFCellStyle(StylesTable stylesSource) {
- this.stylesSource = stylesSource;
+ _stylesSource = stylesSource;
// We need a new CTXf for the main styles
// TODO decide on a style ctxf
- cellXf = CTXf.Factory.newInstance();
- cellStyleXf = null;
+ _cellXf = CTXf.Factory.newInstance();
+ _cellStyleXf = null;
}
/**
@@ -92,7 +92,7 @@ public class XSSFCellStyle implements CellStyle {
* @throws IllegalArgumentException if there's a workbook mis-match
*/
public void verifyBelongsToStylesSource(StylesTable src) {
- if(this.stylesSource != src) {
+ if(this._stylesSource != src) {
throw new IllegalArgumentException("This Style does not belong to the supplied Workbook Stlyes Source. Are you trying to assign a style from one workbook to the cell of a differnt workbook?");
}
}
@@ -112,8 +112,8 @@ public class XSSFCellStyle implements CellStyle {
public void cloneStyleFrom(CellStyle source) {
if(source instanceof XSSFCellStyle) {
XSSFCellStyle src = (XSSFCellStyle)source;
- cellXf.set(src.getCoreXf());
- cellStyleXf.set(src.getStyleXf());
+ _cellXf.set(src.getCoreXf());
+ _cellStyleXf.set(src.getStyleXf());
} else {
throw new IllegalArgumentException("Can only clone from one XSSFCellStyle to another, not between HSSFCellStyle and XSSFCellStyle");
}
@@ -142,7 +142,7 @@ public class XSSFCellStyle implements CellStyle {
* @see org.apache.poi.ss.usermodel.HorizontalAlignment
*/
public HorizontalAlignment getAlignmentEnum() {
- CTCellAlignment align = cellXf.getAlignment();
+ CTCellAlignment align = _cellXf.getAlignment();
if(align != null && align.isSetHorizontal()) {
return HorizontalAlignment.values()[align.getHorizontal().intValue()-1];
}
@@ -169,10 +169,10 @@ public class XSSFCellStyle implements CellStyle {
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderBottom() {
- if(!cellXf.getApplyBorder()) return BORDER_NONE;
+ if(!_cellXf.getApplyBorder()) return BORDER_NONE;
- int idx = (int)cellXf.getBorderId();
- CTBorder ct = stylesSource.getBorderAt(idx).getCTBorder();
+ int idx = (int)_cellXf.getBorderId();
+ CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
STBorderStyle.Enum ptrn = ct.isSetBottom() ? ct.getBottom().getStyle() : null;
return ptrn == null ? BORDER_NONE : (short)(ptrn.intValue() - 1);
}
@@ -208,10 +208,10 @@ public class XSSFCellStyle implements CellStyle {
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderLeft() {
- if(!cellXf.getApplyBorder()) return BORDER_NONE;
+ if(!_cellXf.getApplyBorder()) return BORDER_NONE;
- int idx = (int)cellXf.getBorderId();
- CTBorder ct = stylesSource.getBorderAt(idx).getCTBorder();
+ int idx = (int)_cellXf.getBorderId();
+ CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
STBorderStyle.Enum ptrn = ct.isSetLeft() ? ct.getLeft().getStyle() : null;
return ptrn == null ? BORDER_NONE : (short)(ptrn.intValue() - 1);
}
@@ -246,10 +246,10 @@ public class XSSFCellStyle implements CellStyle {
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderRight() {
- if(!cellXf.getApplyBorder()) return BORDER_NONE;
+ if(!_cellXf.getApplyBorder()) return BORDER_NONE;
- int idx = (int)cellXf.getBorderId();
- CTBorder ct = stylesSource.getBorderAt(idx).getCTBorder();
+ int idx = (int)_cellXf.getBorderId();
+ CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
STBorderStyle.Enum ptrn = ct.isSetRight() ? ct.getRight().getStyle() : null;
return ptrn == null ? BORDER_NONE : (short)(ptrn.intValue() - 1);
}
@@ -284,10 +284,10 @@ public class XSSFCellStyle implements CellStyle {
* @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
*/
public short getBorderTop() {
- if(!cellXf.getApplyBorder()) return BORDER_NONE;
+ if(!_cellXf.getApplyBorder()) return BORDER_NONE;
- int idx = (int)cellXf.getBorderId();
- CTBorder ct = stylesSource.getBorderAt(idx).getCTBorder();
+ int idx = (int)_cellXf.getBorderId();
+ CTBorder ct = _stylesSource.getBorderAt(idx).getCTBorder();
STBorderStyle.Enum ptrn = ct.isSetTop() ? ct.getTop().getStyle() : null;
return ptrn == null ? BORDER_NONE : (short)(ptrn.intValue() - 1);
}
@@ -320,10 +320,10 @@ public class XSSFCellStyle implements CellStyle {
* @return the used color or <code>null</code> if not set
*/
public XSSFColor getBottomBorderXSSFColor() {
- if(!cellXf.getApplyBorder()) return null;
+ if(!_cellXf.getApplyBorder()) return null;
- int idx = (int)cellXf.getBorderId();
- XSSFCellBorder border = stylesSource.getBorderAt(idx);
+ int idx = (int)_cellXf.getBorderId();
+ XSSFCellBorder border = _stylesSource.getBorderAt(idx);
return border.getBorderColor(BorderSide.BOTTOM);
}
@@ -334,7 +334,7 @@ public class XSSFCellStyle implements CellStyle {
* @return the index of the number format
*/
public short getDataFormat() {
- return (short)cellXf.getNumFmtId();
+ return (short)_cellXf.getNumFmtId();
}
/**
@@ -345,7 +345,7 @@ public class XSSFCellStyle implements CellStyle {
*/
public String getDataFormatString() {
int idx = getDataFormat();
- return new XSSFDataFormat(stylesSource).getFormat((short)idx);
+ return new XSSFDataFormat(_stylesSource).getFormat((short)idx);
}
/**
@@ -372,10 +372,10 @@ public class XSSFCellStyle implements CellStyle {
* @return XSSFColor - fill color or <code>null</code> if not set
*/
public XSSFColor getFillBackgroundXSSFColor() {
- if(!cellXf.getApplyFill()) return null;
+ if(!_cellXf.getApplyFill()) return null;
- int fillIndex = (int)cellXf.getFillId();
- XSSFCellFill fg = stylesSource.getFillAt(fillIndex);
+ int fillIndex = (int)_cellXf.getFillId();
+ XSSFCellFill fg = _stylesSource.getFillAt(fillIndex);
return fg.getFillBackgroundColor();
}
@@ -400,10 +400,10 @@ public class XSSFCellStyle implements CellStyle {
* @return XSSFColor - fill color or <code>null</code> if not set
*/
public XSSFColor getFillForegroundXSSFColor() {
- if(!cellXf.getApplyFill()) return null;
+ if(!_cellXf.getApplyFill()) return null;
- int fillIndex = (int)cellXf.getFillId();
- XSSFCellFill fg = stylesSource.getFillAt(fillIndex);
+ int fillIndex = (int)_cellXf.getFillId();
+ XSSFCellFill fg = _stylesSource.getFillAt(fillIndex);
return fg.getFillForegroundColor();
}
@@ -431,10 +431,10 @@ public class XSSFCellStyle implements CellStyle {
* @see org.apache.poi.ss.usermodel.CellStyle#DIAMONDS
*/
public short getFillPattern() {
- if(!cellXf.getApplyFill()) return 0;
+ if(!_cellXf.getApplyFill()) return 0;
- int fillIndex = (int)cellXf.getFillId();
- XSSFCellFill fill = stylesSource.getFillAt(fillIndex);
+ int fillIndex = (int)_cellXf.getFillId();
+ XSSFCellFill fill = _stylesSource.getFillAt(fillIndex);
STPatternType.Enum ptrn = fill.getPatternType();
if(ptrn == null) return CellStyle.NO_FILL;
@@ -456,10 +456,10 @@ public class XSSFCellStyle implements CellStyle {
* @return Font - font
*/
public XSSFFont getFont() {
- if (font == null) {
- font = stylesSource.getFontAt(getFontId());
+ if (_font == null) {
+ _font = _stylesSource.getFontAt(getFontId());
}
- return font;
+ return _font;
}
/**
@@ -487,7 +487,7 @@ public class XSSFCellStyle implements CellStyle {
* @return indent - number of spaces
*/
public short getIndention() {
- CTCellAlignment align = cellXf.getAlignment();
+ CTCellAlignment align = _cellXf.getAlignment();
return (short)(align == null ? 0 : align.getIndent());
}
@@ -497,7 +497,7 @@ public class XSSFCellStyle implements CellStyle {
* @return unique index number of the underlying record this style represents
*/
public short getIndex() {
- return (short)this.cellXfId;
+ return (short)this._cellXfId;
}
/**
@@ -518,10 +518,10 @@ public class XSSFCellStyle implements CellStyle {
* @see org.apache.poi.ss.usermodel.IndexedColors
*/
public XSSFColor getLeftBorderXSSFColor() {
- if(!cellXf.getApplyBorder()) return null;
+ if(!_cellXf.getApplyBorder()) return null;
- int idx = (int)cellXf.getBorderId();
- XSSFCellBorder border = stylesSource.getBorderAt(idx);
+ int idx = (int)_cellXf.getBorderId();
+ XSSFCellBorder border = _stylesSource.getBorderAt(idx);
return border.getBorderColor(BorderSide.LEFT);
}
@@ -551,10 +551,10 @@ public class XSSFCellStyle implements CellStyle {
* @return the used color or <code>null</code> if not set
*/
public XSSFColor getRightBorderXSSFColor() {
- if(!cellXf.getApplyBorder()) return null;
+ if(!_cellXf.getApplyBorder()) return null;
- int idx = (int)cellXf.getBorderId();
- XSSFCellBorder border = stylesSource.getBorderAt(idx);
+ int idx = (int)_cellXf.getBorderId();
+ XSSFCellBorder border = _stylesSource.getBorderAt(idx);
return border.getBorderColor(BorderSide.RIGHT);
}
@@ -574,7 +574,7 @@ public class XSSFCellStyle implements CellStyle {
* @return rotation degrees (between 0 and 180 degrees)
*/
public short getRotation() {
- CTCellAlignment align = cellXf.getAlignment();
+ CTCellAlignment align = _cellXf.getAlignment();
return (short)(align == null ? 0 : align.getTextRotation());
}
@@ -595,10 +595,10 @@ public class XSSFCellStyle implements CellStyle {
* @return the used color or <code>null</code> if not set
*/
public XSSFColor getTopBorderXSSFColor() {
- if(!cellXf.getApplyBorder()) return null;
+ if(!_cellXf.getApplyBorder()) return null;
- int idx = (int)cellXf.getBorderId();
- XSSFCellBorder border = stylesSource.getBorderAt(idx);
+ int idx = (int)_cellXf.getBorderId();
+ XSSFCellBorder border = _stylesSource.getBorderAt(idx);
return border.getBorderColor(BorderSide.TOP);
}
@@ -623,12 +623,11 @@ public class XSSFCellStyle implements CellStyle {
* @see org.apache.poi.ss.usermodel.VerticalAlignment
*/
public VerticalAlignment getVerticalAlignmentEnum() {
- CTCellAlignment align = cellXf.getAlignment();
+ CTCellAlignment align = _cellXf.getAlignment();
if(align != null && align.isSetVertical()) {
return VerticalAlignment.values()[align.getVertical().intValue()-1];
- } else {
- return VerticalAlignment.BOTTOM;
}
+ return VerticalAlignment.BOTTOM;
}
/**
@@ -637,7 +636,7 @@ public class XSSFCellStyle implements CellStyle {
* @return a boolean value indicating if the text in a cell should be line-wrapped within the cell.
*/
public boolean getWrapText() {
- CTCellAlignment align = cellXf.getAlignment();
+ CTCellAlignment align = _cellXf.getAlignment();
return align != null && align.getWrapText();
}
@@ -692,10 +691,10 @@ public class XSSFCellStyle implements CellStyle {
if(border == BORDER_NONE) ct.unsetBottom();
else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));
- int idx = stylesSource.putBorder(new XSSFCellBorder(ct));
+ int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
- cellXf.setBorderId(idx);
- cellXf.setApplyBorder(true);
+ _cellXf.setBorderId(idx);
+ _cellXf.setApplyBorder(true);
}
/**
@@ -732,10 +731,10 @@ public class XSSFCellStyle implements CellStyle {
if(border == BORDER_NONE) ct.unsetLeft();
else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));
- int idx = stylesSource.putBorder(new XSSFCellBorder(ct));
+ int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
- cellXf.setBorderId(idx);
- cellXf.setApplyBorder(true);
+ _cellXf.setBorderId(idx);
+ _cellXf.setApplyBorder(true);
}
/**
@@ -772,10 +771,10 @@ public class XSSFCellStyle implements CellStyle {
if(border == BORDER_NONE) ct.unsetRight();
else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));
- int idx = stylesSource.putBorder(new XSSFCellBorder(ct));
+ int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
- cellXf.setBorderId(idx);
- cellXf.setApplyBorder(true);
+ _cellXf.setBorderId(idx);
+ _cellXf.setApplyBorder(true);
}
/**
@@ -812,10 +811,10 @@ public class XSSFCellStyle implements CellStyle {
if(border == BORDER_NONE) ct.unsetTop();
else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));
- int idx = stylesSource.putBorder(new XSSFCellBorder(ct));
+ int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
- cellXf.setBorderId(idx);
- cellXf.setApplyBorder(true);
+ _cellXf.setBorderId(idx);
+ _cellXf.setApplyBorder(true);
}
/**
@@ -851,10 +850,10 @@ public class XSSFCellStyle implements CellStyle {
if(color != null) pr.setColor(color.getCTColor());
else pr.unsetColor();
- int idx = stylesSource.putBorder(new XSSFCellBorder(ct));
+ int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
- cellXf.setBorderId(idx);
- cellXf.setApplyBorder(true);
+ _cellXf.setBorderId(idx);
+ _cellXf.setApplyBorder(true);
}
/**
@@ -863,8 +862,8 @@ public class XSSFCellStyle implements CellStyle {
* @param fmt the index of a data format
*/
public void setDataFormat(short fmt) {
- cellXf.setApplyNumberFormat(true);
- cellXf.setNumFmtId(fmt);
+ _cellXf.setApplyNumberFormat(true);
+ _cellXf.setNumFmtId(fmt);
}
/**
@@ -902,10 +901,10 @@ public class XSSFCellStyle implements CellStyle {
ptrn.setBgColor(color.getCTColor());
}
- int idx = stylesSource.putFill(new XSSFCellFill(ct));
+ int idx = _stylesSource.putFill(new XSSFCellFill(ct));
- cellXf.setFillId(idx);
- cellXf.setApplyFill(true);
+ _cellXf.setFillId(idx);
+ _cellXf.setApplyFill(true);
}
/**
@@ -958,10 +957,10 @@ public class XSSFCellStyle implements CellStyle {
ptrn.setFgColor(color.getCTColor());
}
- int idx = stylesSource.putFill(new XSSFCellFill(ct));
+ int idx = _stylesSource.putFill(new XSSFCellFill(ct));
- cellXf.setFillId(idx);
- cellXf.setApplyFill(true);
+ _cellXf.setFillId(idx);
+ _cellXf.setApplyFill(true);
}
/**
@@ -982,9 +981,9 @@ public class XSSFCellStyle implements CellStyle {
*/
private CTFill getCTFill(){
CTFill ct;
- if(cellXf.getApplyFill()) {
- int fillIndex = (int)cellXf.getFillId();
- XSSFCellFill cf = stylesSource.getFillAt(fillIndex);
+ if(_cellXf.getApplyFill()) {
+ int fillIndex = (int)_cellXf.getFillId();
+ XSSFCellFill cf = _stylesSource.getFillAt(fillIndex);
ct = (CTFill)cf.getCTFill().copy();
} else {
@@ -998,9 +997,9 @@ public class XSSFCellStyle implements CellStyle {
*/
private CTBorder getCTBorder(){
CTBorder ct;
- if(cellXf.getApplyBorder()) {
- int idx = (int)cellXf.getBorderId();
- XSSFCellBorder cf = stylesSource.getBorderAt(idx);
+ if(_cellXf.getApplyBorder()) {
+ int idx = (int)_cellXf.getBorderId();
+ XSSFCellBorder cf = _stylesSource.getBorderAt(idx);
ct = (CTBorder)cf.getCTBorder().copy();
} else {
@@ -1041,10 +1040,10 @@ public class XSSFCellStyle implements CellStyle {
if(fp == NO_FILL && ptrn.isSetPatternType()) ptrn.unsetPatternType();
else ptrn.setPatternType(STPatternType.Enum.forInt(fp + 1));
- int idx = stylesSource.putFill(new XSSFCellFill(ct));
+ int idx = _stylesSource.putFill(new XSSFCellFill(ct));
- cellXf.setFillId(idx);
- cellXf.setApplyFill(true);
+ _cellXf.setFillId(idx);
+ _cellXf.setApplyFill(true);
}
/**
@@ -1070,10 +1069,10 @@ public class XSSFCellStyle implements CellStyle {
public void setFont(Font font) {
if(font != null){
long index = font.getIndex();
- this.cellXf.setFontId(index);
- this.cellXf.setApplyFont(true);
+ this._cellXf.setFontId(index);
+ this._cellXf.setApplyFont(true);
} else {
- this.cellXf.setApplyFont(false);
+ this._cellXf.setApplyFont(false);
}
}
@@ -1120,10 +1119,10 @@ public class XSSFCellStyle implements CellStyle {
if(color != null) pr.setColor(color.getCTColor());
else pr.unsetColor();
- int idx = stylesSource.putBorder(new XSSFCellBorder(ct));
+ int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
- cellXf.setBorderId(idx);
- cellXf.setApplyBorder(true);
+ _cellXf.setBorderId(idx);
+ _cellXf.setApplyBorder(true);
}
/**
@@ -1160,10 +1159,10 @@ public class XSSFCellStyle implements CellStyle {
if(color != null) pr.setColor(color.getCTColor());
else pr.unsetColor();
- int idx = stylesSource.putBorder(new XSSFCellBorder(ct));
+ int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
- cellXf.setBorderId(idx);
- cellXf.setApplyBorder(true);
+ _cellXf.setBorderId(idx);
+ _cellXf.setApplyBorder(true);
}
/**
@@ -1210,10 +1209,10 @@ public class XSSFCellStyle implements CellStyle {
if(color != null) pr.setColor(color.getCTColor());
else pr.unsetColor();
- int idx = stylesSource.putBorder(new XSSFCellBorder(ct));
+ int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));
- cellXf.setBorderId(idx);
- cellXf.setApplyBorder(true);
+ _cellXf.setBorderId(idx);
+ _cellXf.setApplyBorder(true);
}
/**
@@ -1296,10 +1295,10 @@ public class XSSFCellStyle implements CellStyle {
}
}
private int getFontId() {
- if (cellXf.isSetFontId()) {
- return (int) cellXf.getFontId();
+ if (_cellXf.isSetFontId()) {
+ return (int) _cellXf.getFontId();
}
- return (int) cellStyleXf.getFontId();
+ return (int) _cellStyleXf.getFontId();
}
/**
@@ -1307,10 +1306,10 @@ public class XSSFCellStyle implements CellStyle {
* @return CTCellProtection
*/
private CTCellProtection getCellProtection() {
- if (cellXf.getProtection() == null) {
- cellXf.addNewProtection();
+ if (_cellXf.getProtection() == null) {
+ _cellXf.addNewProtection();
}
- return cellXf.getProtection();
+ return _cellXf.getProtection();
}
/**
@@ -1318,10 +1317,10 @@ public class XSSFCellStyle implements CellStyle {
* @return XSSFCellAlignment - cell alignment
*/
protected XSSFCellAlignment getCellAlignment() {
- if (this.cellAlignment == null) {
- this.cellAlignment = new XSSFCellAlignment(getCTCellAlignment());
+ if (this._cellAlignment == null) {
+ this._cellAlignment = new XSSFCellAlignment(getCTCellAlignment());
}
- return this.cellAlignment;
+ return this._cellAlignment;
}
/**
@@ -1330,10 +1329,10 @@ public class XSSFCellStyle implements CellStyle {
* @return CTCellAlignment
*/
private CTCellAlignment getCTCellAlignment() {
- if (cellXf.getAlignment() == null) {
- cellXf.setAlignment(CTCellAlignment.Factory.newInstance());
+ if (_cellXf.getAlignment() == null) {
+ _cellXf.setAlignment(CTCellAlignment.Factory.newInstance());
}
- return cellXf.getAlignment();
+ return _cellXf.getAlignment();
}
/**
@@ -1342,7 +1341,7 @@ public class XSSFCellStyle implements CellStyle {
* @return the hash code value for this style
*/
public int hashCode(){
- return cellXf.toString().hashCode();
+ return _cellXf.toString().hashCode();
}
/**
@@ -1355,7 +1354,7 @@ public class XSSFCellStyle implements CellStyle {
if(o == null || !(o instanceof XSSFCellStyle)) return false;
XSSFCellStyle cf = (XSSFCellStyle)o;
- return cellXf.toString().equals(cf.getCoreXf().toString());
+ return _cellXf.toString().equals(cf.getCoreXf().toString());
}
/**
@@ -1365,11 +1364,11 @@ public class XSSFCellStyle implements CellStyle {
* @return a copy of this style
*/
public Object clone(){
- CTXf xf = (CTXf)cellXf.copy();
+ CTXf xf = (CTXf)_cellXf.copy();
- int xfSize = stylesSource._getStyleXfsSize();
- int indexXf = stylesSource.putCellXf(xf);
- return new XSSFCellStyle(indexXf-1, xfSize-1, stylesSource);
+ int xfSize = _stylesSource._getStyleXfsSize();
+ int indexXf = _stylesSource.putCellXf(xf);
+ return new XSSFCellStyle(indexXf-1, xfSize-1, _stylesSource);
}
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
index 739ef4ca50..914b383f49 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
@@ -42,8 +42,8 @@ public class XSSFFont implements Font {
*/
public static final short DEFAULT_FONT_COLOR = IndexedColors.BLACK.getIndex();
- private CTFont ctFont;
- private short index;
+ private CTFont _ctFont;
+ private short _index;
/**
* Create a new XSSFFont
@@ -51,20 +51,20 @@ public class XSSFFont implements Font {
* @param font the underlying CTFont bean
*/
public XSSFFont(CTFont font) {
- this.ctFont = font;
- this.index = 0;
+ _ctFont = font;
+ _index = 0;
}
public XSSFFont(CTFont font, int index) {
- this.ctFont = font;
- this.index = (short)index;
+ _ctFont = font;
+ _index = (short)index;
}
/**
* Create a new XSSFont. This method is protected to be used only by XSSFWorkbook
*/
protected XSSFFont() {
- this.ctFont = CTFont.Factory.newInstance();
+ this._ctFont = CTFont.Factory.newInstance();
setFontName(DEFAULT_FONT_NAME);
setFontHeight((double)DEFAULT_FONT_SIZE);
}
@@ -73,7 +73,7 @@ public class XSSFFont implements Font {
* get the underlying CTFont font
*/
public CTFont getCTFont() {
- return ctFont;
+ return _ctFont;
}
/**
@@ -82,7 +82,7 @@ public class XSSFFont implements Font {
* @return boolean - bold
*/
public boolean getBold() {
- CTBooleanProperty bold = ctFont.sizeOfBArray() == 0 ? null : ctFont.getBArray(0);
+ CTBooleanProperty bold = _ctFont.sizeOfBArray() == 0 ? null : _ctFont.getBArray(0);
return (bold != null && bold.getVal());
}
@@ -93,7 +93,7 @@ public class XSSFFont implements Font {
* @see org.apache.poi.ss.usermodel.FontCharset
*/
public byte getCharSet() {
- CTIntProperty charset = ctFont.sizeOfCharsetArray() == 0 ? null : ctFont.getCharsetArray(0);
+ CTIntProperty charset = _ctFont.sizeOfCharsetArray() == 0 ? null : _ctFont.getCharsetArray(0);
int val = charset == null ? FontCharset.ANSI.getValue() : FontCharset.valueOf(charset.getVal()).getValue();
return (byte)val;
}
@@ -107,7 +107,7 @@ public class XSSFFont implements Font {
* @see IndexedColors
*/
public short getColor() {
- CTColor color = ctFont.sizeOfColorArray() == 0 ? null : ctFont.getColorArray(0);
+ CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0);
if (color == null) return IndexedColors.BLACK.getIndex();
long index = color.getIndexed();
@@ -128,7 +128,7 @@ public class XSSFFont implements Font {
* @return XSSFColor - rgb color to use
*/
public XSSFColor getXSSFColor() {
- CTColor ctColor = ctFont.sizeOfColorArray() == 0 ? null : ctFont.getColorArray(0);
+ CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0);
return ctColor == null ? null : new XSSFColor(ctColor);
}
@@ -140,7 +140,7 @@ public class XSSFFont implements Font {
* @return short - theme defined to use
*/
public short getThemeColor() {
- CTColor color = ctFont.sizeOfColorArray() == 0 ? null : ctFont.getColorArray(0);
+ CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0);
long index = color == null ? 0 : color.getTheme();
return (short) index;
}
@@ -151,12 +151,12 @@ public class XSSFFont implements Font {
* @return short - height in point
*/
public short getFontHeight() {
- CTFontSize size = ctFont.sizeOfSzArray() == 0 ? null : ctFont.getSzArray(0);
+ CTFontSize size = _ctFont.sizeOfSzArray() == 0 ? null : _ctFont.getSzArray(0);
if (size != null) {
double fontHeight = size.getVal();
return (short)(fontHeight*20);
- } else
- return (short)(DEFAULT_FONT_SIZE*20);
+ }
+ return (short)(DEFAULT_FONT_SIZE*20);
}
/**
@@ -172,7 +172,7 @@ public class XSSFFont implements Font {
* @return String - a string representing the name of the font to use
*/
public String getFontName() {
- CTFontName name = ctFont.sizeOfNameArray() == 0 ? null : ctFont.getNameArray(0);
+ CTFontName name = _ctFont.sizeOfNameArray() == 0 ? null : _ctFont.getNameArray(0);
return name == null ? DEFAULT_FONT_NAME : name.getVal();
}
@@ -182,7 +182,7 @@ public class XSSFFont implements Font {
* @return boolean - value for italic
*/
public boolean getItalic() {
- CTBooleanProperty italic = ctFont.sizeOfIArray() == 0 ? null : ctFont.getIArray(0);
+ CTBooleanProperty italic = _ctFont.sizeOfIArray() == 0 ? null : _ctFont.getIArray(0);
return italic != null && italic.getVal();
}
@@ -192,7 +192,7 @@ public class XSSFFont implements Font {
* @return boolean - value for strikeout
*/
public boolean getStrikeout() {
- CTBooleanProperty strike = ctFont.sizeOfStrikeArray() == 0 ? null : ctFont.getStrikeArray(0);
+ CTBooleanProperty strike = _ctFont.sizeOfStrikeArray() == 0 ? null : _ctFont.getStrikeArray(0);
return strike != null && strike.getVal();
}
@@ -205,21 +205,21 @@ public class XSSFFont implements Font {
* @see Font#SS_SUB
*/
public short getTypeOffset() {
- CTVerticalAlignFontProperty vAlign = ctFont.sizeOfVertAlignArray() == 0 ? null : ctFont.getVertAlignArray(0);
- if (vAlign != null) {
- int val = vAlign.getVal().intValue();
- switch (val) {
- case STVerticalAlignRun.INT_BASELINE:
- return Font.SS_NONE;
- case STVerticalAlignRun.INT_SUBSCRIPT:
- return Font.SS_SUB;
- case STVerticalAlignRun.INT_SUPERSCRIPT:
- return Font.SS_SUPER;
- default:
- throw new POIXMLException("Wrong offset value " + val);
- }
- } else
+ CTVerticalAlignFontProperty vAlign = _ctFont.sizeOfVertAlignArray() == 0 ? null : _ctFont.getVertAlignArray(0);
+ if (vAlign == null) {
return Font.SS_NONE;
+ }
+ int val = vAlign.getVal().intValue();
+ switch (val) {
+ case STVerticalAlignRun.INT_BASELINE:
+ return Font.SS_NONE;
+ case STVerticalAlignRun.INT_SUBSCRIPT:
+ return Font.SS_SUB;
+ case STVerticalAlignRun.INT_SUPERSCRIPT:
+ return Font.SS_SUPER;
+ default:
+ throw new POIXMLException("Wrong offset value " + val);
+ }
}
/**
@@ -229,7 +229,7 @@ public class XSSFFont implements Font {
* @see org.apache.poi.ss.usermodel.FontUnderline
*/
public byte getUnderline() {
- CTUnderlineProperty underline = ctFont.sizeOfUArray() == 0 ? null : ctFont.getUArray(0);
+ CTUnderlineProperty underline = _ctFont.sizeOfUArray() == 0 ? null : _ctFont.getUArray(0);
if (underline != null) {
FontUnderline val = FontUnderline.valueOf(underline.getVal().intValue());
return val.getByteValue();
@@ -244,10 +244,10 @@ public class XSSFFont implements Font {
*/
public void setBold(boolean bold) {
if(bold){
- CTBooleanProperty ctBold = ctFont.sizeOfBArray() == 0 ? ctFont.addNewB() : ctFont.getBArray(0);
+ CTBooleanProperty ctBold = _ctFont.sizeOfBArray() == 0 ? _ctFont.addNewB() : _ctFont.getBArray(0);
ctBold.setVal(bold);
} else {
- ctFont.setBArray(null);
+ _ctFont.setBArray(null);
}
}
@@ -275,7 +275,7 @@ public class XSSFFont implements Font {
* @see FontCharset
*/
public void setCharSet(byte charset) {
- CTIntProperty charsetProperty = ctFont.sizeOfCharsetArray() == 0 ? ctFont.addNewCharset() : ctFont.getCharsetArray(0);
+ CTIntProperty charsetProperty = _ctFont.sizeOfCharsetArray() == 0 ? _ctFont.addNewCharset() : _ctFont.getCharsetArray(0);
switch (charset) {
case Font.ANSI_CHARSET:
charsetProperty.setVal(FontCharset.ANSI.getValue());
@@ -308,7 +308,7 @@ public class XSSFFont implements Font {
* @see IndexedColors
*/
public void setColor(short color) {
- CTColor ctColor = ctFont.sizeOfColorArray() == 0 ? ctFont.addNewColor() : ctFont.getColorArray(0);
+ CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? _ctFont.addNewColor() : _ctFont.getColorArray(0);
switch (color) {
case Font.COLOR_NORMAL: {
ctColor.setIndexed(XSSFFont.DEFAULT_FONT_COLOR);
@@ -329,9 +329,9 @@ public class XSSFFont implements Font {
* @param color - color to use
*/
public void setColor(XSSFColor color) {
- if(color == null) ctFont.setColorArray(null);
+ if(color == null) _ctFont.setColorArray(null);
else {
- CTColor ctColor = ctFont.sizeOfColorArray() == 0 ? ctFont.addNewColor() : ctFont.getColorArray(0);
+ CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? _ctFont.addNewColor() : _ctFont.getColorArray(0);
ctColor.setRgb(color.getRgb());
}
}
@@ -351,7 +351,7 @@ public class XSSFFont implements Font {
* @param height - height in points
*/
public void setFontHeight(double height) {
- CTFontSize fontSize = ctFont.sizeOfSzArray() == 0 ? ctFont.addNewSz() : ctFont.getSzArray(0);
+ CTFontSize fontSize = _ctFont.sizeOfSzArray() == 0 ? _ctFont.addNewSz() : _ctFont.getSzArray(0);
fontSize.setVal(height);
}
@@ -370,7 +370,7 @@ public class XSSFFont implements Font {
* @param theme - theme color to use
*/
public void setThemeColor(short theme) {
- CTColor ctColor = ctFont.sizeOfColorArray() == 0 ? ctFont.addNewColor() : ctFont.getColorArray(0);
+ CTColor ctColor = _ctFont.sizeOfColorArray() == 0 ? _ctFont.addNewColor() : _ctFont.getColorArray(0);
ctColor.setTheme(theme);
}
@@ -386,7 +386,7 @@ public class XSSFFont implements Font {
* @see #DEFAULT_FONT_NAME
*/
public void setFontName(String name) {
- CTFontName fontName = ctFont.sizeOfNameArray() == 0 ? ctFont.addNewName() : ctFont.getNameArray(0);
+ CTFontName fontName = _ctFont.sizeOfNameArray() == 0 ? _ctFont.addNewName() : _ctFont.getNameArray(0);
fontName.setVal(name == null ? DEFAULT_FONT_NAME : name);
}
@@ -399,10 +399,10 @@ public class XSSFFont implements Font {
*/
public void setItalic(boolean italic) {
if(italic){
- CTBooleanProperty bool = ctFont.sizeOfIArray() == 0 ? ctFont.addNewI() : ctFont.getIArray(0);
+ CTBooleanProperty bool = _ctFont.sizeOfIArray() == 0 ? _ctFont.addNewI() : _ctFont.getIArray(0);
bool.setVal(italic);
} else {
- ctFont.setIArray(null);
+ _ctFont.setIArray(null);
}
}
@@ -414,9 +414,9 @@ public class XSSFFont implements Font {
* @param strikeout - value for strikeout or not
*/
public void setStrikeout(boolean strikeout) {
- if(!strikeout) ctFont.setStrikeArray(null);
+ if(!strikeout) _ctFont.setStrikeArray(null);
else {
- CTBooleanProperty strike = ctFont.sizeOfStrikeArray() == 0 ? ctFont.addNewStrike() : ctFont.getStrikeArray(0);
+ CTBooleanProperty strike = _ctFont.sizeOfStrikeArray() == 0 ? _ctFont.addNewStrike() : _ctFont.getStrikeArray(0);
strike.setVal(strikeout);
}
}
@@ -433,9 +433,9 @@ public class XSSFFont implements Font {
*/
public void setTypeOffset(short offset) {
if(offset == Font.SS_NONE){
- ctFont.setVertAlignArray(null);
+ _ctFont.setVertAlignArray(null);
} else {
- CTVerticalAlignFontProperty offsetProperty = ctFont.sizeOfVertAlignArray() == 0 ? ctFont.addNewVertAlign() : ctFont.getVertAlignArray(0);
+ CTVerticalAlignFontProperty offsetProperty = _ctFont.sizeOfVertAlignArray() == 0 ? _ctFont.addNewVertAlign() : _ctFont.getVertAlignArray(0);
switch (offset) {
case Font.SS_NONE:
offsetProperty.setVal(STVerticalAlignRun.BASELINE);
@@ -469,10 +469,10 @@ public class XSSFFont implements Font {
* @param underline - FontUnderline enum value
*/
public void setUnderline(FontUnderline underline) {
- if(underline == FontUnderline.NONE && ctFont.sizeOfUArray() > 0){
- ctFont.setUArray(null);
+ if(underline == FontUnderline.NONE && _ctFont.sizeOfUArray() > 0){
+ _ctFont.setUArray(null);
} else {
- CTUnderlineProperty ctUnderline = ctFont.sizeOfUArray() == 0 ? ctFont.addNewU() : ctFont.getUArray(0);
+ CTUnderlineProperty ctUnderline = _ctFont.sizeOfUArray() == 0 ? _ctFont.addNewU() : _ctFont.getUArray(0);
STUnderlineValues.Enum val = STUnderlineValues.Enum.forInt(underline.getValue());
ctUnderline.setVal(val);
}
@@ -480,7 +480,7 @@ public class XSSFFont implements Font {
public String toString() {
- return ctFont.toString();
+ return _ctFont.toString();
}
@@ -489,7 +489,7 @@ public class XSSFFont implements Font {
*/
public long putFont(StylesTable styles) {
short idx = (short)styles.putFont(this);
- this.index = idx;
+ this._index = idx;
return idx;
}
@@ -501,7 +501,7 @@ public class XSSFFont implements Font {
* @see org.apache.poi.xssf.model.StylesTable#createDefaultFont()
*/
public FontScheme getScheme() {
- CTFontScheme scheme = ctFont.sizeOfSchemeArray() == 0 ? null : ctFont.getSchemeArray(0);
+ CTFontScheme scheme = _ctFont.sizeOfSchemeArray() == 0 ? null : _ctFont.getSchemeArray(0);
return scheme == null ? FontScheme.NONE : FontScheme.valueOf(scheme.getVal().intValue());
}
@@ -512,7 +512,7 @@ public class XSSFFont implements Font {
* @see FontScheme
*/
public void setScheme(FontScheme scheme) {
- CTFontScheme ctFontScheme = ctFont.sizeOfSchemeArray() == 0 ? ctFont.addNewScheme() : ctFont.getSchemeArray(0);
+ CTFontScheme ctFontScheme = _ctFont.sizeOfSchemeArray() == 0 ? _ctFont.addNewScheme() : _ctFont.getSchemeArray(0);
STFontScheme.Enum val = STFontScheme.Enum.forInt(scheme.getValue());
ctFontScheme.setVal(val);
}
@@ -524,7 +524,7 @@ public class XSSFFont implements Font {
* @see org.apache.poi.ss.usermodel.FontFamily
*/
public int getFamily() {
- CTIntProperty family = ctFont.sizeOfFamilyArray() == 0 ? ctFont.addNewFamily() : ctFont.getFamilyArray(0);
+ CTIntProperty family = _ctFont.sizeOfFamilyArray() == 0 ? _ctFont.addNewFamily() : _ctFont.getFamilyArray(0);
return family == null ? FontFamily.NOT_APPLICABLE.getValue() : FontFamily.valueOf(family.getVal()).getValue();
}
@@ -537,7 +537,7 @@ public class XSSFFont implements Font {
* @see FontFamily
*/
public void setFamily(int value) {
- CTIntProperty family = ctFont.sizeOfFamilyArray() == 0 ? ctFont.addNewFamily() : ctFont.getFamilyArray(0);
+ CTIntProperty family = _ctFont.sizeOfFamilyArray() == 0 ? _ctFont.addNewFamily() : _ctFont.getFamilyArray(0);
family.setVal(value);
}
@@ -560,18 +560,18 @@ public class XSSFFont implements Font {
public short getIndex()
{
- return index;
+ return _index;
}
public int hashCode(){
- return ctFont.toString().hashCode();
+ return _ctFont.toString().hashCode();
}
public boolean equals(Object o){
if(!(o instanceof XSSFFont)) return false;
XSSFFont cf = (XSSFFont)o;
- return ctFont.toString().equals(cf.getCTFont().toString());
+ return _ctFont.toString().equals(cf.getCTFont().toString());
}
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java
index 671e6f402f..e492d28f16 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFHyperlink.java
@@ -32,10 +32,10 @@ import org.apache.poi.openxml4j.opc.PackageRelationship;
* are largely stored as relations of the sheet
*/
public class XSSFHyperlink implements Hyperlink {
- private int type;
- private PackageRelationship externalRel;
- private CTHyperlink ctHyperlink;
- private String location;
+ private int _type;
+ private PackageRelationship _externalRel;
+ private CTHyperlink _ctHyperlink;
+ private String _location;
/**
* Create a new XSSFHyperlink. This method is protected to be used only by XSSFCreationHelper
@@ -43,8 +43,8 @@ public class XSSFHyperlink implements Hyperlink {
* @param type - the type of hyperlink to create
*/
protected XSSFHyperlink(int type) {
- this.type = type;
- this.ctHyperlink = CTHyperlink.Factory.newInstance();
+ _type = type;
+ _ctHyperlink = CTHyperlink.Factory.newInstance();
}
/**
@@ -54,37 +54,36 @@ public class XSSFHyperlink implements Hyperlink {
* @param hyperlinkRel the relationship in the underlying OPC package which stores the actual link's address
*/
protected XSSFHyperlink(CTHyperlink ctHyperlink, PackageRelationship hyperlinkRel) {
- this.ctHyperlink = ctHyperlink;
- this.externalRel = hyperlinkRel;
+ _ctHyperlink = ctHyperlink;
+ _externalRel = hyperlinkRel;
// Figure out the Hyperlink type and distination
// If it has a location, it's internal
if (ctHyperlink.getLocation() != null) {
- type = Hyperlink.LINK_DOCUMENT;
- location = ctHyperlink.getLocation();
+ _type = Hyperlink.LINK_DOCUMENT;
+ _location = ctHyperlink.getLocation();
} else {
// Otherwise it's somehow external, check
// the relation to see how
- if (externalRel == null) {
+ if (_externalRel == null) {
if (ctHyperlink.getId() != null) {
throw new IllegalStateException("The hyperlink for cell " + ctHyperlink.getRef() + " references relation " + ctHyperlink.getId() + ", but that didn't exist!");
- } else {
- throw new IllegalStateException("A sheet hyperlink must either have a location, or a relationship. Found:\n" + ctHyperlink);
}
+ throw new IllegalStateException("A sheet hyperlink must either have a location, or a relationship. Found:\n" + ctHyperlink);
}
- URI target = externalRel.getTargetURI();
- location = target.toString();
+ URI target = _externalRel.getTargetURI();
+ _location = target.toString();
// Try to figure out the type
- if (location.startsWith("http://") || location.startsWith("https://")
- || location.startsWith("ftp://")) {
- type = Hyperlink.LINK_URL;
- } else if (location.startsWith("mailto:")) {
- type = Hyperlink.LINK_EMAIL;
+ if (_location.startsWith("http://") || _location.startsWith("https://")
+ || _location.startsWith("ftp://")) {
+ _type = Hyperlink.LINK_URL;
+ } else if (_location.startsWith("mailto:")) {
+ _type = Hyperlink.LINK_EMAIL;
} else {
- type = Hyperlink.LINK_FILE;
+ _type = Hyperlink.LINK_FILE;
}
}
}
@@ -93,7 +92,7 @@ public class XSSFHyperlink implements Hyperlink {
* Returns the underlying hyperlink object
*/
protected CTHyperlink getCTHyperlink() {
- return ctHyperlink;
+ return _ctHyperlink;
}
/**
@@ -101,7 +100,7 @@ public class XSSFHyperlink implements Hyperlink {
* this hyperlink?
*/
public boolean needsRelationToo() {
- return (type != Hyperlink.LINK_DOCUMENT);
+ return (_type != Hyperlink.LINK_DOCUMENT);
}
/**
@@ -111,10 +110,10 @@ public class XSSFHyperlink implements Hyperlink {
if (needsRelationToo()) {
// Generate the relation
PackageRelationship rel =
- sheetPart.addExternalRelationship(location, XSSFRelation.SHEET_HYPERLINKS.getRelation());
+ sheetPart.addExternalRelationship(_location, XSSFRelation.SHEET_HYPERLINKS.getRelation());
// Update the r:id
- ctHyperlink.setId(rel.getId());
+ _ctHyperlink.setId(rel.getId());
}
}
@@ -124,7 +123,7 @@ public class XSSFHyperlink implements Hyperlink {
* @return the type of this hyperlink
*/
public int getType() {
- return type;
+ return _type;
}
/**
@@ -132,7 +131,7 @@ public class XSSFHyperlink implements Hyperlink {
* es A55
*/
public String getCellRef() {
- return ctHyperlink.getRef();
+ return _ctHyperlink.getRef();
}
/**
@@ -141,7 +140,7 @@ public class XSSFHyperlink implements Hyperlink {
* @return the address of this hyperlink
*/
public String getAddress() {
- return location;
+ return _location;
}
/**
@@ -150,7 +149,7 @@ public class XSSFHyperlink implements Hyperlink {
* @return text to display
*/
public String getLabel() {
- return ctHyperlink.getDisplay();
+ return _ctHyperlink.getDisplay();
}
/**
@@ -160,7 +159,7 @@ public class XSSFHyperlink implements Hyperlink {
* @return location
*/
public String getLocation() {
- return ctHyperlink.getLocation();
+ return _ctHyperlink.getLocation();
}
/**
@@ -169,7 +168,7 @@ public class XSSFHyperlink implements Hyperlink {
* @param label text label for this hyperlink
*/
public void setLabel(String label) {
- ctHyperlink.setDisplay(label);
+ _ctHyperlink.setDisplay(label);
}
/**
@@ -179,7 +178,7 @@ public class XSSFHyperlink implements Hyperlink {
* @param location - string representing a location of this hyperlink
*/
public void setLocation(String location) {
- ctHyperlink.setLocation(location);
+ _ctHyperlink.setLocation(location);
}
/**
@@ -188,9 +187,9 @@ public class XSSFHyperlink implements Hyperlink {
* @param address - the address of this hyperlink
*/
public void setAddress(String address) {
- location = address;
- //we must set location for internal hyperlinks
- if (type == Hyperlink.LINK_DOCUMENT) {
+ _location = address;
+ //we must set location for internal hyperlinks
+ if (_type == Hyperlink.LINK_DOCUMENT) {
setLocation(address);
}
}
@@ -199,11 +198,11 @@ public class XSSFHyperlink implements Hyperlink {
* Assigns this hyperlink to the given cell reference
*/
protected void setCellReference(String ref) {
- ctHyperlink.setRef(ref);
+ _ctHyperlink.setRef(ref);
}
private CellReference buildCellReference() {
- return new CellReference(ctHyperlink.getRef());
+ return new CellReference(_ctHyperlink.getRef());
}
@@ -251,7 +250,7 @@ public class XSSFHyperlink implements Hyperlink {
* @param col the 0-based column of the first cell that contains the hyperlink
*/
public void setFirstColumn(int col) {
- ctHyperlink.setRef(
+ _ctHyperlink.setRef(
new CellReference(
getFirstRow(), col
).formatAsString()
@@ -273,7 +272,7 @@ public class XSSFHyperlink implements Hyperlink {
* @param row the 0-based row of the first cell that contains the hyperlink
*/
public void setFirstRow(int row) {
- ctHyperlink.setRef(
+ _ctHyperlink.setRef(
new CellReference(
row, getFirstColumn()
).formatAsString()
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java
index ed4d364abe..2cb64cc27f 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFName.java
@@ -102,8 +102,8 @@ public final class XSSFName implements Name {
*/
public final static String BUILTIN_SHEET_TITLE = "_xlnm.Sheet_Title";
- private XSSFWorkbook workbook;
- private CTDefinedName ctName;
+ private XSSFWorkbook _workbook;
+ private CTDefinedName _ctName;
/**
* Creates an XSSFName object - called internally by XSSFWorkbook.
@@ -113,15 +113,15 @@ public final class XSSFName implements Name {
* @see org.apache.poi.xssf.usermodel.XSSFWorkbook#createName()
*/
protected XSSFName(CTDefinedName name, XSSFWorkbook workbook) {
- this.workbook = workbook;
- this.ctName = name;
+ _workbook = workbook;
+ _ctName = name;
}
/**
* Returns the underlying named range object
*/
protected CTDefinedName getCTName() {
- return ctName;
+ return _ctName;
}
/**
@@ -130,7 +130,7 @@ public final class XSSFName implements Name {
* @return text name of this defined name
*/
public String getNameName() {
- return ctName.getName();
+ return _ctName.getName();
}
/**
@@ -169,8 +169,8 @@ public final class XSSFName implements Name {
int sheetIndex = getSheetIndex();
//Check to ensure no other names have the same case-insensitive name
- for (int i = 0; i < workbook.getNumberOfNames(); i++) {
- XSSFName nm = workbook.getNameAt(i);
+ for (int i = 0; i < _workbook.getNumberOfNames(); i++) {
+ XSSFName nm = _workbook.getNameAt(i);
if (nm != this) {
if(name.equalsIgnoreCase(nm.getNameName()) && sheetIndex == nm.getSheetIndex()){
String msg = "The "+(sheetIndex == -1 ? "workbook" : "sheet")+" already contains this name: " + name;
@@ -178,11 +178,11 @@ public final class XSSFName implements Name {
}
}
}
- ctName.setName(name);
+ _ctName.setName(name);
}
public String getRefersToFormula() {
- String result = ctName.getStringValue();
+ String result = _ctName.getStringValue();
if (result == null || result.length() < 1) {
return null;
}
@@ -190,11 +190,11 @@ public final class XSSFName implements Name {
}
public void setRefersToFormula(String formulaText) {
- XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(workbook);
+ XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(_workbook);
//validate through the FormulaParser
FormulaParser.parse(formulaText, fpb, FormulaType.NAMEDRANGE, getSheetIndex());
- ctName.setStringValue(formulaText);
+ _ctName.setStringValue(formulaText);
}
public boolean isDeleted(){
@@ -202,7 +202,7 @@ public final class XSSFName implements Name {
if (formulaText == null) {
return false;
}
- XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(workbook);
+ XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(_workbook);
Ptg[] ptgs = FormulaParser.parse(formulaText, fpb, FormulaType.NAMEDRANGE, getSheetIndex());
return Ptg.doesFormulaReferToDeletedCell(ptgs);
}
@@ -213,16 +213,16 @@ public final class XSSFName implements Name {
* @param index the sheet index this name applies to, -1 unsets this property making the name workbook-global
*/
public void setSheetIndex(int index) {
- int lastSheetIx = workbook.getNumberOfSheets() - 1;
+ int lastSheetIx = _workbook.getNumberOfSheets() - 1;
if (index < -1 || index > lastSheetIx) {
throw new IllegalArgumentException("Sheet index (" + index +") is out of range" +
(lastSheetIx == -1 ? "" : (" (0.." + lastSheetIx + ")")));
}
if(index == -1) {
- if(ctName.isSetLocalSheetId()) ctName.unsetLocalSheetId();
+ if(_ctName.isSetLocalSheetId()) _ctName.unsetLocalSheetId();
} else {
- ctName.setLocalSheetId(index);
+ _ctName.setLocalSheetId(index);
}
}
@@ -232,7 +232,7 @@ public final class XSSFName implements Name {
* @return the sheet index this name applies to, -1 if this name applies to the entire workbook
*/
public int getSheetIndex() {
- return ctName.isSetLocalSheetId() ? (int) ctName.getLocalSheetId() : -1;
+ return _ctName.isSetLocalSheetId() ? (int) _ctName.getLocalSheetId() : -1;
}
/**
@@ -242,7 +242,7 @@ public final class XSSFName implements Name {
* @param value <code>true</code> indicates the name refers to a function.
*/
public void setFunction(boolean value) {
- ctName.setFunction(value);
+ _ctName.setFunction(value);
}
/**
@@ -252,7 +252,7 @@ public final class XSSFName implements Name {
* @return <code>true</code> indicates the name refers to a function.
*/
public boolean getFunction() {
- return ctName.getFunction();
+ return _ctName.getFunction();
}
/**
@@ -263,7 +263,7 @@ public final class XSSFName implements Name {
* @param functionGroupId the function group index that defines the general category for the function
*/
public void setFunctionGroupId(int functionGroupId) {
- ctName.setFunctionGroupId(functionGroupId);
+ _ctName.setFunctionGroupId(functionGroupId);
}
/**
@@ -274,7 +274,7 @@ public final class XSSFName implements Name {
* @return the function group index that defines the general category for the function
*/
public int getFunctionGroupId() {
- return (int) ctName.getFunctionGroupId();
+ return (int) _ctName.getFunctionGroupId();
}
/**
@@ -284,15 +284,14 @@ public final class XSSFName implements Name {
* Empty string if the referenced sheet name weas not found.
*/
public String getSheetName() {
- if (ctName.isSetLocalSheetId()) {
+ if (_ctName.isSetLocalSheetId()) {
// Given as explicit sheet id
- int sheetId = (int)ctName.getLocalSheetId();
- return workbook.getSheetName(sheetId);
- } else {
- String ref = getRefersToFormula();
- AreaReference areaRef = new AreaReference(ref);
- return areaRef.getFirstCell().getSheetName();
+ int sheetId = (int)_ctName.getLocalSheetId();
+ return _workbook.getSheetName(sheetId);
}
+ String ref = getRefersToFormula();
+ AreaReference areaRef = new AreaReference(ref);
+ return areaRef.getFirstCell().getSheetName();
}
/**
@@ -310,7 +309,7 @@ public final class XSSFName implements Name {
* @return the user comment for this named range
*/
public String getComment() {
- return ctName.getComment();
+ return _ctName.getComment();
}
/**
@@ -319,12 +318,12 @@ public final class XSSFName implements Name {
* @param comment the user comment for this named range
*/
public void setComment(String comment) {
- ctName.setComment(comment);
+ _ctName.setComment(comment);
}
@Override
public int hashCode() {
- return ctName.toString().hashCode();
+ return _ctName.toString().hashCode();
}
/**
@@ -343,7 +342,7 @@ public final class XSSFName implements Name {
if (!(o instanceof XSSFName)) return false;
XSSFName cf = (XSSFName) o;
- return ctName.toString().equals(cf.getCTName().toString());
+ return _ctName.toString().equals(cf.getCTName().toString());
}
private static void validateName(String name){
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
index 702f549ba7..42cd41a3e3 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
@@ -42,7 +42,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
/**
- *
+ *
*/
public final class XSSFRelation extends POIXMLRelation {
@@ -114,28 +114,28 @@ public final class XSSFRelation extends POIXMLRelation {
"/xl/drawings/vmlDrawing#.vml",
null
);
-
+
public static final XSSFRelation CUSTOM_XML_MAPPINGS = new XSSFRelation(
"application/xml",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/xmlMaps",
"/xl/xmlMaps.xml",
MapInfo.class
);
-
+
public static final XSSFRelation SINGLE_XML_CELLS = new XSSFRelation(
"application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells",
"/tables/tableSingleCells#.xml",
SingleXmlCells.class
);
-
+
public static final XSSFRelation TABLE = new XSSFRelation(
"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
"/tables/table#.xml",
Table.class
);
-
+
public static final XSSFRelation IMAGES = new XSSFRelation(
null,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
@@ -234,7 +234,7 @@ public final class XSSFRelation extends POIXMLRelation {
"/xl/calcChain.xml",
CalculationChain.class
);
-
+
private XSSFRelation(String type, String rel, String defaultName, Class<? extends POIXMLDocumentPart> cls) {
super(type, rel, defaultName, cls);
@@ -256,10 +256,9 @@ public final class XSSFRelation extends POIXMLRelation {
PackagePartName relName = PackagingURIHelper.createPartName(rel.getTargetURI());
PackagePart part = corePart.getPackage().getPart(relName);
return part.getInputStream();
- } else {
- log.log(POILogger.WARN, "No part " + _defaultName + " found");
- return null;
}
+ log.log(POILogger.WARN, "No part " + _defaultName + " found");
+ return null;
}
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
index 879faeed8a..aa4e87f78e 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
@@ -324,14 +324,14 @@ public class XSSFRichTextString implements RichTextString {
* Returns the plain string representation.
*/
public String getString() {
- if(st.sizeOfRArray() == 0) return st.getT();
- else {
- StringBuffer buf = new StringBuffer();
- for(CTRElt r : st.getRArray()){
- buf.append(r.getT());
- }
- return buf.toString();
+ if(st.sizeOfRArray() == 0) {
+ return st.getT();
+ }
+ StringBuffer buf = new StringBuffer();
+ for(CTRElt r : st.getRArray()){
+ buf.append(r.getT());
}
+ return buf.toString();
}
/**
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
index 4cd7c41634..ee0c9af245 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java
@@ -38,18 +38,18 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
/**
* the xml bean containing all cell definitions for this row
*/
- private final CTRow row;
+ private final CTRow _row;
/**
* Cells of this row keyed by their column indexes.
* The TreeMap ensures that the cells are ordered by columnIndex in the ascending order.
*/
- private final TreeMap<Integer, Cell> cells;
+ private final TreeMap<Integer, Cell> _cells;
/**
* the parent sheet
*/
- private final XSSFSheet sheet;
+ private final XSSFSheet _sheet;
/**
* Construct a XSSFRow.
@@ -58,12 +58,12 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @param sheet the parent sheet.
*/
protected XSSFRow(CTRow row, XSSFSheet sheet) {
- this.row = row;
- this.sheet = sheet;
- this.cells = new TreeMap<Integer, Cell>();
+ _row = row;
+ _sheet = sheet;
+ _cells = new TreeMap<Integer, Cell>();
for (CTCell c : row.getCArray()) {
XSSFCell cell = new XSSFCell(this, c);
- cells.put(cell.getColumnIndex(), cell);
+ _cells.put(cell.getColumnIndex(), cell);
sheet.onReadCell(cell);
}
}
@@ -74,7 +74,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @return the XSSFSheet that owns this row
*/
public XSSFSheet getSheet() {
- return this.sheet;
+ return this._sheet;
}
/**
@@ -89,7 +89,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @return an iterator over cells in this row.
*/
public Iterator<Cell> cellIterator() {
- return cells.values().iterator();
+ return _cells.values().iterator();
}
/**
@@ -164,7 +164,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
if (type != Cell.CELL_TYPE_BLANK) {
xcell.setCellType(type);
}
- cells.put(columnIndex, xcell);
+ _cells.put(columnIndex, xcell);
return xcell;
}
@@ -175,7 +175,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @return the cell at the given (0 based) index
*/
public XSSFCell getCell(int cellnum) {
- return getCell(cellnum, sheet.getWorkbook().getMissingCellPolicy());
+ return getCell(cellnum, _sheet.getWorkbook().getMissingCellPolicy());
}
/**
@@ -190,7 +190,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
public XSSFCell getCell(int cellnum, MissingCellPolicy policy) {
if(cellnum < 0) throw new IllegalArgumentException("Cell index must be >= 0");
- XSSFCell cell = (XSSFCell)cells.get(cellnum);
+ XSSFCell cell = (XSSFCell)_cells.get(cellnum);
if(policy == RETURN_NULL_AND_BLANK) {
return cell;
}
@@ -217,7 +217,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* or -1 if the row does not contain any cells.
*/
public short getFirstCellNum() {
- return (short)(cells.size() == 0 ? -1 : cells.firstKey());
+ return (short)(_cells.size() == 0 ? -1 : _cells.firstKey());
}
/**
@@ -240,7 +240,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* or -1 if the row does not contain any cells.
*/
public short getLastCellNum() {
- return (short)(cells.size() == 0 ? -1 : (cells.lastKey() + 1));
+ return (short)(_cells.size() == 0 ? -1 : (_cells.lastKey() + 1));
}
/**
@@ -261,11 +261,10 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @see org.apache.poi.xssf.usermodel.XSSFSheet#getDefaultRowHeightInPoints()
*/
public float getHeightInPoints() {
- if (this.row.isSetHt()) {
- return (float) this.row.getHt();
- } else {
- return sheet.getDefaultRowHeightInPoints();
+ if (this._row.isSetHt()) {
+ return (float) this._row.getHt();
}
+ return _sheet.getDefaultRowHeightInPoints();
}
/**
@@ -275,11 +274,11 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
*/
public void setHeight(short height) {
if (height == -1) {
- if (row.isSetHt()) row.unsetHt();
- if (row.isSetCustomHeight()) row.unsetCustomHeight();
+ if (_row.isSetHt()) _row.unsetHt();
+ if (_row.isSetCustomHeight()) _row.unsetCustomHeight();
} else {
- row.setHt((double) height / 20);
- row.setCustomHeight(true);
+ _row.setHt((double) height / 20);
+ _row.setCustomHeight(true);
}
}
@@ -300,7 +299,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @return int representing the number of defined cells in the row.
*/
public int getPhysicalNumberOfCells() {
- return cells.size();
+ return _cells.size();
}
/**
@@ -309,7 +308,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @return the row number (0 based)
*/
public int getRowNum() {
- return (int) (row.getR() - 1);
+ return (int) (_row.getR() - 1);
}
/**
@@ -321,10 +320,10 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
public void setRowNum(int rowIndex) {
int maxrow = SpreadsheetVersion.EXCEL2007.getLastRowIndex();
if (rowIndex < 0 || rowIndex > maxrow) {
- throw new IllegalArgumentException("Invalid row number (" + rowIndex
+ throw new IllegalArgumentException("Invalid row number (" + rowIndex
+ ") outside allowable range (0.." + maxrow + ")");
}
- row.setR(rowIndex + 1);
+ _row.setR(rowIndex + 1);
}
/**
@@ -333,7 +332,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @return - height is zero or not.
*/
public boolean getZeroHeight() {
- return this.row.getHidden();
+ return this._row.getHidden();
}
/**
@@ -342,7 +341,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @param height height is zero or not.
*/
public void setZeroHeight(boolean height) {
- this.row.setHidden(height);
+ this._row.setHidden(height);
}
@@ -352,7 +351,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @param cell the cell to remove
*/
public void removeCell(Cell cell) {
- cells.remove(cell.getColumnIndex());
+ _cells.remove(cell.getColumnIndex());
}
/**
@@ -361,7 +360,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @return the underlying CTRow xml bean
*/
public CTRow getCTRow(){
- return row;
+ return _row;
}
/**
@@ -372,14 +371,14 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* @see org.apache.poi.xssf.usermodel.XSSFSheet#commit()
*/
protected void onDocumentWrite(){
- ArrayList<CTCell> cArray = new ArrayList<CTCell>(cells.size());
+ ArrayList<CTCell> cArray = new ArrayList<CTCell>(_cells.size());
//create array of CTCell objects.
//TreeMap's value iterator ensures that the cells are ordered by columnIndex in the ascending order
- for (Cell cell : cells.values()) {
+ for (Cell cell : _cells.values()) {
XSSFCell c = (XSSFCell)cell;
cArray.add(c.getCTCell());
}
- row.setCArray(cArray.toArray(new CTCell[cArray.size()]));
+ _row.setCArray(cArray.toArray(new CTCell[cArray.size()]));
}
/**
@@ -387,7 +386,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
*/
@Override
public String toString(){
- return row.toString();
+ return _row.toString();
}
/**
@@ -397,8 +396,8 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
*/
protected void shift(int n) {
int rownum = getRowNum() + n;
- CalculationChain calcChain = sheet.getWorkbook().getCalculationChain();
- int sheetId = (int)sheet.sheet.getSheetId();
+ CalculationChain calcChain = _sheet.getWorkbook().getCalculationChain();
+ int sheetId = (int)_sheet.sheet.getSheetId();
for(Cell c : this){
XSSFCell cell = (XSSFCell)c;
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
index 77d4b5c34e..bd2b5b875b 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
@@ -434,8 +434,10 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
}
public XSSFComment getCellComment(int row, int column) {
- if (sheetComments == null) return null;
- else return sheetComments.findCellComment(row, column);
+ if (sheetComments == null) {
+ return null;
+ }
+ return sheetComments.findCellComment(row, column);
}
public XSSFHyperlink getHyperlink(int row, int column) {
@@ -1915,9 +1917,8 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
}
if (endLevel > startLevel) {
return endHidden;
- } else {
- return startHidden;
}
+ return startHidden;
}
/**
@@ -1925,10 +1926,10 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
*/
private boolean isRowGroupCollapsed(int row) {
int collapseRow = findEndOfRowOutlineGroup(row) + 1;
- if (getRow(collapseRow) == null)
- return false;
- else
- return getRow(collapseRow).getCTRow().getCollapsed();
+ if (getRow(collapseRow) == null) {
+ return false;
+ }
+ return getRow(collapseRow).getCTRow().getCollapsed();
}
/**
diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
index 2d0caf1b5f..91e1c13481 100644
--- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
+++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
@@ -89,7 +89,7 @@ public class XWPFParagraph {
if (o instanceof CTFtnEdnRef) {
CTFtnEdnRef ftn = (CTFtnEdnRef) o;
footnoteText.append("[").append(ftn.getId()).append(": ");
- XWPFFootnote footnote =
+ XWPFFootnote footnote =
ftn.getDomNode().getLocalName().equals("footnoteReference") ?
document.getFootnoteByID(ftn.getId().intValue()) :
document.getEndnoteByID(ftn.getId().intValue());
@@ -582,10 +582,10 @@ public class XWPFParagraph {
CTOnOff ct_pageBreak = ppr.isSetPageBreakBefore() ? ppr
.getPageBreakBefore() : null;
if (ct_pageBreak != null
- && ct_pageBreak.getVal().intValue() == STOnOff.INT_TRUE)
+ && ct_pageBreak.getVal().intValue() == STOnOff.INT_TRUE) {
return true;
- else
- return false;
+ }
+ return false;
}
/**
@@ -934,8 +934,8 @@ public class XWPFParagraph {
return (wordWrap.getVal() == STOnOff.ON
|| wordWrap.getVal() == STOnOff.TRUE || wordWrap.getVal() == STOnOff.X_1) ? true
: false;
- } else
- return false;
+ }
+ return false;
}
/**
diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java
index 17d0465f58..774cf852c1 100644
--- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java
+++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java
@@ -155,10 +155,10 @@ public class XWPFTable {
* @return the row at the position specified or null if no rows is defined or if the position is greather than the max size of rows array
*/
public XWPFTableRow getRow(int pos) {
- if (pos >= 0 && pos < ctTbl.sizeOfTrArray())
+ if (pos >= 0 && pos < ctTbl.sizeOfTrArray()) {
return new XWPFTableRow(ctTbl.getTrArray(pos));
- else
- return null;
+ }
+ return null;
}
diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java
index d34541cfda..e2cea13fa2 100755
--- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java
+++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java
@@ -44,10 +44,10 @@ public class XWPFTableRow {
}
public XWPFTableCell getCell(int pos) {
- if (pos >= 0 && pos < ctRow.sizeOfTcArray())
+ if (pos >= 0 && pos < ctRow.sizeOfTcArray()) {
return new XWPFTableCell(ctRow.getTcArray(pos));
- else
- return null;
+ }
+ return null;
}
/**