Compare commits
30 Commits
Author | SHA1 | Date |
---|---|---|
Tim Allison | c2dc3ad585 | |
Greg Woolsey | f5b90cbbee | |
Javen O'Neal | 3c2a6b38bb | |
Javen O'Neal | 3cbf4740b1 | |
Greg Woolsey | 6e0a5916b5 | |
Greg Woolsey | d1b92fe2d8 | |
Nick Burch | d4d08d5ce8 | |
Dominik Stadler | 511c2544a8 | |
Andreas Beeker | c89d312bad | |
Andreas Beeker | 7df2a8804c | |
Andreas Beeker | 544657556a | |
Andreas Beeker | 594b46f1cd | |
Andreas Beeker | bd237e2483 | |
Andreas Beeker | 3d53258942 | |
Dominik Stadler | f0b2404b86 | |
Dominik Stadler | 14086f953f | |
Dominik Stadler | 30d6ba68c7 | |
Dominik Stadler | 3e06696ae3 | |
Dominik Stadler | 89976adea2 | |
Javen O'Neal | 21f5fc8eaf | |
Javen O'Neal | dc29c94460 | |
Javen O'Neal | abc2f1f9ea | |
Andreas Beeker | 160fb550c1 | |
Javen O'Neal | 0acf44d3dc | |
Javen O'Neal | ef8c9329cf | |
Javen O'Neal | e7ca1594da | |
Javen O'Neal | 7977026f96 | |
Nick Burch | 70ae27f96d | |
Nick Burch | 3bd1f662f3 | |
Andreas Beeker | 1078cef19c |
|
@ -32,5 +32,5 @@
|
|||
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.10.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-collections4-4.1.jar"/>
|
||||
<classpathentry kind="output" path="build/eclipse"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,21 +1,47 @@
|
|||
classes
|
||||
workbook.xls
|
||||
bak
|
||||
*.iws
|
||||
build.number
|
||||
*.el
|
||||
TEST-org.apache.poi*.xml
|
||||
build
|
||||
.settings
|
||||
scripts
|
||||
*.ipr
|
||||
untitled1.jpx
|
||||
*.iml
|
||||
log*.*
|
||||
dist
|
||||
*.log
|
||||
bin
|
||||
.ant-targets-build.xml
|
||||
out
|
||||
|
||||
forrest.properties
|
||||
compile-lib/
|
||||
ooxml-lib/
|
||||
|
||||
# Eclipse
|
||||
/bin
|
||||
.settings
|
||||
|
||||
# Tests
|
||||
junit*.properties
|
||||
TEST-org.apache.poi*.xml
|
||||
|
||||
# Sonar
|
||||
.sonar
|
||||
sonar/main/src/
|
||||
sonar/ooxml/src/
|
||||
sonar/scratchpad/src/
|
||||
sonar/ooxml-schema-security/src/
|
||||
sonar/examples/src/
|
||||
sonar/excelant/src/
|
||||
sonar/target
|
||||
sonar/*/target
|
||||
|
||||
# IntelliJ
|
||||
/out/
|
||||
.idea
|
||||
*.iml
|
||||
*.iws
|
||||
*.ipr
|
||||
|
||||
# Gradle
|
||||
.gradle
|
||||
|
||||
# Ant
|
||||
.ant-targets-build.xml
|
||||
build
|
||||
dist
|
||||
|
|
|
@ -40,7 +40,7 @@ under the License.
|
|||
|
||||
<description>The Apache POI project Ant build.</description>
|
||||
|
||||
<property name="version.id" value="3.16"/>
|
||||
<property name="version.id" value="3.17-beta1"/>
|
||||
<property name="release.rc" value="RC1"/>
|
||||
|
||||
<property environment="env"/>
|
||||
|
@ -2712,11 +2712,11 @@ under the License.
|
|||
to track progress.</p>
|
||||
<p>
|
||||
The POI source release as well as the pre-built binary deployment packages are listed below.
|
||||
Pre-built versions of all <link href="index.html#components">POI components</link>
|
||||
Pre-built versions of all <link href="overview.html#components">POI components</link>
|
||||
are available in the central Maven repository under Group ID "org.apache.poi" and Version
|
||||
"${version.id}".
|
||||
</p>
|
||||
<section><title>Binary Distribution</title>
|
||||
<section id="POI-${version.id}-bin"><title>Binary Distribution</title>
|
||||
<ul>
|
||||
<li><link href="https://www.apache.org/dyn/closer.lua/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.tar.gz">poi-bin-${version.id}-${file_date}.tar.gz</link>
|
||||
(${bin-tar-size} MB, <link href="https://www.apache.org/dist/poi/${reltype}/bin/poi-bin-${version.id}-${file_date}.tar.gz.asc">signature (.asc)</link>)
|
||||
|
@ -2738,7 +2738,7 @@ under the License.
|
|||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section><title>Source Distribution</title>
|
||||
<section id="POI-${version.id}-src"><title>Source Distribution</title>
|
||||
<ul>
|
||||
<li><link href="https://www.apache.org/dyn/closer.lua/poi/${reltype}/src/poi-src-${version.id}-${file_date}.tar.gz">poi-src-${version.id}-${file_date}.tar.gz</link>
|
||||
(${src-tar-size} MB, <link href="https://www.apache.org/dist/poi/${reltype}/src/poi-src-${version.id}-${file_date}.tar.gz.asc">signature (.asc)</link>)
|
||||
|
|
|
@ -35,6 +35,13 @@
|
|||
<programming-language>Java</programming-language>
|
||||
<category rdf:resource="https://projects.apache.org/category/content" />
|
||||
<category rdf:resource="https://projects.apache.org/category/library" />
|
||||
<release>
|
||||
<Version>
|
||||
<name>Apache POI 3.16</name>
|
||||
<created>2017-04-19</created>
|
||||
<revision>3.16</revision>
|
||||
</Version>
|
||||
</release>
|
||||
<release>
|
||||
<Version>
|
||||
<name>Apache POI 3.15</name>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
# JaCoCo Agent
|
||||
sun.instrument.InstrumentationImpl.loadClassAndStartAgent
|
||||
org.jacoco.agent.rt.internal_14f7ee5.output.FileOutput.openFile
|
||||
|
||||
# Ant Junit
|
||||
org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter.getDocumentBuilder
|
||||
|
||||
# JVM
|
||||
sun.security.jca.ProviderConfig.doLoadProvider
|
||||
javax.xml.parsers.FactoryFinder.findJarServiceProvider
|
||||
com.sun.org.apache.xerces.internal.utils.SecuritySupport.getResourceBundle
|
||||
|
||||
# Codepage support loads classes
|
||||
java.nio.charset.Charset.lookupViaProviders
|
||||
|
||||
# Ant
|
||||
org.apache.tools.ant.Main.getAntVersion
|
||||
javax.xml.parsers.FactoryFinder.findJarServiceProvider
|
||||
org.apache.tools.ant.taskdefs.Antlib.createAntlib
|
||||
|
||||
# XML Parser
|
||||
com.sun.org.apache.xerces.internal.utils.SecuritySupport.getResourceBundle
|
||||
com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory.loadPropertiesFile
|
||||
com.sun.xml.internal.bind.v2.runtime.property.ArrayElementNodeProperty.<init>
|
||||
com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty.<init>
|
||||
com.sun.xml.internal.bind.v2.runtime.property.SingleElementNodeProperty.<init>
|
||||
javax.xml.stream.FactoryFinder.findJarServiceProvider
|
||||
|
||||
# XMLBeans
|
||||
org.apache.xmlbeans.impl.regex.RegexParser.setLocale
|
||||
org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl$XsbReader.getLoaderStream
|
||||
|
||||
# JCA
|
||||
sun.security.jca.ProviderConfig.getProvider
|
||||
javax.crypto.JceSecurity.setupJurisdictionPolicies
|
||||
javax.crypto.Cipher.getMaxAllowedKeyLength
|
||||
|
||||
# IntelliJ
|
||||
com.intellij.junit4.JUnit4TestRunnerUtil.<clinit>
|
||||
|
||||
# Java
|
||||
sun.util.resources.LocaleData.getBundle
|
||||
sun.util.LocaleServiceProviderPool.<init>
|
||||
sun.util.calendar.LocalGregorianCalendar.getLocalGregorianCalendar
|
||||
sun.net.www.protocol.jar.JarURLConnection.getInputStream
|
||||
sun.text.normalizer.ICUData.getStream
|
||||
sun.font.T2KFontScaler.initNativeScaler
|
||||
sun.font.SunFontManager.loadFonts
|
||||
sun.font.FontManagerFactory.getInstance
|
||||
sun.font.TrueTypeFont.open
|
||||
sun.reflect.misc.MethodUtil.<clinit>
|
||||
java.util.logging.Logger.findSystemResourceBundle
|
||||
java.text.BreakIterator.getBundle
|
||||
sun.java2d.SunGraphicsEnvironment.<init>
|
||||
org.kohsuke.file_leak_detector.AgentMain.runHttpServer
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>poi-examples</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>poi-excelant</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>poi-main</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>poi-ooxml-schema-encryption</artifactId>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>poi-ooxml-schema-security</artifactId>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
<relativePath>..</relativePath>
|
||||
</parent>
|
||||
<artifactId>poi-ooxml-schema</artifactId>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
<name>Apache POI - the Java API for Microsoft Documents</name>
|
||||
<description>Maven build of Apache POI for Sonar checks</description>
|
||||
<url>http://poi.apache.org/</url>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-parent</artifactId>
|
||||
<version>3.16-beta3-SNAPSHOT</version>
|
||||
<version>3.17-beta1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
|
|
@ -142,7 +142,7 @@ public class CopyCompare
|
|||
if (equal(oRoot, cRoot, messages)) {
|
||||
System.out.println("Equal");
|
||||
} else {
|
||||
System.out.println("Not equal: " + messages.toString());
|
||||
System.out.println("Not equal: " + messages);
|
||||
}
|
||||
cpfs.close();
|
||||
opfs.close();
|
||||
|
|
|
@ -159,7 +159,7 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer
|
|||
b.append(' ');
|
||||
System.arraycopy(value, ((byte[])value).length - 4, buf, 0, 4);
|
||||
} else if (value != null) {
|
||||
b.append(value.toString());
|
||||
b.append(value);
|
||||
} else {
|
||||
b.append("null");
|
||||
}
|
||||
|
|
|
@ -21,9 +21,14 @@ package org.apache.poi.ss.examples;
|
|||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.formula.ConditionalFormattingEvaluator;
|
||||
import org.apache.poi.ss.formula.EvaluationConditionalFormatRule;
|
||||
import org.apache.poi.ss.formula.WorkbookEvaluatorProvider;
|
||||
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.ColorScaleFormatting;
|
||||
import org.apache.poi.ss.usermodel.ComparisonOperator;
|
||||
|
@ -41,6 +46,7 @@ import org.apache.poi.ss.usermodel.Sheet;
|
|||
import org.apache.poi.ss.usermodel.SheetConditionalFormatting;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
/**
|
||||
|
@ -53,6 +59,12 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||
*/
|
||||
public class ConditionalFormats {
|
||||
|
||||
/**
|
||||
* generates a sample workbook with conditional formatting,
|
||||
* and prints out a summary of applied formats for one sheet
|
||||
* @param args pass "-xls" to generate an HSSF workbook, default is XSSF
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
Workbook wb;
|
||||
|
||||
|
@ -76,6 +88,9 @@ public class ConditionalFormats {
|
|||
colourScales(wb.createSheet("Colour Scales"));
|
||||
dataBars(wb.createSheet("Data Bars"));
|
||||
|
||||
// print overlapping rule results
|
||||
evaluateRules(wb, "Overlapping");
|
||||
|
||||
// Write the output to a file
|
||||
String file = "cf-poi.xls";
|
||||
if(wb instanceof XSSFWorkbook) {
|
||||
|
@ -637,4 +652,76 @@ public class ConditionalFormats {
|
|||
db3.getMaxThreshold().setRangeType(RangeType.MAX);
|
||||
sheetCF.addConditionalFormatting(regions, rule3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print out a summary of the conditional formatting rules applied to cells on the given sheet.
|
||||
* Only cells with a matching rule are printed, and for those, all matching rules are sumarized.
|
||||
* @param wb
|
||||
* @param sheetName
|
||||
*/
|
||||
static void evaluateRules(Workbook wb, String sheetName) {
|
||||
final WorkbookEvaluatorProvider wbEvalProv = (WorkbookEvaluatorProvider) wb.getCreationHelper().createFormulaEvaluator();
|
||||
final ConditionalFormattingEvaluator cfEval = new ConditionalFormattingEvaluator(wb, wbEvalProv);
|
||||
// if cell values have changed, clear cached format results
|
||||
cfEval.clearAllCachedValues();
|
||||
|
||||
final Sheet sheet = wb.getSheet(sheetName);
|
||||
for (Row r : sheet) {
|
||||
for (Cell c : r) {
|
||||
final List<EvaluationConditionalFormatRule> rules = cfEval.getConditionalFormattingForCell(c);
|
||||
// check rules list for null, although current implementation will return an empty list, not null, then do what you want with results
|
||||
if (rules == null || rules.isEmpty()) continue;
|
||||
final CellReference ref = ConditionalFormattingEvaluator.getRef(c);
|
||||
if (rules.isEmpty()) continue;
|
||||
|
||||
System.out.println("\n"
|
||||
+ ref.formatAsString()
|
||||
+ " has conditional formatting.");
|
||||
|
||||
for (EvaluationConditionalFormatRule rule : rules) {
|
||||
ConditionalFormattingRule cf = rule.getRule();
|
||||
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append("\tRule ")
|
||||
.append(rule.getFormattingIndex())
|
||||
.append(": ");
|
||||
|
||||
// check for color scale
|
||||
if (cf.getColorScaleFormatting() != null) {
|
||||
b.append("\n\t\tcolor scale (caller must calculate bucket)");
|
||||
}
|
||||
// check for data bar
|
||||
if (cf.getDataBarFormatting() != null) {
|
||||
b.append("\n\t\tdata bar (caller must calculate bucket)");
|
||||
}
|
||||
// check for icon set
|
||||
if (cf.getMultiStateFormatting() != null) {
|
||||
b.append("\n\t\ticon set (caller must calculate icon bucket)");
|
||||
}
|
||||
// check for fill
|
||||
if (cf.getPatternFormatting() != null) {
|
||||
final PatternFormatting fill = cf.getPatternFormatting();
|
||||
b.append("\n\t\tfill pattern ")
|
||||
.append(fill.getFillPattern())
|
||||
.append(" color index ")
|
||||
.append(fill.getFillBackgroundColor());
|
||||
}
|
||||
// font stuff
|
||||
if (cf.getFontFormatting() != null) {
|
||||
final FontFormatting ff = cf.getFontFormatting();
|
||||
b.append("\n\t\tfont format ")
|
||||
.append("color index ")
|
||||
.append(ff.getFontColorIndex());
|
||||
if (ff.isBold()) b.append(" bold");
|
||||
if (ff.isItalic()) b.append(" italic");
|
||||
if (ff.isStruckout()) b.append(" strikeout");
|
||||
b.append(" underline index ")
|
||||
.append(ff.getUnderlineType());
|
||||
}
|
||||
|
||||
System.out.println(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,8 +89,8 @@ public class CheckFunctionsSupported {
|
|||
System.out.println(" All cells evaluated without error");
|
||||
} else {
|
||||
for (CellReference cr : probs.unevaluatableCells.keySet()) {
|
||||
System.out.println(" " + cr.formatAsString() + " - " +
|
||||
probs.unevaluatableCells.get(cr).toString());
|
||||
System.out.println(" " + cr.formatAsString() + " - " +
|
||||
probs.unevaluatableCells.get(cr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class IterateCells {
|
|||
for (Row row : sheet) {
|
||||
System.out.println("rownum: " + row.getRowNum());
|
||||
for (Cell cell : row) {
|
||||
System.out.println(cell.toString());
|
||||
System.out.println(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,9 +198,9 @@ public class TestExcelAntWorkbookUtil extends TestCase {
|
|||
precision);
|
||||
|
||||
//System.out.println(result);
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("evaluationCompletedWithError=false"));
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("returnValue=790.79"));
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("cellName='MortgageCalculator'!B4"));
|
||||
assertTrue("Had:" + result, result.toString().contains("evaluationCompletedWithError=false"));
|
||||
assertTrue("Had:" + result, result.toString().contains("returnValue=790.79"));
|
||||
assertTrue("Had:" + result, result.toString().contains("cellName='MortgageCalculator'!B4"));
|
||||
assertFalse(result.toString().contains("#N/A"));
|
||||
|
||||
assertFalse(result.evaluationCompleteWithError());
|
||||
|
@ -220,10 +220,10 @@ public class TestExcelAntWorkbookUtil extends TestCase {
|
|||
precision);
|
||||
|
||||
//System.out.println(result);
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("evaluationCompletedWithError=false"));
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("returnValue=790.79"));
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("cellName='MortgageCalculator'!B4"));
|
||||
assertFalse("Should not see an error, but had:" + result.toString(), result.toString().contains("#"));
|
||||
assertTrue("Had:" + result, result.toString().contains("evaluationCompletedWithError=false"));
|
||||
assertTrue("Had:" + result, result.toString().contains("returnValue=790.79"));
|
||||
assertTrue("Had:" + result, result.toString().contains("cellName='MortgageCalculator'!B4"));
|
||||
assertFalse("Should not see an error, but had:" + result, result.toString().contains("#"));
|
||||
|
||||
assertFalse(result.evaluationCompleteWithError());
|
||||
assertFalse(result.didTestPass());
|
||||
|
@ -242,10 +242,10 @@ public class TestExcelAntWorkbookUtil extends TestCase {
|
|||
precision);
|
||||
|
||||
System.out.println(result);
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("evaluationCompletedWithError=true"));
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("returnValue=0.0"));
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("cellName='ErrorCell'!A1"));
|
||||
assertTrue("Had:" + result.toString(), result.toString().contains("#N/A"));
|
||||
assertTrue("Had:" + result, result.toString().contains("evaluationCompletedWithError=true"));
|
||||
assertTrue("Had:" + result, result.toString().contains("returnValue=0.0"));
|
||||
assertTrue("Had:" + result, result.toString().contains("cellName='ErrorCell'!A1"));
|
||||
assertTrue("Had:" + result, result.toString().contains("#N/A"));
|
||||
|
||||
assertTrue(result.evaluationCompleteWithError());
|
||||
assertFalse(result.didTestPass());
|
||||
|
|
|
@ -40,10 +40,10 @@ public class HMEFFileHandler extends AbstractFileHandler {
|
|||
|
||||
// there are two test-files that have no body...
|
||||
if(!msg.getSubject().equals("Testing TNEF Message") && !msg.getSubject().equals("TNEF test message with attachments")) {
|
||||
assertNotNull("Had: " + msg.getBody() + ", " + msg.getSubject() + ", " + msg.getAttachments() + ": " + props.toString(),
|
||||
assertNotNull("Had: " + msg.getBody() + ", " + msg.getSubject() + ", " + msg.getAttachments() + ": " + props,
|
||||
msg.getBody());
|
||||
}
|
||||
assertNotNull("Had: " + msg.getBody() + ", " + msg.getSubject() + ", " + msg.getAttachments() + ": " + props.toString(),
|
||||
assertNotNull("Had: " + msg.getBody() + ", " + msg.getSubject() + ", " + msg.getAttachments() + ": " + props,
|
||||
msg.getSubject());
|
||||
}
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ public abstract class AbstractEscherOptRecord extends EscherRecord
|
|||
|
||||
for ( EscherProperty property : properties )
|
||||
{
|
||||
stringBuilder.append(" ").append(property.toString()).append(nl);
|
||||
stringBuilder.append(" ").append(property).append(nl);
|
||||
}
|
||||
|
||||
return stringBuilder.toString();
|
||||
|
|
|
@ -134,7 +134,7 @@ public final class EscherArrayProperty extends EscherComplexProperty implements
|
|||
+ ", propName: " + EscherProperties.getPropertyName( getPropertyNumber() )
|
||||
+ ", complex: " + isComplex()
|
||||
+ ", blipId: " + isBlipId()
|
||||
+ ", data: " + '\n' + results.toString();
|
||||
+ ", data: " + '\n' + results;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -294,7 +294,7 @@ public final class EscherContainerRecord extends EscherRecord implements Iterabl
|
|||
+ " instance: 0x" + HexDump.toHex( getInstance() ) + nl
|
||||
+ " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl
|
||||
+ " numchildren: " + _childRecords.size() + nl
|
||||
+ children.toString();
|
||||
+ children;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -145,7 +145,7 @@ public final class EscherDggRecord extends EscherRecord {
|
|||
" NumIdClusters: " + getNumIdClusters() + '\n' +
|
||||
" NumShapesSaved: " + field_3_numShapesSaved + '\n' +
|
||||
" DrawingsSaved: " + field_4_drawingsSaved + '\n' +
|
||||
"" + field_5_string.toString();
|
||||
"" + field_5_string;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public final class EscherDump {
|
|||
{
|
||||
EscherRecord r = recordFactory.createRecord(data, pos);
|
||||
int bytesRead = r.fillFields(data, pos, recordFactory );
|
||||
out.println( r.toString() );
|
||||
out.println(r);
|
||||
pos += bytesRead;
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ public final class EscherDump {
|
|||
stringBuf.append( HexDump.toHex( recordBytesRemaining ) );
|
||||
stringBuf.append( "] instance: " );
|
||||
stringBuf.append( HexDump.toHex( ( (short) ( options >> 4 ) ) ) );
|
||||
out.println( stringBuf.toString() );
|
||||
out.println(stringBuf);
|
||||
stringBuf.setLength(0);
|
||||
|
||||
|
||||
|
@ -222,7 +222,7 @@ public final class EscherDump {
|
|||
n8 = (byte) in.read();
|
||||
stringBuf.append( HexDump.toHex( n8 ) );
|
||||
stringBuf.append( getBlipType( n8 ) );
|
||||
out.println( stringBuf.toString() );
|
||||
out.println(stringBuf);
|
||||
|
||||
out.println( " rgbUid:" );
|
||||
HexDump.dump( in, out, 0, 16 );
|
||||
|
|
|
@ -624,7 +624,7 @@ public final class EscherProperties {
|
|||
addProp( m, GROUPSHAPE__BORDERBOTTOMCOLOR, "groupshape.borderBottomColor" ); // 0x039D;
|
||||
addProp( m, GROUPSHAPE__BORDERRIGHTCOLOR, "groupshape.borderRightColor" ); // 0x039E;
|
||||
addProp( m, GROUPSHAPE__TABLEPROPERTIES, "groupshape.tableProperties" ); // 0x039F;
|
||||
addProp( m, GROUPSHAPE__TABLEROWPROPERTIES, "groupshape.tableRowProperties" ); // 0x03A0;
|
||||
addProp( m, GROUPSHAPE__TABLEROWPROPERTIES, "groupshape.tableRowProperties", EscherPropertyMetaData.TYPE_ARRAY ); // 0x03A0;
|
||||
addProp( m, GROUPSHAPE__WEBBOT, "groupshape.wzWebBot" ); // 0x03A5;
|
||||
addProp( m, GROUPSHAPE__METROBLOB, "groupshape.metroBlob" ); // 0x03A9;
|
||||
addProp( m, GROUPSHAPE__ZORDER, "groupshape.dhgt" ); // 0x03AA;
|
||||
|
|
|
@ -136,7 +136,7 @@ public final class UnknownEscherRecord extends EscherRecord implements Cloneable
|
|||
if (getChildRecords().size() > 0) {
|
||||
children.append( " children: " + '\n' );
|
||||
for (EscherRecord record : _childRecords) {
|
||||
children.append( record.toString() );
|
||||
children.append(record);
|
||||
children.append( '\n' );
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public final class UnknownEscherRecord extends EscherRecord implements Cloneable
|
|||
" recordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
|
||||
" numchildren: " + getChildRecords().size() + '\n' +
|
||||
theDumpHex +
|
||||
children.toString();
|
||||
children;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -415,7 +415,7 @@ public class Property {
|
|||
final Object value = getValue();
|
||||
b.append(", value: ");
|
||||
if (value instanceof String) {
|
||||
b.append(value.toString());
|
||||
b.append(value);
|
||||
final String s = (String) value;
|
||||
final int l = s.length();
|
||||
final byte[] bytes = new byte[l * 2];
|
||||
|
@ -439,7 +439,7 @@ public class Property {
|
|||
b.append(hex);
|
||||
}
|
||||
} else {
|
||||
b.append(value.toString());
|
||||
b.append(value);
|
||||
}
|
||||
b.append(']');
|
||||
return b.toString();
|
||||
|
|
|
@ -982,7 +982,7 @@ public class Section {
|
|||
b.append(getSize());
|
||||
b.append(", properties: [\n");
|
||||
for (int i = 0; i < pa.length; i++) {
|
||||
b.append(pa[i].toString());
|
||||
b.append(pa[i]);
|
||||
b.append(",\n");
|
||||
}
|
||||
b.append(']');
|
||||
|
|
|
@ -331,9 +331,9 @@ public class VariantSupport extends Variant {
|
|||
case Variant.VT_I4:
|
||||
if (!(value instanceof Integer)) {
|
||||
throw new ClassCastException("Could not cast an object to "
|
||||
+ Integer.class.toString() + ": "
|
||||
+ value.getClass().toString() + ", "
|
||||
+ value.toString());
|
||||
+ Integer.class + ": "
|
||||
+ value.getClass() + ", "
|
||||
+ value);
|
||||
}
|
||||
length += TypeWriter.writeToStream(out, ((Integer) value).intValue());
|
||||
break;
|
||||
|
|
|
@ -256,7 +256,7 @@ public final class BiffViewer {
|
|||
for (String header : recListener.getRecentHeaders()) {
|
||||
ps.println(header);
|
||||
}
|
||||
ps.print(record.toString());
|
||||
ps.print(record);
|
||||
} else {
|
||||
recStream.readRemainder();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class EFBiffViewer
|
|||
{
|
||||
public void processRecord(Record rec)
|
||||
{
|
||||
System.out.println(rec.toString());
|
||||
System.out.println(rec);
|
||||
}
|
||||
});
|
||||
HSSFEventFactory factory = new HSSFEventFactory();
|
||||
|
|
|
@ -132,7 +132,7 @@ public class FormulaViewer
|
|||
}
|
||||
buf.append(sep);
|
||||
buf.append(numArg);
|
||||
System.out.println(buf.toString());
|
||||
System.out.println(buf);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -342,7 +342,7 @@ public class ExcelExtractor extends POIOLE2TextExtractor implements org.apache.p
|
|||
case STRING:
|
||||
HSSFRichTextString str = cell.getRichStringCellValue();
|
||||
if(str != null && str.length() > 0) {
|
||||
text.append(str.toString());
|
||||
text.append(str);
|
||||
}
|
||||
break;
|
||||
case NUMERIC:
|
||||
|
|
|
@ -91,7 +91,7 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||
if (escherRecords.size() == 0)
|
||||
buffer.append("No Escher Records Decoded" + nl);
|
||||
for (EscherRecord r : escherRecords) {
|
||||
buffer.append(r.toString());
|
||||
buffer.append(r);
|
||||
}
|
||||
buffer.append("[/" + getRecordName() + ']' + nl);
|
||||
|
||||
|
|
|
@ -81,14 +81,14 @@ public final class ArrayRecord extends SharedValueRecordBase implements Cloneabl
|
|||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(getClass().getName()).append(" [ARRAY]\n");
|
||||
sb.append(" range=").append(getRange().toString()).append("\n");
|
||||
sb.append(" range=").append(getRange()).append("\n");
|
||||
sb.append(" options=").append(HexDump.shortToHex(_options)).append("\n");
|
||||
sb.append(" notUsed=").append(HexDump.intToHex(_field3notUsed)).append("\n");
|
||||
sb.append(" formula:").append("\n");
|
||||
Ptg[] ptgs = _formula.getTokens();
|
||||
for (int i = 0; i < ptgs.length; i++) {
|
||||
Ptg ptg = ptgs[i];
|
||||
sb.append(ptg.toString()).append(ptg.getRVAType()).append("\n");
|
||||
sb.append(ptg).append(ptg.getRVAType()).append("\n");
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
|
|
|
@ -130,7 +130,7 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
|
|||
buffer.append("\t.enclosingCellRange= ").append(getEnclosingCellRange()).append("\n");
|
||||
buffer.append("\t.cfranges=[");
|
||||
for( int i=0; i<field_4_cell_ranges.countRanges(); i++) {
|
||||
buffer.append(i==0?"":",").append(field_4_cell_ranges.getCellRangeAddress(i).toString());
|
||||
buffer.append(i==0?"":",").append(field_4_cell_ranges.getCellRangeAddress(i));
|
||||
}
|
||||
buffer.append("]\n");
|
||||
buffer.append("[/").append(getRecordName()).append("]\n");
|
||||
|
|
|
@ -425,13 +425,13 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord, Cl
|
|||
buffer.append(" .dxfn12_length =0x").append(Integer.toHexString(ext_formatting_length)).append("\n");
|
||||
buffer.append(" .option_flags =0x").append(Integer.toHexString(getOptions())).append("\n");
|
||||
if (containsFontFormattingBlock()) {
|
||||
buffer.append(_fontFormatting.toString()).append("\n");
|
||||
buffer.append(_fontFormatting).append("\n");
|
||||
}
|
||||
if (containsBorderFormattingBlock()) {
|
||||
buffer.append(_borderFormatting.toString()).append("\n");
|
||||
buffer.append(_borderFormatting).append("\n");
|
||||
}
|
||||
if (containsPatternFormattingBlock()) {
|
||||
buffer.append(_patternFormatting.toString()).append("\n");
|
||||
buffer.append(_patternFormatting).append("\n");
|
||||
}
|
||||
buffer.append(" .dxfn12_ext=").append(HexDump.toHex(ext_formatting_data)).append("\n");
|
||||
buffer.append(" .formula_1 =").append(Arrays.toString(getFormula1().getTokens())).append("\n");
|
||||
|
|
|
@ -141,13 +141,13 @@ public final class CFRuleRecord extends CFRuleBase implements Cloneable {
|
|||
buffer.append(" .condition_type =").append(getConditionType()).append("\n");
|
||||
buffer.append(" OPTION FLAGS=0x").append(Integer.toHexString(getOptions())).append("\n");
|
||||
if (containsFontFormattingBlock()) {
|
||||
buffer.append(_fontFormatting.toString()).append("\n");
|
||||
buffer.append(_fontFormatting).append("\n");
|
||||
}
|
||||
if (containsBorderFormattingBlock()) {
|
||||
buffer.append(_borderFormatting.toString()).append("\n");
|
||||
buffer.append(_borderFormatting).append("\n");
|
||||
}
|
||||
if (containsPatternFormattingBlock()) {
|
||||
buffer.append(_patternFormatting.toString()).append("\n");
|
||||
buffer.append(_patternFormatting).append("\n");
|
||||
}
|
||||
buffer.append(" Formula 1 =").append(Arrays.toString(getFormula1().getTokens())).append("\n");
|
||||
buffer.append(" Formula 2 =").append(Arrays.toString(getFormula2().getTokens())).append("\n");
|
||||
|
|
|
@ -283,7 +283,7 @@ public final class DVRecord extends StandardRecord implements Cloneable {
|
|||
Ptg[] ptgs = f.getTokens();
|
||||
sb.append('\n');
|
||||
for (Ptg ptg : ptgs) {
|
||||
sb.append('\t').append(ptg.toString()).append('\n');
|
||||
sb.append('\t').append(ptg).append('\n');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ public final class EmbeddedObjectRefSubRecord extends SubRecord implements Clone
|
|||
if (field_2_refPtg == null) {
|
||||
sb.append(" .f3unknown = ").append(HexDump.toHex(field_2_unknownFormulaData)).append("\n");
|
||||
} else {
|
||||
sb.append(" .formula = ").append(field_2_refPtg.toString()).append("\n");
|
||||
sb.append(" .formula = ").append(field_2_refPtg).append("\n");
|
||||
}
|
||||
if (field_4_ole_classname != null) {
|
||||
sb.append(" .unicodeFlag = ").append(field_3_unicode_flag).append("\n");
|
||||
|
|
|
@ -329,7 +329,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
|
|||
StringBuilder result = new StringBuilder();
|
||||
result.append('[').append(getRecordName()).append(']').append(nl);
|
||||
for (EscherRecord escherRecord : getEscherRecords()) {
|
||||
result.append(escherRecord.toString());
|
||||
result.append(escherRecord);
|
||||
}
|
||||
result.append("[/").append(getRecordName()).append(']').append(nl);
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class ExternSheetRecord extends StandardRecord {
|
|||
sb.append(" numOfRefs = ").append(nItems).append("\n");
|
||||
for (int i=0; i < nItems; i++) {
|
||||
sb.append("refrec #").append(i).append(": ");
|
||||
sb.append(getRef(i).toString());
|
||||
sb.append(getRef(i));
|
||||
sb.append('\n');
|
||||
}
|
||||
sb.append("[/EXTERNSHEET]\n");
|
||||
|
|
|
@ -222,7 +222,7 @@ public final class ExternalNameRecord extends StandardRecord {
|
|||
if(field_5_name_definition != null) {
|
||||
Ptg[] ptgs = field_5_name_definition.getTokens();
|
||||
for (Ptg ptg : ptgs) {
|
||||
sb.append(" .namedef = ").append(ptg.toString()).append(ptg.getRVAType()).append("\n");
|
||||
sb.append(" .namedef = ").append(ptg).append(ptg.getRVAType()).append("\n");
|
||||
}
|
||||
}
|
||||
sb.append("[/EXTERNALNAME]\n");
|
||||
|
|
|
@ -380,7 +380,7 @@ public final class FormulaRecord extends CellRecord implements Cloneable {
|
|||
}
|
||||
sb.append(" Ptg[").append(k).append("]=");
|
||||
Ptg ptg = ptgs[k];
|
||||
sb.append(ptg.toString()).append(ptg.getRVAType());
|
||||
sb.append(ptg).append(ptg.getRVAType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -271,14 +271,14 @@ public class LbsDataSubRecord extends SubRecord {
|
|||
sb.append(" .unknownShort1 =").append(HexDump.shortToHex(_cbFContinued)).append("\n");
|
||||
sb.append(" .formula = ").append('\n');
|
||||
if(_linkPtg != null) {
|
||||
sb.append(_linkPtg.toString()).append(_linkPtg.getRVAType()).append('\n');
|
||||
sb.append(_linkPtg).append(_linkPtg.getRVAType()).append('\n');
|
||||
}
|
||||
sb.append(" .nEntryCount =").append(HexDump.shortToHex(_cLines)).append("\n");
|
||||
sb.append(" .selEntryIx =").append(HexDump.shortToHex(_iSel)).append("\n");
|
||||
sb.append(" .style =").append(HexDump.shortToHex(_flags)).append("\n");
|
||||
sb.append(" .unknownShort10=").append(HexDump.shortToHex(_idEdit)).append("\n");
|
||||
if(_dropData != null) {
|
||||
sb.append('\n').append(_dropData.toString());
|
||||
sb.append('\n').append(_dropData);
|
||||
}
|
||||
sb.append("[/ftLbsData]\n");
|
||||
return sb.toString();
|
||||
|
|
|
@ -553,7 +553,7 @@ public final class NameRecord extends ContinuableRecord {
|
|||
Ptg[] ptgs = field_13_name_definition.getTokens();
|
||||
sb.append(" .Formula (nTokens=").append(ptgs.length).append("):") .append("\n");
|
||||
for (Ptg ptg : ptgs) {
|
||||
sb.append(" " + ptg.toString()).append(ptg.getRVAType()).append("\n");
|
||||
sb.append(" " + ptg).append(ptg.getRVAType()).append("\n");
|
||||
}
|
||||
|
||||
sb.append(" .Menu text = ").append(field_14_custom_menu_text).append("\n");
|
||||
|
|
|
@ -140,7 +140,7 @@ public final class ObjRecord extends Record implements Cloneable {
|
|||
sb.append("[OBJ]\n");
|
||||
if(subrecords != null) { // there are special cases where this can be, see comments in constructor above
|
||||
for (final SubRecord record : subrecords) {
|
||||
sb.append("SUBRECORD: ").append(record.toString());
|
||||
sb.append("SUBRECORD: ").append(record);
|
||||
}
|
||||
}
|
||||
sb.append("[/OBJ]\n");
|
||||
|
|
|
@ -62,7 +62,7 @@ public final class PaletteRecord extends StandardRecord {
|
|||
for (int i = 0; i < _colors.size(); i++) {
|
||||
PColor c = _colors.get(i);
|
||||
buffer.append("* colornum = ").append(i).append('\n');
|
||||
buffer.append(c.toString());
|
||||
buffer.append(c);
|
||||
buffer.append("/*colornum = ").append(i).append('\n');
|
||||
}
|
||||
buffer.append("[/PALETTE]\n");
|
||||
|
|
|
@ -80,14 +80,14 @@ public final class SharedFormulaRecord extends SharedValueRecordBase {
|
|||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
buffer.append("[SHARED FORMULA (").append(HexDump.intToHex(sid)).append("]\n");
|
||||
buffer.append(" .range = ").append(getRange().toString()).append("\n");
|
||||
buffer.append(" .range = ").append(getRange()).append("\n");
|
||||
buffer.append(" .reserved = ").append(HexDump.shortToHex(field_5_reserved)).append("\n");
|
||||
|
||||
Ptg[] ptgs = field_7_parsed_expr.getTokens();
|
||||
for (int k = 0; k < ptgs.length; k++ ) {
|
||||
buffer.append("Formula[").append(k).append("]");
|
||||
Ptg ptg = ptgs[k];
|
||||
buffer.append(ptg.toString()).append(ptg.getRVAType()).append("\n");
|
||||
buffer.append(ptg).append(ptg.getRVAType()).append("\n");
|
||||
}
|
||||
|
||||
buffer.append("[/SHARED FORMULA]\n");
|
||||
|
|
|
@ -158,7 +158,7 @@ public final class TableRecord extends SharedValueRecordBase {
|
|||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append("[TABLE]\n");
|
||||
buffer.append(" .range = ").append(getRange().toString()).append("\n");
|
||||
buffer.append(" .range = ").append(getRange()).append("\n");
|
||||
buffer.append(" .flags = ") .append(HexDump.byteToHex(field_5_flags)).append("\n");
|
||||
buffer.append(" .alwaysClc= ").append(isAlwaysCalc()).append("\n");
|
||||
buffer.append(" .reserved = ").append(HexDump.intToHex(field_6_res)).append("\n");
|
||||
|
|
|
@ -199,10 +199,10 @@ public final class CFRecordsAggregate extends RecordAggregate {
|
|||
|
||||
buffer.append("[").append(type).append("]\n");
|
||||
if( header != null ) {
|
||||
buffer.append(header.toString());
|
||||
buffer.append(header);
|
||||
}
|
||||
for (CFRuleBase cfRule : rules) {
|
||||
buffer.append(cfRule.toString());
|
||||
buffer.append(cfRule);
|
||||
}
|
||||
buffer.append("[/").append(type).append("]\n");
|
||||
return buffer.toString();
|
||||
|
|
|
@ -59,7 +59,7 @@ public final class SharedValueManager {
|
|||
public SharedFormulaGroup(SharedFormulaRecord sfr, CellReference firstCell) {
|
||||
if (!sfr.isInRange(firstCell.getRow(), firstCell.getCol())) {
|
||||
throw new IllegalArgumentException("First formula cell " + firstCell.formatAsString()
|
||||
+ " is not shared formula range " + sfr.getRange().toString() + ".");
|
||||
+ " is not shared formula range " + sfr.getRange() + ".");
|
||||
}
|
||||
_sfr = sfr;
|
||||
_firstCell = firstCell;
|
||||
|
@ -94,7 +94,7 @@ public final class SharedValueManager {
|
|||
public final String toString() {
|
||||
StringBuffer sb = new StringBuffer(64);
|
||||
sb.append(getClass().getName()).append(" [");
|
||||
sb.append(_sfr.getRange().toString());
|
||||
sb.append(_sfr.getRange());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -124,10 +124,10 @@ public final class ColorGradientFormatting implements Cloneable {
|
|||
buffer.append(" .clamp = ").append(isClampToCurve()).append("\n");
|
||||
buffer.append(" .background= ").append(isAppliesToBackground()).append("\n");
|
||||
for (Threshold t : thresholds) {
|
||||
buffer.append(t.toString());
|
||||
buffer.append(t);
|
||||
}
|
||||
for (ExtendedColor c : colors) {
|
||||
buffer.append(c.toString());
|
||||
buffer.append(c);
|
||||
}
|
||||
buffer.append(" [/Color Gradient Formatting]\n");
|
||||
return buffer.toString();
|
||||
|
|
|
@ -103,7 +103,7 @@ public final class IconMultiStateFormatting implements Cloneable {
|
|||
buffer.append(" .icon_only= ").append(isIconOnly()).append("\n");
|
||||
buffer.append(" .reversed = ").append(isReversed()).append("\n");
|
||||
for (Threshold t : thresholds) {
|
||||
buffer.append(t.toString());
|
||||
buffer.append(t);
|
||||
}
|
||||
buffer.append(" [/Icon Formatting]\n");
|
||||
return buffer.toString();
|
||||
|
|
|
@ -78,7 +78,7 @@ public final class LinkedDataRecord extends StandardRecord implements Cloneable
|
|||
Ptg[] ptgs = field_5_formulaOfLink.getTokens();
|
||||
for (int i = 0; i < ptgs.length; i++) {
|
||||
Ptg ptg = ptgs[i];
|
||||
buffer.append(ptg.toString()).append(ptg.getRVAType()).append('\n');
|
||||
buffer.append(ptg).append(ptg.getRVAType()).append('\n');
|
||||
}
|
||||
|
||||
buffer.append("[/AI]\n");
|
||||
|
|
|
@ -706,12 +706,12 @@ public class UnicodeString implements Comparable<UnicodeString> {
|
|||
if (field_4_format_runs != null) {
|
||||
for (int i = 0; i < field_4_format_runs.size();i++) {
|
||||
FormatRun r = field_4_format_runs.get(i);
|
||||
buffer.append(" .format_run"+i+" = ").append(r.toString()).append("\n");
|
||||
buffer.append(" .format_run"+i+" = ").append(r).append("\n");
|
||||
}
|
||||
}
|
||||
if (field_5_ext_rst != null) {
|
||||
buffer.append(" .field_5_ext_rst = ").append("\n");
|
||||
buffer.append( field_5_ext_rst.toString() ).append("\n");
|
||||
buffer.append(field_5_ext_rst).append("\n");
|
||||
}
|
||||
buffer.append("[/UNICODESTRING]\n");
|
||||
return buffer.toString();
|
||||
|
|
|
@ -1980,7 +1980,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||
List<EscherRecord> escherRecords = r.getEscherRecords();
|
||||
for (EscherRecord escherRecord : escherRecords) {
|
||||
if (fat) {
|
||||
pw.println(escherRecord.toString());
|
||||
pw.println(escherRecord);
|
||||
} else {
|
||||
escherRecord.display(pw, 0);
|
||||
}
|
||||
|
|
|
@ -263,4 +263,9 @@ public class HSSFSimpleShape extends HSSFShape implements SimpleShape
|
|||
}
|
||||
return _textObjectRecord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getShapeId(){
|
||||
return super.getShapeId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1892,7 +1892,7 @@ public final class HSSFWorkbook extends POIDocument implements org.apache.poi.ss
|
|||
PrintWriter w = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()));
|
||||
for (EscherRecord escherRecord : escherRecords) {
|
||||
if (fat) {
|
||||
System.out.println(escherRecord.toString());
|
||||
System.out.println(escherRecord);
|
||||
} else {
|
||||
escherRecord.display(w, 0);
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ public abstract class ChunkedCipherInputStream extends LittleEndianInputStream {
|
|||
long skipN = (index - lastIndex) << chunkBits;
|
||||
if (super.skip(skipN) < skipN) {
|
||||
throw new EOFException("buffer underrun");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
lastIndex = index + 1;
|
||||
|
|
|
@ -82,7 +82,7 @@ public class StandardEncryptionInfoBuilder implements EncryptionInfoBuilder {
|
|||
found |= (ks == keyBits);
|
||||
}
|
||||
if (!found) {
|
||||
throw new EncryptedDocumentException("KeySize "+keyBits+" not allowed for Cipher "+cipherAlgorithm.toString());
|
||||
throw new EncryptedDocumentException("KeySize "+keyBits+" not allowed for Cipher "+ cipherAlgorithm);
|
||||
}
|
||||
info.setHeader(new StandardEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
|
||||
info.setVerifier(new StandardEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
|
||||
|
|
|
@ -82,7 +82,7 @@ public class CellGeneralFormatter extends CellFormatter {
|
|||
} else if (value instanceof Boolean) {
|
||||
toAppendTo.append(value.toString().toUpperCase(Locale.ROOT));
|
||||
} else {
|
||||
toAppendTo.append(value.toString());
|
||||
toAppendTo.append(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,10 @@ public class ConditionalFormattingEvaluator {
|
|||
protected List<EvaluationConditionalFormatRule> getRules(Sheet sheet) {
|
||||
final String sheetName = sheet.getSheetName();
|
||||
List<EvaluationConditionalFormatRule> rules = formats.get(sheetName);
|
||||
if (rules == null && ! formats.containsKey(sheetName)) {
|
||||
if (rules == null) {
|
||||
if (formats.containsKey(sheetName)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final SheetConditionalFormatting scf = sheet.getSheetConditionalFormatting();
|
||||
final int count = scf.getNumConditionalFormattings();
|
||||
rules = new ArrayList<EvaluationConditionalFormatRule>(count);
|
||||
|
@ -149,12 +152,17 @@ public class ConditionalFormattingEvaluator {
|
|||
public List<EvaluationConditionalFormatRule> getConditionalFormattingForCell(final CellReference cellRef) {
|
||||
String sheetName = cellRef.getSheetName();
|
||||
Sheet sheet = null;
|
||||
if (sheetName == null) sheet = workbook.getSheetAt(workbook.getActiveSheetIndex());
|
||||
else sheet = workbook.getSheet(sheetName);
|
||||
if (sheetName == null) {
|
||||
sheet = workbook.getSheetAt(workbook.getActiveSheetIndex());
|
||||
} else {
|
||||
sheet = workbook.getSheet(sheetName);
|
||||
}
|
||||
|
||||
final Cell cell = SheetUtil.getCell(sheet, cellRef.getRow(), cellRef.getCol());
|
||||
|
||||
if (cell == null) return Collections.emptyList();
|
||||
if (cell == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return getConditionalFormattingForCell(cell, cellRef);
|
||||
}
|
||||
|
@ -202,7 +210,9 @@ public class ConditionalFormattingEvaluator {
|
|||
boolean stopIfTrue = false;
|
||||
for (EvaluationConditionalFormatRule rule : getRules(cell.getSheet())) {
|
||||
|
||||
if (stopIfTrue) continue; // a previous rule matched and wants no more evaluations
|
||||
if (stopIfTrue) {
|
||||
continue; // a previous rule matched and wants no more evaluations
|
||||
}
|
||||
|
||||
if (rule.matches(cell)) {
|
||||
rules.add(rule);
|
||||
|
@ -268,13 +278,19 @@ public class ConditionalFormattingEvaluator {
|
|||
for (CellRangeAddress region : rule.getRegions()) {
|
||||
for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
|
||||
final Row row = sheet.getRow(r);
|
||||
if (row == null) continue; // no cells to check
|
||||
if (row == null) {
|
||||
continue; // no cells to check
|
||||
}
|
||||
for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
|
||||
final Cell cell = row.getCell(c);
|
||||
if (cell == null) continue;
|
||||
if (cell == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<EvaluationConditionalFormatRule> cellRules = getConditionalFormattingForCell(cell);
|
||||
if (cellRules.contains(rule)) cells.add(cell);
|
||||
if (cellRules.contains(rule)) {
|
||||
cells.add(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,9 +185,14 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
* Defined as equal sheet name and formatting and rule indexes
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) return false;
|
||||
if (! obj.getClass().equals(this.getClass())) return false;
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (! obj.getClass().equals(this.getClass())) {
|
||||
return false;
|
||||
}
|
||||
final EvaluationConditionalFormatRule r = (EvaluationConditionalFormatRule) obj;
|
||||
return getSheet().getSheetName().equalsIgnoreCase(r.getSheet().getSheetName())
|
||||
&& getFormattingIndex() == r.getFormattingIndex()
|
||||
|
@ -203,21 +208,29 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
* @param o
|
||||
* @return comparison based on sheet name, formatting index, and rule priority
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(EvaluationConditionalFormatRule o) {
|
||||
int cmp = getSheet().getSheetName().compareToIgnoreCase(o.getSheet().getSheetName());
|
||||
if (cmp != 0) return cmp;
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
final int x = getPriority();
|
||||
final int y = o.getPriority();
|
||||
// logic from Integer.compare()
|
||||
cmp = (x < y) ? -1 : ((x == y) ? 0 : 1);
|
||||
if (cmp != 0) return cmp;
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
cmp = new Integer(getFormattingIndex()).compareTo(new Integer(o.getFormattingIndex()));
|
||||
if (cmp != 0) return cmp;
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
return new Integer(getRuleIndex()).compareTo(new Integer(o.getRuleIndex()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = sheet.getSheetName().hashCode();
|
||||
hash = 31 * hash + formattingIndex;
|
||||
|
@ -239,7 +252,10 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
}
|
||||
}
|
||||
|
||||
if (region == null) return false; // cell not in range of this rule
|
||||
if (region == null) {
|
||||
// cell not in range of this rule
|
||||
return false;
|
||||
}
|
||||
|
||||
final ConditionType ruleType = getRule().getConditionType();
|
||||
|
||||
|
@ -276,7 +292,9 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
|| (DataValidationEvaluator.isType(cell,CellType.STRING)
|
||||
&& (cell.getStringCellValue() == null || cell.getStringCellValue().isEmpty())
|
||||
)
|
||||
) return false;
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ValueEval eval = unwrapEval(workbookEvaluator.evaluate(rule.getFormula1(), ConditionalFormattingEvaluator.getRef(cell), region));
|
||||
|
||||
|
@ -328,8 +346,12 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
ValueEval comp = unwrapEval(workbookEvaluator.evaluate(rule.getFormula1(), ConditionalFormattingEvaluator.getRef(cell), region));
|
||||
|
||||
// Copied for now from DataValidationEvaluator.ValidationEnum.FORMULA#isValidValue()
|
||||
if (comp instanceof BlankEval) return true;
|
||||
if (comp instanceof ErrorEval) return false;
|
||||
if (comp instanceof BlankEval) {
|
||||
return true;
|
||||
}
|
||||
if (comp instanceof ErrorEval) {
|
||||
return false;
|
||||
}
|
||||
if (comp instanceof BoolEval) {
|
||||
return ((BoolEval) comp).getBooleanValue();
|
||||
}
|
||||
|
@ -343,7 +365,9 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
|
||||
private boolean checkFilter(Cell cell, CellRangeAddress region) {
|
||||
final ConditionFilterType filterType = rule.getConditionFilterType();
|
||||
if (filterType == null) return false;
|
||||
if (filterType == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: this could/should be delegated to the Enum type, but that's in the usermodel package,
|
||||
// we may not want evaluation code there. Of course, maybe the enum should go here in formula,
|
||||
|
@ -357,19 +381,29 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
// numbers stored as text are ignored, but numbers formatted as text are treated as numbers.
|
||||
|
||||
final ValueAndFormat cv10 = getCellValue(cell);
|
||||
if (! cv10.isNumber()) return false;
|
||||
if (! cv10.isNumber()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getMeaningfulValues(region, false, new ValueFunction() {
|
||||
@Override
|
||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||
List<ValueAndFormat> values = allValues;
|
||||
final ConditionFilterData conf = rule.getFilterConfiguration();
|
||||
|
||||
if (! conf.getBottom()) Collections.sort(values, Collections.reverseOrder());
|
||||
else Collections.sort(values);
|
||||
if (! conf.getBottom()) {
|
||||
Collections.sort(values, Collections.reverseOrder());
|
||||
} else {
|
||||
Collections.sort(values);
|
||||
}
|
||||
|
||||
int limit = (int) conf.getRank();
|
||||
if (conf.getPercent()) limit = allValues.size() * limit / 100;
|
||||
if (allValues.size() <= limit) return new HashSet<ValueAndFormat>(allValues);
|
||||
if (conf.getPercent()) {
|
||||
limit = allValues.size() * limit / 100;
|
||||
}
|
||||
if (allValues.size() <= limit) {
|
||||
return new HashSet<ValueAndFormat>(allValues);
|
||||
}
|
||||
|
||||
return new HashSet<ValueAndFormat>(allValues.subList(0, limit));
|
||||
}
|
||||
|
@ -378,6 +412,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
// Per Excel help, "duplicate" means matching value AND format
|
||||
// https://support.office.com/en-us/article/Filter-for-unique-values-or-remove-duplicate-values-ccf664b0-81d6-449b-bbe1-8daaec1e83c2
|
||||
return getMeaningfulValues(region, true, new ValueFunction() {
|
||||
@Override
|
||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||
List<ValueAndFormat> values = allValues;
|
||||
Collections.sort(values);
|
||||
|
@ -402,6 +437,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
// Per Excel help, "duplicate" means matching value AND format
|
||||
// https://support.office.com/en-us/article/Filter-for-unique-values-or-remove-duplicate-values-ccf664b0-81d6-449b-bbe1-8daaec1e83c2
|
||||
return getMeaningfulValues(region, true, new ValueFunction() {
|
||||
@Override
|
||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||
List<ValueAndFormat> values = allValues;
|
||||
Collections.sort(values);
|
||||
|
@ -428,6 +464,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
|
||||
// actually ordered, so iteration order is predictable
|
||||
List<ValueAndFormat> values = new ArrayList<ValueAndFormat>(getMeaningfulValues(region, false, new ValueFunction() {
|
||||
@Override
|
||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||
List<ValueAndFormat> values = allValues;
|
||||
double total = 0;
|
||||
|
@ -449,7 +486,9 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
|
||||
final ValueAndFormat cv = getCellValue(cell);
|
||||
Double val = cv.isNumber() ? cv.getValue() : null;
|
||||
if (val == null) return false;
|
||||
if (val == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double avg = values.get(0).value.doubleValue();
|
||||
double stdDev = values.get(1).value.doubleValue();
|
||||
|
@ -464,11 +503,17 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
|
||||
OperatorEnum op = null;
|
||||
if (conf.getAboveAverage()) {
|
||||
if (conf.getEqualAverage()) op = OperatorEnum.GREATER_OR_EQUAL;
|
||||
else op = OperatorEnum.GREATER_THAN;
|
||||
if (conf.getEqualAverage()) {
|
||||
op = OperatorEnum.GREATER_OR_EQUAL;
|
||||
} else {
|
||||
op = OperatorEnum.GREATER_THAN;
|
||||
}
|
||||
} else {
|
||||
if (conf.getEqualAverage()) op = OperatorEnum.LESS_OR_EQUAL;
|
||||
else op = OperatorEnum.LESS_THAN;
|
||||
if (conf.getEqualAverage()) {
|
||||
op = OperatorEnum.LESS_OR_EQUAL;
|
||||
} else {
|
||||
op = OperatorEnum.LESS_THAN;
|
||||
}
|
||||
}
|
||||
return op != null && op.isValid(val, comp, null);
|
||||
case CONTAINS_TEXT:
|
||||
|
@ -522,17 +567,23 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
*/
|
||||
private Set<ValueAndFormat> getMeaningfulValues(CellRangeAddress region, boolean withText, ValueFunction func) {
|
||||
Set<ValueAndFormat> values = meaningfulRegionValues.get(region);
|
||||
if (values != null) return values;
|
||||
if (values != null) {
|
||||
return values;
|
||||
}
|
||||
|
||||
List<ValueAndFormat> allValues = new ArrayList<ValueAndFormat>((region.getLastColumn() - region.getFirstColumn()+1) * (region.getLastRow() - region.getFirstRow() + 1));
|
||||
|
||||
for (int r=region.getFirstRow(); r <= region.getLastRow(); r++) {
|
||||
final Row row = sheet.getRow(r);
|
||||
if (row == null) continue;
|
||||
if (row == null) {
|
||||
continue;
|
||||
}
|
||||
for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
|
||||
Cell cell = row.getCell(c);
|
||||
final ValueAndFormat cv = getCellValue(cell);
|
||||
if (cv != null && (withText || cv.isNumber()) ) allValues.add(cv);
|
||||
if (cv != null && (withText || cv.isNumber()) ) {
|
||||
allValues.add(cv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -578,21 +629,25 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
public static enum OperatorEnum {
|
||||
NO_COMPARISON {
|
||||
/** always false/invalid */
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
BETWEEN {
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
return cellValue.compareTo(v1) >= 0 && cellValue.compareTo(v2) <= 0;
|
||||
}
|
||||
},
|
||||
NOT_BETWEEN {
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
return cellValue.compareTo(v1) < 0 || cellValue.compareTo(v2) > 0;
|
||||
}
|
||||
},
|
||||
EQUAL {
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
// need to avoid instanceof, to work around a 1.6 compiler bug
|
||||
if (cellValue.getClass() == String.class) {
|
||||
|
@ -602,6 +657,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
}
|
||||
},
|
||||
NOT_EQUAL {
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
// need to avoid instanceof, to work around a 1.6 compiler bug
|
||||
if (cellValue.getClass() == String.class) {
|
||||
|
@ -611,21 +667,25 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
}
|
||||
},
|
||||
GREATER_THAN {
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
return cellValue.compareTo(v1) > 0;
|
||||
}
|
||||
},
|
||||
LESS_THAN {
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
return cellValue.compareTo(v1) < 0;
|
||||
}
|
||||
},
|
||||
GREATER_OR_EQUAL {
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
return cellValue.compareTo(v1) >= 0;
|
||||
}
|
||||
},
|
||||
LESS_OR_EQUAL {
|
||||
@Override
|
||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||
return cellValue.compareTo(v1) <= 0;
|
||||
}
|
||||
|
@ -645,7 +705,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
/**
|
||||
* Note: this class has a natural ordering that is inconsistent with equals.
|
||||
*/
|
||||
protected class ValueAndFormat implements Comparable<ValueAndFormat> {
|
||||
protected static class ValueAndFormat implements Comparable<ValueAndFormat> {
|
||||
|
||||
private final Double value;
|
||||
private final String string;
|
||||
|
@ -671,7 +731,11 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ValueAndFormat)) {
|
||||
return false;
|
||||
}
|
||||
ValueAndFormat o = (ValueAndFormat) obj;
|
||||
return ( value == o.value || value.equals(o.value))
|
||||
&& ( format == o.format || format.equals(o.format))
|
||||
|
@ -683,18 +747,30 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||
* @param o
|
||||
* @return value comparison
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(ValueAndFormat o) {
|
||||
if (value == null && o.value != null) return 1;
|
||||
if (o.value == null && value != null) return -1;
|
||||
if (value == null && o.value != null) {
|
||||
return 1;
|
||||
}
|
||||
if (o.value == null && value != null) {
|
||||
return -1;
|
||||
}
|
||||
int cmp = value == null ? 0 : value.compareTo(o.value);
|
||||
if (cmp != 0) return cmp;
|
||||
if (cmp != 0) {
|
||||
return cmp;
|
||||
}
|
||||
|
||||
if (string == null && o.string != null) return 1;
|
||||
if (o.string == null && string != null) return -1;
|
||||
if (string == null && o.string != null) {
|
||||
return 1;
|
||||
}
|
||||
if (o.string == null && string != null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return string == null ? 0 : string.compareTo(o.string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (string == null ? 0 : string.hashCode()) * 37 * 37 + 37 * (value == null ? 0 : value.hashCode()) + (format == null ? 0 : format.hashCode());
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class FormulaRenderer {
|
|||
stack.push(attrPtg.toFormulaString(operands));
|
||||
continue;
|
||||
}
|
||||
throw new RuntimeException("Unexpected tAttr: " + attrPtg.toString());
|
||||
throw new RuntimeException("Unexpected tAttr: " + attrPtg);
|
||||
}
|
||||
|
||||
if (ptg instanceof WorkbookDependentFormula) {
|
||||
|
|
|
@ -336,7 +336,7 @@ public final class WorkbookEvaluator {
|
|||
if (isDebugLogEnabled()) {
|
||||
String sheetName = getSheetName(sheetIndex);
|
||||
CellReference cr = new CellReference(rowIndex, columnIndex);
|
||||
logDebug("Evaluated " + sheetName + "!" + cr.formatAsString() + " to " + result.toString());
|
||||
logDebug("Evaluated " + sheetName + "!" + cr.formatAsString() + " to " + result);
|
||||
}
|
||||
// Usually (result === cce.getValue())
|
||||
// But sometimes: (result==ErrorEval.CIRCULAR_REF_ERROR, cce.getValue()==null)
|
||||
|
|
|
@ -128,6 +128,9 @@ public class DataFormatter implements Observer {
|
|||
|
||||
/** Pattern to find "AM/PM" marker */
|
||||
private static final Pattern amPmPattern = Pattern.compile("((A|P)[M/P]*)", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
/** Pattern to find formats with condition ranges e.g. [>=100] */
|
||||
private static final Pattern rangeConditionalPattern = Pattern.compile(".*\\[\\s*(>|>=|<|<=|=)\\s*[0-9]*\\.*[0-9].*");
|
||||
|
||||
/**
|
||||
* A regex to find locale patterns like [$$-1009] and [$?-452].
|
||||
|
@ -312,14 +315,16 @@ public class DataFormatter implements Observer {
|
|||
|
||||
String formatStr = formatStrIn;
|
||||
|
||||
// Excel supports 3+ part conditional data formats, eg positive/negative/zero,
|
||||
// Excel supports 2+ part conditional data formats, eg positive/negative/zero,
|
||||
// or (>1000),(>0),(0),(negative). As Java doesn't handle these kinds
|
||||
// of different formats for different ranges, just +ve/-ve, we need to
|
||||
// handle these ourselves in a special way.
|
||||
// For now, if we detect 3+ parts, we call out to CellFormat to handle it
|
||||
// For now, if we detect 2+ parts, we call out to CellFormat to handle it
|
||||
// TODO Going forward, we should really merge the logic between the two classes
|
||||
if (formatStr.contains(";") &&
|
||||
formatStr.indexOf(';') != formatStr.lastIndexOf(';')) {
|
||||
if (formatStr.contains(";") &&
|
||||
(formatStr.indexOf(';') != formatStr.lastIndexOf(';')
|
||||
|| rangeConditionalPattern.matcher(formatStr).matches()
|
||||
) ) {
|
||||
try {
|
||||
// Ask CellFormat to get a formatter for it
|
||||
CellFormat cfmt = CellFormat.getInstance(formatStr);
|
||||
|
|
|
@ -42,5 +42,5 @@ public enum SheetVisibility {
|
|||
* <code>ThisWorkbook.Sheets("MySheetName").Visible = xlSheetVeryHidden </code>
|
||||
* </p>
|
||||
*/
|
||||
VERY_HIDDEN;
|
||||
VERY_HIDDEN
|
||||
}
|
||||
|
|
|
@ -19,10 +19,14 @@ package org.apache.poi.ss.usermodel;
|
|||
|
||||
/**
|
||||
* A common interface for simple shapes.
|
||||
* (Currently the HSSF and XSSF classes don't share common method signatures ...)
|
||||
*
|
||||
* @since POI 3.16-beta2
|
||||
*/
|
||||
public interface SimpleShape extends Shape {
|
||||
|
||||
/**
|
||||
* @return the shape id, which is unique within the sheet
|
||||
*
|
||||
* @since POI 3.17-beta1
|
||||
*/
|
||||
int getShapeId();
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class OOXMLLister implements Closeable {
|
|||
File f = new File(args[0]);
|
||||
if(! f.exists()) {
|
||||
System.err.println("Error, file not found!");
|
||||
System.err.println("\t" + f.toString());
|
||||
System.err.println("\t" + f);
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class OOXMLLister implements Closeable {
|
|||
);
|
||||
|
||||
try {
|
||||
lister.disp.println(f.toString() + "\n");
|
||||
lister.disp.println(f + "\n");
|
||||
lister.displayParts();
|
||||
lister.disp.println();
|
||||
lister.displayRelations();
|
||||
|
|
|
@ -74,7 +74,7 @@ public class OOXMLPrettyPrint {
|
|||
File f = new File(args[i]);
|
||||
if(! f.exists()) {
|
||||
System.err.println("Error, file not found!");
|
||||
System.err.println("\t" + f.toString());
|
||||
System.err.println("\t" + f);
|
||||
System.exit(2);
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ public final class PackageRelationship {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(id == null ? "id=null" : "id=" + id);
|
||||
sb.append(container == null ? " - container=null" : " - container="
|
||||
+ container.toString());
|
||||
+ container);
|
||||
sb.append(relationshipType == null ? " - relationshipType=null"
|
||||
: " - relationshipType=" + relationshipType);
|
||||
sb.append(source == null ? " - source=null" : " - source="
|
||||
|
@ -221,7 +221,7 @@ public final class PackageRelationship {
|
|||
sb.append(targetUri == null ? " - target=null" : " - target="
|
||||
+ getTargetURI().toASCIIString());
|
||||
sb.append(targetMode == null ? ",targetMode=null" : ",targetMode="
|
||||
+ targetMode.toString());
|
||||
+ targetMode);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -617,7 +617,7 @@ public final class PackagePropertiesPart extends PackagePart implements
|
|||
sb.append(", ").append(fStr);
|
||||
}
|
||||
throw new InvalidFormatException("Date " + dateStr + " not well formatted, "
|
||||
+ "expected format in: "+sb.toString());
|
||||
+ "expected format in: "+ sb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,7 +65,7 @@ public class AgileEncryptionHeader extends EncryptionHeader implements Cloneable
|
|||
setChainingMode(ChainingMode.cfb);
|
||||
break;
|
||||
default:
|
||||
throw new EncryptedDocumentException("Unsupported chaining mode - "+keyData.getCipherChaining().toString());
|
||||
throw new EncryptedDocumentException("Unsupported chaining mode - "+ keyData.getCipherChaining());
|
||||
}
|
||||
|
||||
int hashSize = keyData.getHashSize();
|
||||
|
|
|
@ -79,7 +79,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
|
|||
found |= (ks == keyBits);
|
||||
}
|
||||
if (!found) {
|
||||
throw new EncryptedDocumentException("KeySize "+keyBits+" not allowed for Cipher "+cipherAlgorithm.toString());
|
||||
throw new EncryptedDocumentException("KeySize "+keyBits+" not allowed for Cipher "+ cipherAlgorithm);
|
||||
}
|
||||
info.setHeader(new AgileEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
|
||||
info.setVerifier(new AgileEncryptionVerifier(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
|
||||
|
|
|
@ -105,7 +105,7 @@ public class AgileEncryptionVerifier extends EncryptionVerifier implements Clone
|
|||
setChainingMode(ChainingMode.cfb);
|
||||
break;
|
||||
default:
|
||||
throw new EncryptedDocumentException("Unsupported chaining mode - "+keyData.getCipherChaining().toString());
|
||||
throw new EncryptedDocumentException("Unsupported chaining mode - "+ keyData.getCipherChaining());
|
||||
}
|
||||
|
||||
if (!encList.hasNext()) {
|
||||
|
|
|
@ -349,14 +349,14 @@ public class XAdESXLSignatureFacet extends SignatureFacet {
|
|||
|
||||
// create a XAdES time-stamp container
|
||||
XAdESTimeStampType xadesTimeStamp = XAdESTimeStampType.Factory.newInstance();
|
||||
xadesTimeStamp.setId("time-stamp-" + UUID.randomUUID().toString());
|
||||
xadesTimeStamp.setId("time-stamp-" + UUID.randomUUID());
|
||||
CanonicalizationMethodType c14nMethod = xadesTimeStamp.addNewCanonicalizationMethod();
|
||||
c14nMethod.setAlgorithm(signatureConfig.getXadesCanonicalizationMethod());
|
||||
|
||||
// embed the time-stamp
|
||||
EncapsulatedPKIDataType encapsulatedTimeStamp = xadesTimeStamp.addNewEncapsulatedTimeStamp();
|
||||
encapsulatedTimeStamp.setByteArrayValue(timeStampToken);
|
||||
encapsulatedTimeStamp.setId("time-stamp-token-" + UUID.randomUUID().toString());
|
||||
encapsulatedTimeStamp.setId("time-stamp-token-" + UUID.randomUUID());
|
||||
|
||||
return xadesTimeStamp;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public class AesZipFileZipEntrySource implements ZipEntrySource {
|
|||
zipFile.close();
|
||||
if (!tmpFile.delete()) {
|
||||
LOG.log(POILogger.WARN, tmpFile.getAbsolutePath()+" can't be removed (or was already removed.");
|
||||
};
|
||||
}
|
||||
}
|
||||
closed = true;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
|
|||
// check for emf+ embedded pdf (poor mans style :( )
|
||||
// Mac Excel 2011 embeds pdf files with this method.
|
||||
PictureData pd = source.getPictureData();
|
||||
if (pd != null && pd.getPictureType() != Workbook.PICTURE_TYPE_EMF) {
|
||||
if (pd == null || pd.getPictureType() != Workbook.PICTURE_TYPE_EMF) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,6 @@ public final class OOXMLLite {
|
|||
if (!(destDirectory.exists() || destDirectory.mkdirs())) {
|
||||
throw new RuntimeException("Can't create destination directory: "+destDirectory);
|
||||
}
|
||||
;
|
||||
OutputStream destStream = new FileOutputStream(destFile);
|
||||
try {
|
||||
IOUtils.copy(srcStream, destStream);
|
||||
|
|
|
@ -26,11 +26,11 @@ public class XDGFException {
|
|||
* Creates an error message to be thrown
|
||||
*/
|
||||
public static POIXMLException error(String message, Object o) {
|
||||
return new POIXMLException(o.toString() + ": " + message);
|
||||
return new POIXMLException(o + ": " + message);
|
||||
}
|
||||
|
||||
public static POIXMLException error(String message, Object o, Throwable t) {
|
||||
return new POIXMLException(o.toString() + ": " + message, t);
|
||||
return new POIXMLException(o + ": " + message, t);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -41,7 +41,6 @@ public class XDGFException {
|
|||
public static POIXMLException wrap(POIXMLDocumentPart part,
|
||||
POIXMLException e) {
|
||||
return new POIXMLException(part.getPackagePart().getPartName()
|
||||
.toString()
|
||||
+ ": " + e.getMessage(), e.getCause() == null ? e
|
||||
: e.getCause());
|
||||
}
|
||||
|
|
|
@ -84,10 +84,10 @@ public class XDGFBaseContents extends XDGFXMLDocumentPart {
|
|||
XDGFShape to = _shapes.get(connect.getToSheet());
|
||||
|
||||
if (from == null)
|
||||
throw new POIXMLException(this.toString() + "; Connect; Invalid from id: " + connect.getFromSheet());
|
||||
throw new POIXMLException(this + "; Connect; Invalid from id: " + connect.getFromSheet());
|
||||
|
||||
if (to == null)
|
||||
throw new POIXMLException(this.toString() + "; Connect; Invalid to id: " + connect.getToSheet());
|
||||
throw new POIXMLException(this + "; Connect; Invalid to id: " + connect.getToSheet());
|
||||
|
||||
_connections.add(new XDGFConnection(connect, from, to));
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ public class GeometryRowFactory {
|
|||
_rowTypes.put("LineTo", LineTo.class, RowType.class);
|
||||
_rowTypes.put("MoveTo", MoveTo.class, RowType.class);
|
||||
_rowTypes.put("NURBSTo", NURBSTo.class, RowType.class);
|
||||
// Note - two different spellings depending on version used...!
|
||||
_rowTypes.put("PolylineTo", PolyLineTo.class, RowType.class);
|
||||
_rowTypes.put("PolyLineTo", PolyLineTo.class, RowType.class);
|
||||
_rowTypes.put("RelCubBezTo", RelCubBezTo.class, RowType.class);
|
||||
_rowTypes.put("RelEllipticalArcTo", RelEllipticalArcTo.class,
|
||||
|
|
|
@ -62,7 +62,7 @@ public class HierarchyPrinter {
|
|||
os.append(" ");
|
||||
}
|
||||
// TODO: write text?
|
||||
os.println(shape.toString() + " [" + shape.getShapeType()
|
||||
os.println(shape + " [" + shape.getShapeType()
|
||||
+ ", " + shape.getSymbolName() + "] "
|
||||
+ shape.getMasterShape() + " "
|
||||
+ shape.getTextAsString().trim());
|
||||
|
|
|
@ -1848,7 +1848,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperti
|
|||
} else if (props instanceof CTTextCharacterProperties) {
|
||||
obj = new TextCharDelegate((CTTextCharacterProperties)props);
|
||||
} else {
|
||||
LOG.log(POILogger.ERROR, props.getClass().toString()+" is an unknown properties type");
|
||||
LOG.log(POILogger.ERROR, props.getClass() +" is an unknown properties type");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1856,7 +1856,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperti
|
|||
return (T)obj;
|
||||
}
|
||||
|
||||
LOG.log(POILogger.WARN, obj.getClass().toString()+" doesn't implement "+clazz.toString());
|
||||
LOG.log(POILogger.WARN, obj.getClass() +" doesn't implement "+ clazz);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public abstract class XSLFSimpleShape extends XSLFShape
|
|||
return ((CTShapeProperties)xo).addNewXfrm();
|
||||
} else {
|
||||
// ... group shapes have their own getXfrm()
|
||||
LOG.log(POILogger.WARN, getClass().toString()+" doesn't have xfrm element.");
|
||||
LOG.log(POILogger.WARN, getClass() +" doesn't have xfrm element.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1132,7 +1132,7 @@ public abstract class XSLFSimpleShape extends XSLFShape
|
|||
private static CTLineProperties getLn(XSLFShape shape, boolean create) {
|
||||
XmlObject pr = shape.getShapeProperties();
|
||||
if (!(pr instanceof CTShapeProperties)) {
|
||||
LOG.log(POILogger.WARN, shape.getClass().toString()+" doesn't have line properties");
|
||||
LOG.log(POILogger.WARN, shape.getClass() +" doesn't have line properties");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ implements Slide<XSLFShape,XSLFTextParagraph> {
|
|||
}
|
||||
}
|
||||
if(_layout == null) {
|
||||
throw new IllegalArgumentException("SlideLayout was not found for " + this.toString());
|
||||
throw new IllegalArgumentException("SlideLayout was not found for " + this);
|
||||
}
|
||||
return _layout;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ implements MasterSheet<XSLFShape,XSLFTextParagraph> {
|
|||
}
|
||||
}
|
||||
if (_master == null) {
|
||||
throw new IllegalStateException("SlideMaster was not found for " + this.toString());
|
||||
throw new IllegalStateException("SlideMaster was not found for " + this);
|
||||
}
|
||||
return _master;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class XSLFTableStyle {
|
|||
private CTTableStyle _tblStyle;
|
||||
|
||||
public enum TablePartStyle {
|
||||
wholeTbl, band1H, band2H, band1V, band2V, firstCol, lastCol, firstRow, lastRow, seCell, swCell, neCell, nwCell;
|
||||
wholeTbl, band1H, band2H, band1V, band2V, firstCol, lastCol, firstRow, lastRow, seCell, swCell, neCell, nwCell
|
||||
}
|
||||
|
||||
/*package*/ XSLFTableStyle(CTTableStyle style){
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.poi.xssf.binary;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.Comparator;
|
||||
|
@ -163,8 +164,9 @@ public class XSSFBHyperlinksTable {
|
|||
}
|
||||
}
|
||||
|
||||
private static class TopLeftCellAddressComparator implements Comparator<CellAddress> {
|
||||
|
||||
private static class TopLeftCellAddressComparator implements Comparator<CellAddress>, Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public int compare(CellAddress o1, CellAddress o2) {
|
||||
if (o1.getRow() < o2.getRow()) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public abstract class XSSFBParser {
|
|||
* @param is inputStream
|
||||
* @param bitSet call {@link #handleRecord(int, byte[])} only on those records in this bitSet
|
||||
*/
|
||||
XSSFBParser(InputStream is, BitSet bitSet) {
|
||||
protected XSSFBParser(InputStream is, BitSet bitSet) {
|
||||
this.is = new LittleEndianInputStream(is);
|
||||
records = bitSet;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ public enum XSSFBRecordType {
|
|||
|
||||
BrtBundleSh(156), //defines worksheet in wb part
|
||||
|
||||
BrtAbsPath15(2071), //Excel 2013 path where the file was stored in wbpart
|
||||
|
||||
//TODO -- implement these as needed
|
||||
//BrtFileVersion(128), //file version
|
||||
//BrtWbProp(153), //Workbook prop contains 1904/1900-date based bit
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.poi.xssf.eventusermodel;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -31,6 +32,7 @@ import org.apache.poi.openxml4j.opc.PackagePartName;
|
|||
import org.apache.poi.openxml4j.opc.PackageRelationship;
|
||||
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
|
||||
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.util.LittleEndian;
|
||||
import org.apache.poi.util.POILogFactory;
|
||||
import org.apache.poi.util.POILogger;
|
||||
|
@ -62,6 +64,26 @@ public class XSSFBReader extends XSSFReader {
|
|||
super(pkg);
|
||||
}
|
||||
|
||||
/**
|
||||
* In Excel 2013, the absolute path where the file was last saved may be stored in
|
||||
* the {@link XSSFBRecordType#BrtAbsPath15} record. The equivalent in ooxml is
|
||||
* <x15ac:absPath>.
|
||||
*
|
||||
* @return absolute path or <code>null</code> if it could not be found.
|
||||
* @throws IOException when there's a problem with the workbook part's stream
|
||||
*/
|
||||
public String getAbsPathMetadata() throws IOException {
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = workbookPart.getInputStream();
|
||||
PathExtractor p = new PathExtractor(workbookPart.getInputStream());
|
||||
p.parse();
|
||||
return p.getPath();
|
||||
} finally {
|
||||
IOUtils.closeQuietly(is);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Iterator which will let you get at all the
|
||||
* different Sheets in turn.
|
||||
|
@ -137,6 +159,36 @@ public class XSSFBReader extends XSSFReader {
|
|||
|
||||
}
|
||||
|
||||
|
||||
private static class PathExtractor extends XSSFBParser {
|
||||
private static BitSet RECORDS = new BitSet();
|
||||
static {
|
||||
RECORDS.set(XSSFBRecordType.BrtAbsPath15.getId());
|
||||
}
|
||||
private String path = null;
|
||||
public PathExtractor(InputStream is) {
|
||||
super(is, RECORDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleRecord(int recordType, byte[] data) throws XSSFBParseException {
|
||||
if (recordType != XSSFBRecordType.BrtAbsPath15.getId()) {
|
||||
return;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
XSSFBUtils.readXLWideString(data, 0, sb);
|
||||
path = sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the path if found, otherwise <code>null</code>
|
||||
*/
|
||||
String getPath() {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
private static class SheetRefLoader extends XSSFBParser {
|
||||
List<XSSFSheetRef> sheets = new LinkedList<XSSFSheetRef>();
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
|
|||
break;
|
||||
|
||||
case ERROR:
|
||||
thisStr = "ERROR:" + value.toString();
|
||||
thisStr = "ERROR:" + value;
|
||||
break;
|
||||
|
||||
case FORMULA:
|
||||
|
|
|
@ -274,7 +274,7 @@ public class SheetDataWriter {
|
|||
XSSFRichTextString rt = new XSSFRichTextString(cell.getStringCellValue());
|
||||
int sRef = _sharedStringSource.addEntry(rt.getCTRst());
|
||||
|
||||
_out.write(" t=\"" + STCellType.S.toString() + "\">");
|
||||
_out.write(" t=\"" + STCellType.S + "\">");
|
||||
_out.write("<v>");
|
||||
_out.write(String.valueOf(sRef));
|
||||
_out.write("</v>");
|
||||
|
|
|
@ -184,7 +184,7 @@ public final class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
|
|||
|
||||
@Override
|
||||
public String toString(){
|
||||
return "from : " + cell1.toString() + "; to: " + cell2.toString();
|
||||
return "from : " + cell1 + "; to: " + cell2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -385,7 +385,24 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
|
|||
public XSSFObjectData createObjectData(ClientAnchor anchor, int storageId, int pictureIndex) {
|
||||
XSSFSheet sh = getSheet();
|
||||
PackagePart sheetPart = sh.getPackagePart();
|
||||
long shapeId = newShapeId();
|
||||
|
||||
/*
|
||||
* The shape id of the ole object seems to be a legacy shape id.
|
||||
*
|
||||
* see 5.3.2.1 legacyDrawing (Legacy Drawing Object):
|
||||
* Legacy Shape ID that is unique throughout the entire document.
|
||||
* Legacy shape IDs should be assigned based on which portion of the document the
|
||||
* drawing resides on. The assignment of these ids is broken down into clusters of
|
||||
* 1024 values. The first cluster is 1-1024, the second 1025-2048 and so on.
|
||||
*
|
||||
* Ole shapes seem to start with 1025 on the first sheet ...
|
||||
* and not sure, if the ids need to be reindexed when sheets are removed
|
||||
* or more than 1024 shapes are on a given sheet (see #51332 for a similar issue)
|
||||
*/
|
||||
XSSFSheet sheet = getSheet();
|
||||
XSSFWorkbook wb = sheet.getWorkbook();
|
||||
int sheetIndex = wb.getSheetIndex(sheet);
|
||||
long shapeId = (sheetIndex+1)*1024 + newShapeId();
|
||||
|
||||
// add reference to OLE part
|
||||
PackagePartName olePN;
|
||||
|
@ -446,6 +463,7 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
|
|||
|
||||
CTNonVisualDrawingProps cNvPr = ctShape.getNvSpPr().getCNvPr();
|
||||
cNvPr.setId(shapeId);
|
||||
cNvPr.setName("Object "+shapeId);
|
||||
|
||||
XmlCursor extCur = cNvPr.getExtLst().getExtArray(0).newCursor();
|
||||
extCur.toFirstChild();
|
||||
|
@ -520,7 +538,10 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
|
|||
}
|
||||
|
||||
private long newShapeId(){
|
||||
return drawing.sizeOfTwoCellAnchorArray() + 1;
|
||||
return 1+
|
||||
drawing.sizeOfAbsoluteAnchorArray()+
|
||||
drawing.sizeOfOneCellAnchorArray()+
|
||||
drawing.sizeOfTwoCellAnchorArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -210,7 +210,7 @@ public class XSSFObjectData extends XSSFSimpleShape implements ObjectData {
|
|||
try {
|
||||
if (cur.toChild(XSSFRelation.NS_SPREADSHEETML, "objectPr")) {
|
||||
String blipId = cur.getAttributeText(new QName(PackageRelationshipTypes.CORE_PROPERTIES_ECMA376_NS, "id"));
|
||||
return (XSSFPictureData)getDrawing().getRelationById(blipId);
|
||||
return (XSSFPictureData)getSheet().getRelationById(blipId);
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue