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-codec-1.10.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.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 exported="true" kind="lib" path="lib/commons-collections4-4.1.jar"/>
|
||||||
<classpathentry kind="output" path="build/eclipse"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,21 +1,47 @@
|
||||||
classes
|
classes
|
||||||
workbook.xls
|
workbook.xls
|
||||||
bak
|
bak
|
||||||
*.iws
|
|
||||||
build.number
|
build.number
|
||||||
*.el
|
*.el
|
||||||
TEST-org.apache.poi*.xml
|
|
||||||
build
|
|
||||||
.settings
|
|
||||||
scripts
|
scripts
|
||||||
*.ipr
|
|
||||||
untitled1.jpx
|
untitled1.jpx
|
||||||
*.iml
|
|
||||||
log*.*
|
log*.*
|
||||||
dist
|
|
||||||
*.log
|
*.log
|
||||||
bin
|
|
||||||
.ant-targets-build.xml
|
forrest.properties
|
||||||
out
|
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
|
.idea
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
# Gradle
|
||||||
.gradle
|
.gradle
|
||||||
|
|
||||||
|
# Ant
|
||||||
|
.ant-targets-build.xml
|
||||||
|
build
|
||||||
|
dist
|
||||||
|
|
|
@ -40,7 +40,7 @@ under the License.
|
||||||
|
|
||||||
<description>The Apache POI project Ant build.</description>
|
<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 name="release.rc" value="RC1"/>
|
||||||
|
|
||||||
<property environment="env"/>
|
<property environment="env"/>
|
||||||
|
@ -2712,11 +2712,11 @@ under the License.
|
||||||
to track progress.</p>
|
to track progress.</p>
|
||||||
<p>
|
<p>
|
||||||
The POI source release as well as the pre-built binary deployment packages are listed below.
|
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
|
are available in the central Maven repository under Group ID "org.apache.poi" and Version
|
||||||
"${version.id}".
|
"${version.id}".
|
||||||
</p>
|
</p>
|
||||||
<section><title>Binary Distribution</title>
|
<section id="POI-${version.id}-bin"><title>Binary Distribution</title>
|
||||||
<ul>
|
<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>
|
<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>)
|
(${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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
<section><title>Source Distribution</title>
|
<section id="POI-${version.id}-src"><title>Source Distribution</title>
|
||||||
<ul>
|
<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>
|
<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>)
|
(${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>
|
<programming-language>Java</programming-language>
|
||||||
<category rdf:resource="https://projects.apache.org/category/content" />
|
<category rdf:resource="https://projects.apache.org/category/content" />
|
||||||
<category rdf:resource="https://projects.apache.org/category/library" />
|
<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>
|
<release>
|
||||||
<Version>
|
<Version>
|
||||||
<name>Apache POI 3.15</name>
|
<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>
|
<parent>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<version>3.16-beta3-SNAPSHOT</version>
|
<version>3.17-beta1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>poi-examples</artifactId>
|
<artifactId>poi-examples</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<version>3.16-beta3-SNAPSHOT</version>
|
<version>3.17-beta1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>poi-excelant</artifactId>
|
<artifactId>poi-excelant</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<version>3.16-beta3-SNAPSHOT</version>
|
<version>3.17-beta1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>poi-main</artifactId>
|
<artifactId>poi-main</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<version>3.16-beta3-SNAPSHOT</version>
|
<version>3.17-beta1-SNAPSHOT</version>
|
||||||
<relativePath>..</relativePath>
|
<relativePath>..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>poi-ooxml-schema-encryption</artifactId>
|
<artifactId>poi-ooxml-schema-encryption</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<version>3.16-beta3-SNAPSHOT</version>
|
<version>3.17-beta1-SNAPSHOT</version>
|
||||||
<relativePath>..</relativePath>
|
<relativePath>..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>poi-ooxml-schema-security</artifactId>
|
<artifactId>poi-ooxml-schema-security</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<version>3.16-beta3-SNAPSHOT</version>
|
<version>3.17-beta1-SNAPSHOT</version>
|
||||||
<relativePath>..</relativePath>
|
<relativePath>..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>poi-ooxml-schema</artifactId>
|
<artifactId>poi-ooxml-schema</artifactId>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<version>3.16-beta3-SNAPSHOT</version>
|
<version>3.17-beta1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>poi-ooxml</artifactId>
|
<artifactId>poi-ooxml</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<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>
|
<name>Apache POI - the Java API for Microsoft Documents</name>
|
||||||
<description>Maven build of Apache POI for Sonar checks</description>
|
<description>Maven build of Apache POI for Sonar checks</description>
|
||||||
<url>http://poi.apache.org/</url>
|
<url>http://poi.apache.org/</url>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-parent</artifactId>
|
<artifactId>poi-parent</artifactId>
|
||||||
<version>3.16-beta3-SNAPSHOT</version>
|
<version>3.17-beta1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>poi-scratchpad</artifactId>
|
<artifactId>poi-scratchpad</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class CopyCompare
|
||||||
if (equal(oRoot, cRoot, messages)) {
|
if (equal(oRoot, cRoot, messages)) {
|
||||||
System.out.println("Equal");
|
System.out.println("Equal");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Not equal: " + messages.toString());
|
System.out.println("Not equal: " + messages);
|
||||||
}
|
}
|
||||||
cpfs.close();
|
cpfs.close();
|
||||||
opfs.close();
|
opfs.close();
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer
|
||||||
b.append(' ');
|
b.append(' ');
|
||||||
System.arraycopy(value, ((byte[])value).length - 4, buf, 0, 4);
|
System.arraycopy(value, ((byte[])value).length - 4, buf, 0, 4);
|
||||||
} else if (value != null) {
|
} else if (value != null) {
|
||||||
b.append(value.toString());
|
b.append(value);
|
||||||
} else {
|
} else {
|
||||||
b.append("null");
|
b.append("null");
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,14 @@ package org.apache.poi.ss.examples;
|
||||||
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
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.BuiltinFormats;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
import org.apache.poi.ss.usermodel.ColorScaleFormatting;
|
import org.apache.poi.ss.usermodel.ColorScaleFormatting;
|
||||||
import org.apache.poi.ss.usermodel.ComparisonOperator;
|
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.SheetConditionalFormatting;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.apache.poi.ss.util.CellReference;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,6 +59,12 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
*/
|
*/
|
||||||
public class ConditionalFormats {
|
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 {
|
public static void main(String[] args) throws IOException {
|
||||||
Workbook wb;
|
Workbook wb;
|
||||||
|
|
||||||
|
@ -76,6 +88,9 @@ public class ConditionalFormats {
|
||||||
colourScales(wb.createSheet("Colour Scales"));
|
colourScales(wb.createSheet("Colour Scales"));
|
||||||
dataBars(wb.createSheet("Data Bars"));
|
dataBars(wb.createSheet("Data Bars"));
|
||||||
|
|
||||||
|
// print overlapping rule results
|
||||||
|
evaluateRules(wb, "Overlapping");
|
||||||
|
|
||||||
// Write the output to a file
|
// Write the output to a file
|
||||||
String file = "cf-poi.xls";
|
String file = "cf-poi.xls";
|
||||||
if(wb instanceof XSSFWorkbook) {
|
if(wb instanceof XSSFWorkbook) {
|
||||||
|
@ -637,4 +652,76 @@ public class ConditionalFormats {
|
||||||
db3.getMaxThreshold().setRangeType(RangeType.MAX);
|
db3.getMaxThreshold().setRangeType(RangeType.MAX);
|
||||||
sheetCF.addConditionalFormatting(regions, rule3);
|
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");
|
System.out.println(" All cells evaluated without error");
|
||||||
} else {
|
} else {
|
||||||
for (CellReference cr : probs.unevaluatableCells.keySet()) {
|
for (CellReference cr : probs.unevaluatableCells.keySet()) {
|
||||||
System.out.println(" " + cr.formatAsString() + " - " +
|
System.out.println(" " + cr.formatAsString() + " - " +
|
||||||
probs.unevaluatableCells.get(cr).toString());
|
probs.unevaluatableCells.get(cr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class IterateCells {
|
||||||
for (Row row : sheet) {
|
for (Row row : sheet) {
|
||||||
System.out.println("rownum: " + row.getRowNum());
|
System.out.println("rownum: " + row.getRowNum());
|
||||||
for (Cell cell : row) {
|
for (Cell cell : row) {
|
||||||
System.out.println(cell.toString());
|
System.out.println(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,9 +198,9 @@ public class TestExcelAntWorkbookUtil extends TestCase {
|
||||||
precision);
|
precision);
|
||||||
|
|
||||||
//System.out.println(result);
|
//System.out.println(result);
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("evaluationCompletedWithError=false"));
|
assertTrue("Had:" + result, result.toString().contains("evaluationCompletedWithError=false"));
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("returnValue=790.79"));
|
assertTrue("Had:" + result, result.toString().contains("returnValue=790.79"));
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("cellName='MortgageCalculator'!B4"));
|
assertTrue("Had:" + result, result.toString().contains("cellName='MortgageCalculator'!B4"));
|
||||||
assertFalse(result.toString().contains("#N/A"));
|
assertFalse(result.toString().contains("#N/A"));
|
||||||
|
|
||||||
assertFalse(result.evaluationCompleteWithError());
|
assertFalse(result.evaluationCompleteWithError());
|
||||||
|
@ -220,10 +220,10 @@ public class TestExcelAntWorkbookUtil extends TestCase {
|
||||||
precision);
|
precision);
|
||||||
|
|
||||||
//System.out.println(result);
|
//System.out.println(result);
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("evaluationCompletedWithError=false"));
|
assertTrue("Had:" + result, result.toString().contains("evaluationCompletedWithError=false"));
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("returnValue=790.79"));
|
assertTrue("Had:" + result, result.toString().contains("returnValue=790.79"));
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("cellName='MortgageCalculator'!B4"));
|
assertTrue("Had:" + result, result.toString().contains("cellName='MortgageCalculator'!B4"));
|
||||||
assertFalse("Should not see an error, but had:" + result.toString(), result.toString().contains("#"));
|
assertFalse("Should not see an error, but had:" + result, result.toString().contains("#"));
|
||||||
|
|
||||||
assertFalse(result.evaluationCompleteWithError());
|
assertFalse(result.evaluationCompleteWithError());
|
||||||
assertFalse(result.didTestPass());
|
assertFalse(result.didTestPass());
|
||||||
|
@ -242,10 +242,10 @@ public class TestExcelAntWorkbookUtil extends TestCase {
|
||||||
precision);
|
precision);
|
||||||
|
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("evaluationCompletedWithError=true"));
|
assertTrue("Had:" + result, result.toString().contains("evaluationCompletedWithError=true"));
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("returnValue=0.0"));
|
assertTrue("Had:" + result, result.toString().contains("returnValue=0.0"));
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("cellName='ErrorCell'!A1"));
|
assertTrue("Had:" + result, result.toString().contains("cellName='ErrorCell'!A1"));
|
||||||
assertTrue("Had:" + result.toString(), result.toString().contains("#N/A"));
|
assertTrue("Had:" + result, result.toString().contains("#N/A"));
|
||||||
|
|
||||||
assertTrue(result.evaluationCompleteWithError());
|
assertTrue(result.evaluationCompleteWithError());
|
||||||
assertFalse(result.didTestPass());
|
assertFalse(result.didTestPass());
|
||||||
|
|
|
@ -40,10 +40,10 @@ public class HMEFFileHandler extends AbstractFileHandler {
|
||||||
|
|
||||||
// there are two test-files that have no body...
|
// there are two test-files that have no body...
|
||||||
if(!msg.getSubject().equals("Testing TNEF Message") && !msg.getSubject().equals("TNEF test message with attachments")) {
|
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());
|
msg.getBody());
|
||||||
}
|
}
|
||||||
assertNotNull("Had: " + msg.getBody() + ", " + msg.getSubject() + ", " + msg.getAttachments() + ": " + props.toString(),
|
assertNotNull("Had: " + msg.getBody() + ", " + msg.getSubject() + ", " + msg.getAttachments() + ": " + props,
|
||||||
msg.getSubject());
|
msg.getSubject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ public abstract class AbstractEscherOptRecord extends EscherRecord
|
||||||
|
|
||||||
for ( EscherProperty property : properties )
|
for ( EscherProperty property : properties )
|
||||||
{
|
{
|
||||||
stringBuilder.append(" ").append(property.toString()).append(nl);
|
stringBuilder.append(" ").append(property).append(nl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
|
|
|
@ -134,7 +134,7 @@ public final class EscherArrayProperty extends EscherComplexProperty implements
|
||||||
+ ", propName: " + EscherProperties.getPropertyName( getPropertyNumber() )
|
+ ", propName: " + EscherProperties.getPropertyName( getPropertyNumber() )
|
||||||
+ ", complex: " + isComplex()
|
+ ", complex: " + isComplex()
|
||||||
+ ", blipId: " + isBlipId()
|
+ ", blipId: " + isBlipId()
|
||||||
+ ", data: " + '\n' + results.toString();
|
+ ", data: " + '\n' + results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -294,7 +294,7 @@ public final class EscherContainerRecord extends EscherRecord implements Iterabl
|
||||||
+ " instance: 0x" + HexDump.toHex( getInstance() ) + nl
|
+ " instance: 0x" + HexDump.toHex( getInstance() ) + nl
|
||||||
+ " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl
|
+ " recordId: 0x" + HexDump.toHex( getRecordId() ) + nl
|
||||||
+ " numchildren: " + _childRecords.size() + nl
|
+ " numchildren: " + _childRecords.size() + nl
|
||||||
+ children.toString();
|
+ children;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -145,7 +145,7 @@ public final class EscherDggRecord extends EscherRecord {
|
||||||
" NumIdClusters: " + getNumIdClusters() + '\n' +
|
" NumIdClusters: " + getNumIdClusters() + '\n' +
|
||||||
" NumShapesSaved: " + field_3_numShapesSaved + '\n' +
|
" NumShapesSaved: " + field_3_numShapesSaved + '\n' +
|
||||||
" DrawingsSaved: " + field_4_drawingsSaved + '\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);
|
EscherRecord r = recordFactory.createRecord(data, pos);
|
||||||
int bytesRead = r.fillFields(data, pos, recordFactory );
|
int bytesRead = r.fillFields(data, pos, recordFactory );
|
||||||
out.println( r.toString() );
|
out.println(r);
|
||||||
pos += bytesRead;
|
pos += bytesRead;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ public final class EscherDump {
|
||||||
stringBuf.append( HexDump.toHex( recordBytesRemaining ) );
|
stringBuf.append( HexDump.toHex( recordBytesRemaining ) );
|
||||||
stringBuf.append( "] instance: " );
|
stringBuf.append( "] instance: " );
|
||||||
stringBuf.append( HexDump.toHex( ( (short) ( options >> 4 ) ) ) );
|
stringBuf.append( HexDump.toHex( ( (short) ( options >> 4 ) ) ) );
|
||||||
out.println( stringBuf.toString() );
|
out.println(stringBuf);
|
||||||
stringBuf.setLength(0);
|
stringBuf.setLength(0);
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ public final class EscherDump {
|
||||||
n8 = (byte) in.read();
|
n8 = (byte) in.read();
|
||||||
stringBuf.append( HexDump.toHex( n8 ) );
|
stringBuf.append( HexDump.toHex( n8 ) );
|
||||||
stringBuf.append( getBlipType( n8 ) );
|
stringBuf.append( getBlipType( n8 ) );
|
||||||
out.println( stringBuf.toString() );
|
out.println(stringBuf);
|
||||||
|
|
||||||
out.println( " rgbUid:" );
|
out.println( " rgbUid:" );
|
||||||
HexDump.dump( in, out, 0, 16 );
|
HexDump.dump( in, out, 0, 16 );
|
||||||
|
|
|
@ -624,7 +624,7 @@ public final class EscherProperties {
|
||||||
addProp( m, GROUPSHAPE__BORDERBOTTOMCOLOR, "groupshape.borderBottomColor" ); // 0x039D;
|
addProp( m, GROUPSHAPE__BORDERBOTTOMCOLOR, "groupshape.borderBottomColor" ); // 0x039D;
|
||||||
addProp( m, GROUPSHAPE__BORDERRIGHTCOLOR, "groupshape.borderRightColor" ); // 0x039E;
|
addProp( m, GROUPSHAPE__BORDERRIGHTCOLOR, "groupshape.borderRightColor" ); // 0x039E;
|
||||||
addProp( m, GROUPSHAPE__TABLEPROPERTIES, "groupshape.tableProperties" ); // 0x039F;
|
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__WEBBOT, "groupshape.wzWebBot" ); // 0x03A5;
|
||||||
addProp( m, GROUPSHAPE__METROBLOB, "groupshape.metroBlob" ); // 0x03A9;
|
addProp( m, GROUPSHAPE__METROBLOB, "groupshape.metroBlob" ); // 0x03A9;
|
||||||
addProp( m, GROUPSHAPE__ZORDER, "groupshape.dhgt" ); // 0x03AA;
|
addProp( m, GROUPSHAPE__ZORDER, "groupshape.dhgt" ); // 0x03AA;
|
||||||
|
|
|
@ -136,7 +136,7 @@ public final class UnknownEscherRecord extends EscherRecord implements Cloneable
|
||||||
if (getChildRecords().size() > 0) {
|
if (getChildRecords().size() > 0) {
|
||||||
children.append( " children: " + '\n' );
|
children.append( " children: " + '\n' );
|
||||||
for (EscherRecord record : _childRecords) {
|
for (EscherRecord record : _childRecords) {
|
||||||
children.append( record.toString() );
|
children.append(record);
|
||||||
children.append( '\n' );
|
children.append( '\n' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ public final class UnknownEscherRecord extends EscherRecord implements Cloneable
|
||||||
" recordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
|
" recordId: 0x" + HexDump.toHex( getRecordId() ) + '\n' +
|
||||||
" numchildren: " + getChildRecords().size() + '\n' +
|
" numchildren: " + getChildRecords().size() + '\n' +
|
||||||
theDumpHex +
|
theDumpHex +
|
||||||
children.toString();
|
children;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -415,7 +415,7 @@ public class Property {
|
||||||
final Object value = getValue();
|
final Object value = getValue();
|
||||||
b.append(", value: ");
|
b.append(", value: ");
|
||||||
if (value instanceof String) {
|
if (value instanceof String) {
|
||||||
b.append(value.toString());
|
b.append(value);
|
||||||
final String s = (String) value;
|
final String s = (String) value;
|
||||||
final int l = s.length();
|
final int l = s.length();
|
||||||
final byte[] bytes = new byte[l * 2];
|
final byte[] bytes = new byte[l * 2];
|
||||||
|
@ -439,7 +439,7 @@ public class Property {
|
||||||
b.append(hex);
|
b.append(hex);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
b.append(value.toString());
|
b.append(value);
|
||||||
}
|
}
|
||||||
b.append(']');
|
b.append(']');
|
||||||
return b.toString();
|
return b.toString();
|
||||||
|
|
|
@ -982,7 +982,7 @@ public class Section {
|
||||||
b.append(getSize());
|
b.append(getSize());
|
||||||
b.append(", properties: [\n");
|
b.append(", properties: [\n");
|
||||||
for (int i = 0; i < pa.length; i++) {
|
for (int i = 0; i < pa.length; i++) {
|
||||||
b.append(pa[i].toString());
|
b.append(pa[i]);
|
||||||
b.append(",\n");
|
b.append(",\n");
|
||||||
}
|
}
|
||||||
b.append(']');
|
b.append(']');
|
||||||
|
|
|
@ -331,9 +331,9 @@ public class VariantSupport extends Variant {
|
||||||
case Variant.VT_I4:
|
case Variant.VT_I4:
|
||||||
if (!(value instanceof Integer)) {
|
if (!(value instanceof Integer)) {
|
||||||
throw new ClassCastException("Could not cast an object to "
|
throw new ClassCastException("Could not cast an object to "
|
||||||
+ Integer.class.toString() + ": "
|
+ Integer.class + ": "
|
||||||
+ value.getClass().toString() + ", "
|
+ value.getClass() + ", "
|
||||||
+ value.toString());
|
+ value);
|
||||||
}
|
}
|
||||||
length += TypeWriter.writeToStream(out, ((Integer) value).intValue());
|
length += TypeWriter.writeToStream(out, ((Integer) value).intValue());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -256,7 +256,7 @@ public final class BiffViewer {
|
||||||
for (String header : recListener.getRecentHeaders()) {
|
for (String header : recListener.getRecentHeaders()) {
|
||||||
ps.println(header);
|
ps.println(header);
|
||||||
}
|
}
|
||||||
ps.print(record.toString());
|
ps.print(record);
|
||||||
} else {
|
} else {
|
||||||
recStream.readRemainder();
|
recStream.readRemainder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class EFBiffViewer
|
||||||
{
|
{
|
||||||
public void processRecord(Record rec)
|
public void processRecord(Record rec)
|
||||||
{
|
{
|
||||||
System.out.println(rec.toString());
|
System.out.println(rec);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
HSSFEventFactory factory = new HSSFEventFactory();
|
HSSFEventFactory factory = new HSSFEventFactory();
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class FormulaViewer
|
||||||
}
|
}
|
||||||
buf.append(sep);
|
buf.append(sep);
|
||||||
buf.append(numArg);
|
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:
|
case STRING:
|
||||||
HSSFRichTextString str = cell.getRichStringCellValue();
|
HSSFRichTextString str = cell.getRichStringCellValue();
|
||||||
if(str != null && str.length() > 0) {
|
if(str != null && str.length() > 0) {
|
||||||
text.append(str.toString());
|
text.append(str);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NUMERIC:
|
case NUMERIC:
|
||||||
|
|
|
@ -91,7 +91,7 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
||||||
if (escherRecords.size() == 0)
|
if (escherRecords.size() == 0)
|
||||||
buffer.append("No Escher Records Decoded" + nl);
|
buffer.append("No Escher Records Decoded" + nl);
|
||||||
for (EscherRecord r : escherRecords) {
|
for (EscherRecord r : escherRecords) {
|
||||||
buffer.append(r.toString());
|
buffer.append(r);
|
||||||
}
|
}
|
||||||
buffer.append("[/" + getRecordName() + ']' + nl);
|
buffer.append("[/" + getRecordName() + ']' + nl);
|
||||||
|
|
||||||
|
|
|
@ -81,14 +81,14 @@ public final class ArrayRecord extends SharedValueRecordBase implements Cloneabl
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(getClass().getName()).append(" [ARRAY]\n");
|
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(" options=").append(HexDump.shortToHex(_options)).append("\n");
|
||||||
sb.append(" notUsed=").append(HexDump.intToHex(_field3notUsed)).append("\n");
|
sb.append(" notUsed=").append(HexDump.intToHex(_field3notUsed)).append("\n");
|
||||||
sb.append(" formula:").append("\n");
|
sb.append(" formula:").append("\n");
|
||||||
Ptg[] ptgs = _formula.getTokens();
|
Ptg[] ptgs = _formula.getTokens();
|
||||||
for (int i = 0; i < ptgs.length; i++) {
|
for (int i = 0; i < ptgs.length; i++) {
|
||||||
Ptg ptg = ptgs[i];
|
Ptg ptg = ptgs[i];
|
||||||
sb.append(ptg.toString()).append(ptg.getRVAType()).append("\n");
|
sb.append(ptg).append(ptg.getRVAType()).append("\n");
|
||||||
}
|
}
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
return sb.toString();
|
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.enclosingCellRange= ").append(getEnclosingCellRange()).append("\n");
|
||||||
buffer.append("\t.cfranges=[");
|
buffer.append("\t.cfranges=[");
|
||||||
for( int i=0; i<field_4_cell_ranges.countRanges(); i++) {
|
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("]\n");
|
||||||
buffer.append("[/").append(getRecordName()).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(" .dxfn12_length =0x").append(Integer.toHexString(ext_formatting_length)).append("\n");
|
||||||
buffer.append(" .option_flags =0x").append(Integer.toHexString(getOptions())).append("\n");
|
buffer.append(" .option_flags =0x").append(Integer.toHexString(getOptions())).append("\n");
|
||||||
if (containsFontFormattingBlock()) {
|
if (containsFontFormattingBlock()) {
|
||||||
buffer.append(_fontFormatting.toString()).append("\n");
|
buffer.append(_fontFormatting).append("\n");
|
||||||
}
|
}
|
||||||
if (containsBorderFormattingBlock()) {
|
if (containsBorderFormattingBlock()) {
|
||||||
buffer.append(_borderFormatting.toString()).append("\n");
|
buffer.append(_borderFormatting).append("\n");
|
||||||
}
|
}
|
||||||
if (containsPatternFormattingBlock()) {
|
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(" .dxfn12_ext=").append(HexDump.toHex(ext_formatting_data)).append("\n");
|
||||||
buffer.append(" .formula_1 =").append(Arrays.toString(getFormula1().getTokens())).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(" .condition_type =").append(getConditionType()).append("\n");
|
||||||
buffer.append(" OPTION FLAGS=0x").append(Integer.toHexString(getOptions())).append("\n");
|
buffer.append(" OPTION FLAGS=0x").append(Integer.toHexString(getOptions())).append("\n");
|
||||||
if (containsFontFormattingBlock()) {
|
if (containsFontFormattingBlock()) {
|
||||||
buffer.append(_fontFormatting.toString()).append("\n");
|
buffer.append(_fontFormatting).append("\n");
|
||||||
}
|
}
|
||||||
if (containsBorderFormattingBlock()) {
|
if (containsBorderFormattingBlock()) {
|
||||||
buffer.append(_borderFormatting.toString()).append("\n");
|
buffer.append(_borderFormatting).append("\n");
|
||||||
}
|
}
|
||||||
if (containsPatternFormattingBlock()) {
|
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 1 =").append(Arrays.toString(getFormula1().getTokens())).append("\n");
|
||||||
buffer.append(" Formula 2 =").append(Arrays.toString(getFormula2().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();
|
Ptg[] ptgs = f.getTokens();
|
||||||
sb.append('\n');
|
sb.append('\n');
|
||||||
for (Ptg ptg : ptgs) {
|
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) {
|
if (field_2_refPtg == null) {
|
||||||
sb.append(" .f3unknown = ").append(HexDump.toHex(field_2_unknownFormulaData)).append("\n");
|
sb.append(" .f3unknown = ").append(HexDump.toHex(field_2_unknownFormulaData)).append("\n");
|
||||||
} else {
|
} 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) {
|
if (field_4_ole_classname != null) {
|
||||||
sb.append(" .unicodeFlag = ").append(field_3_unicode_flag).append("\n");
|
sb.append(" .unicodeFlag = ").append(field_3_unicode_flag).append("\n");
|
||||||
|
|
|
@ -329,7 +329,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
result.append('[').append(getRecordName()).append(']').append(nl);
|
result.append('[').append(getRecordName()).append(']').append(nl);
|
||||||
for (EscherRecord escherRecord : getEscherRecords()) {
|
for (EscherRecord escherRecord : getEscherRecords()) {
|
||||||
result.append(escherRecord.toString());
|
result.append(escherRecord);
|
||||||
}
|
}
|
||||||
result.append("[/").append(getRecordName()).append(']').append(nl);
|
result.append("[/").append(getRecordName()).append(']').append(nl);
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ public class ExternSheetRecord extends StandardRecord {
|
||||||
sb.append(" numOfRefs = ").append(nItems).append("\n");
|
sb.append(" numOfRefs = ").append(nItems).append("\n");
|
||||||
for (int i=0; i < nItems; i++) {
|
for (int i=0; i < nItems; i++) {
|
||||||
sb.append("refrec #").append(i).append(": ");
|
sb.append("refrec #").append(i).append(": ");
|
||||||
sb.append(getRef(i).toString());
|
sb.append(getRef(i));
|
||||||
sb.append('\n');
|
sb.append('\n');
|
||||||
}
|
}
|
||||||
sb.append("[/EXTERNSHEET]\n");
|
sb.append("[/EXTERNSHEET]\n");
|
||||||
|
|
|
@ -222,7 +222,7 @@ public final class ExternalNameRecord extends StandardRecord {
|
||||||
if(field_5_name_definition != null) {
|
if(field_5_name_definition != null) {
|
||||||
Ptg[] ptgs = field_5_name_definition.getTokens();
|
Ptg[] ptgs = field_5_name_definition.getTokens();
|
||||||
for (Ptg ptg : ptgs) {
|
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");
|
sb.append("[/EXTERNALNAME]\n");
|
||||||
|
|
|
@ -380,7 +380,7 @@ public final class FormulaRecord extends CellRecord implements Cloneable {
|
||||||
}
|
}
|
||||||
sb.append(" Ptg[").append(k).append("]=");
|
sb.append(" Ptg[").append(k).append("]=");
|
||||||
Ptg ptg = ptgs[k];
|
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(" .unknownShort1 =").append(HexDump.shortToHex(_cbFContinued)).append("\n");
|
||||||
sb.append(" .formula = ").append('\n');
|
sb.append(" .formula = ").append('\n');
|
||||||
if(_linkPtg != null) {
|
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(" .nEntryCount =").append(HexDump.shortToHex(_cLines)).append("\n");
|
||||||
sb.append(" .selEntryIx =").append(HexDump.shortToHex(_iSel)).append("\n");
|
sb.append(" .selEntryIx =").append(HexDump.shortToHex(_iSel)).append("\n");
|
||||||
sb.append(" .style =").append(HexDump.shortToHex(_flags)).append("\n");
|
sb.append(" .style =").append(HexDump.shortToHex(_flags)).append("\n");
|
||||||
sb.append(" .unknownShort10=").append(HexDump.shortToHex(_idEdit)).append("\n");
|
sb.append(" .unknownShort10=").append(HexDump.shortToHex(_idEdit)).append("\n");
|
||||||
if(_dropData != null) {
|
if(_dropData != null) {
|
||||||
sb.append('\n').append(_dropData.toString());
|
sb.append('\n').append(_dropData);
|
||||||
}
|
}
|
||||||
sb.append("[/ftLbsData]\n");
|
sb.append("[/ftLbsData]\n");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
|
@ -553,7 +553,7 @@ public final class NameRecord extends ContinuableRecord {
|
||||||
Ptg[] ptgs = field_13_name_definition.getTokens();
|
Ptg[] ptgs = field_13_name_definition.getTokens();
|
||||||
sb.append(" .Formula (nTokens=").append(ptgs.length).append("):") .append("\n");
|
sb.append(" .Formula (nTokens=").append(ptgs.length).append("):") .append("\n");
|
||||||
for (Ptg ptg : ptgs) {
|
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");
|
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");
|
sb.append("[OBJ]\n");
|
||||||
if(subrecords != null) { // there are special cases where this can be, see comments in constructor above
|
if(subrecords != null) { // there are special cases where this can be, see comments in constructor above
|
||||||
for (final SubRecord record : subrecords) {
|
for (final SubRecord record : subrecords) {
|
||||||
sb.append("SUBRECORD: ").append(record.toString());
|
sb.append("SUBRECORD: ").append(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sb.append("[/OBJ]\n");
|
sb.append("[/OBJ]\n");
|
||||||
|
|
|
@ -62,7 +62,7 @@ public final class PaletteRecord extends StandardRecord {
|
||||||
for (int i = 0; i < _colors.size(); i++) {
|
for (int i = 0; i < _colors.size(); i++) {
|
||||||
PColor c = _colors.get(i);
|
PColor c = _colors.get(i);
|
||||||
buffer.append("* colornum = ").append(i).append('\n');
|
buffer.append("* colornum = ").append(i).append('\n');
|
||||||
buffer.append(c.toString());
|
buffer.append(c);
|
||||||
buffer.append("/*colornum = ").append(i).append('\n');
|
buffer.append("/*colornum = ").append(i).append('\n');
|
||||||
}
|
}
|
||||||
buffer.append("[/PALETTE]\n");
|
buffer.append("[/PALETTE]\n");
|
||||||
|
|
|
@ -80,14 +80,14 @@ public final class SharedFormulaRecord extends SharedValueRecordBase {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
|
||||||
buffer.append("[SHARED FORMULA (").append(HexDump.intToHex(sid)).append("]\n");
|
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");
|
buffer.append(" .reserved = ").append(HexDump.shortToHex(field_5_reserved)).append("\n");
|
||||||
|
|
||||||
Ptg[] ptgs = field_7_parsed_expr.getTokens();
|
Ptg[] ptgs = field_7_parsed_expr.getTokens();
|
||||||
for (int k = 0; k < ptgs.length; k++ ) {
|
for (int k = 0; k < ptgs.length; k++ ) {
|
||||||
buffer.append("Formula[").append(k).append("]");
|
buffer.append("Formula[").append(k).append("]");
|
||||||
Ptg ptg = ptgs[k];
|
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");
|
buffer.append("[/SHARED FORMULA]\n");
|
||||||
|
|
|
@ -158,7 +158,7 @@ public final class TableRecord extends SharedValueRecordBase {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append("[TABLE]\n");
|
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(" .flags = ") .append(HexDump.byteToHex(field_5_flags)).append("\n");
|
||||||
buffer.append(" .alwaysClc= ").append(isAlwaysCalc()).append("\n");
|
buffer.append(" .alwaysClc= ").append(isAlwaysCalc()).append("\n");
|
||||||
buffer.append(" .reserved = ").append(HexDump.intToHex(field_6_res)).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");
|
buffer.append("[").append(type).append("]\n");
|
||||||
if( header != null ) {
|
if( header != null ) {
|
||||||
buffer.append(header.toString());
|
buffer.append(header);
|
||||||
}
|
}
|
||||||
for (CFRuleBase cfRule : rules) {
|
for (CFRuleBase cfRule : rules) {
|
||||||
buffer.append(cfRule.toString());
|
buffer.append(cfRule);
|
||||||
}
|
}
|
||||||
buffer.append("[/").append(type).append("]\n");
|
buffer.append("[/").append(type).append("]\n");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
|
|
|
@ -59,7 +59,7 @@ public final class SharedValueManager {
|
||||||
public SharedFormulaGroup(SharedFormulaRecord sfr, CellReference firstCell) {
|
public SharedFormulaGroup(SharedFormulaRecord sfr, CellReference firstCell) {
|
||||||
if (!sfr.isInRange(firstCell.getRow(), firstCell.getCol())) {
|
if (!sfr.isInRange(firstCell.getRow(), firstCell.getCol())) {
|
||||||
throw new IllegalArgumentException("First formula cell " + firstCell.formatAsString()
|
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;
|
_sfr = sfr;
|
||||||
_firstCell = firstCell;
|
_firstCell = firstCell;
|
||||||
|
@ -94,7 +94,7 @@ public final class SharedValueManager {
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
StringBuffer sb = new StringBuffer(64);
|
StringBuffer sb = new StringBuffer(64);
|
||||||
sb.append(getClass().getName()).append(" [");
|
sb.append(getClass().getName()).append(" [");
|
||||||
sb.append(_sfr.getRange().toString());
|
sb.append(_sfr.getRange());
|
||||||
sb.append("]");
|
sb.append("]");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,10 +124,10 @@ public final class ColorGradientFormatting implements Cloneable {
|
||||||
buffer.append(" .clamp = ").append(isClampToCurve()).append("\n");
|
buffer.append(" .clamp = ").append(isClampToCurve()).append("\n");
|
||||||
buffer.append(" .background= ").append(isAppliesToBackground()).append("\n");
|
buffer.append(" .background= ").append(isAppliesToBackground()).append("\n");
|
||||||
for (Threshold t : thresholds) {
|
for (Threshold t : thresholds) {
|
||||||
buffer.append(t.toString());
|
buffer.append(t);
|
||||||
}
|
}
|
||||||
for (ExtendedColor c : colors) {
|
for (ExtendedColor c : colors) {
|
||||||
buffer.append(c.toString());
|
buffer.append(c);
|
||||||
}
|
}
|
||||||
buffer.append(" [/Color Gradient Formatting]\n");
|
buffer.append(" [/Color Gradient Formatting]\n");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
|
|
|
@ -103,7 +103,7 @@ public final class IconMultiStateFormatting implements Cloneable {
|
||||||
buffer.append(" .icon_only= ").append(isIconOnly()).append("\n");
|
buffer.append(" .icon_only= ").append(isIconOnly()).append("\n");
|
||||||
buffer.append(" .reversed = ").append(isReversed()).append("\n");
|
buffer.append(" .reversed = ").append(isReversed()).append("\n");
|
||||||
for (Threshold t : thresholds) {
|
for (Threshold t : thresholds) {
|
||||||
buffer.append(t.toString());
|
buffer.append(t);
|
||||||
}
|
}
|
||||||
buffer.append(" [/Icon Formatting]\n");
|
buffer.append(" [/Icon Formatting]\n");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
|
|
|
@ -78,7 +78,7 @@ public final class LinkedDataRecord extends StandardRecord implements Cloneable
|
||||||
Ptg[] ptgs = field_5_formulaOfLink.getTokens();
|
Ptg[] ptgs = field_5_formulaOfLink.getTokens();
|
||||||
for (int i = 0; i < ptgs.length; i++) {
|
for (int i = 0; i < ptgs.length; i++) {
|
||||||
Ptg ptg = ptgs[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");
|
buffer.append("[/AI]\n");
|
||||||
|
|
|
@ -706,12 +706,12 @@ public class UnicodeString implements Comparable<UnicodeString> {
|
||||||
if (field_4_format_runs != null) {
|
if (field_4_format_runs != null) {
|
||||||
for (int i = 0; i < field_4_format_runs.size();i++) {
|
for (int i = 0; i < field_4_format_runs.size();i++) {
|
||||||
FormatRun r = field_4_format_runs.get(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) {
|
if (field_5_ext_rst != null) {
|
||||||
buffer.append(" .field_5_ext_rst = ").append("\n");
|
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");
|
buffer.append("[/UNICODESTRING]\n");
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
|
|
|
@ -1980,7 +1980,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
||||||
List<EscherRecord> escherRecords = r.getEscherRecords();
|
List<EscherRecord> escherRecords = r.getEscherRecords();
|
||||||
for (EscherRecord escherRecord : escherRecords) {
|
for (EscherRecord escherRecord : escherRecords) {
|
||||||
if (fat) {
|
if (fat) {
|
||||||
pw.println(escherRecord.toString());
|
pw.println(escherRecord);
|
||||||
} else {
|
} else {
|
||||||
escherRecord.display(pw, 0);
|
escherRecord.display(pw, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,4 +263,9 @@ public class HSSFSimpleShape extends HSSFShape implements SimpleShape
|
||||||
}
|
}
|
||||||
return _textObjectRecord;
|
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()));
|
PrintWriter w = new PrintWriter(new OutputStreamWriter(System.out, Charset.defaultCharset()));
|
||||||
for (EscherRecord escherRecord : escherRecords) {
|
for (EscherRecord escherRecord : escherRecords) {
|
||||||
if (fat) {
|
if (fat) {
|
||||||
System.out.println(escherRecord.toString());
|
System.out.println(escherRecord);
|
||||||
} else {
|
} else {
|
||||||
escherRecord.display(w, 0);
|
escherRecord.display(w, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ public abstract class ChunkedCipherInputStream extends LittleEndianInputStream {
|
||||||
long skipN = (index - lastIndex) << chunkBits;
|
long skipN = (index - lastIndex) << chunkBits;
|
||||||
if (super.skip(skipN) < skipN) {
|
if (super.skip(skipN) < skipN) {
|
||||||
throw new EOFException("buffer underrun");
|
throw new EOFException("buffer underrun");
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastIndex = index + 1;
|
lastIndex = index + 1;
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class StandardEncryptionInfoBuilder implements EncryptionInfoBuilder {
|
||||||
found |= (ks == keyBits);
|
found |= (ks == keyBits);
|
||||||
}
|
}
|
||||||
if (!found) {
|
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.setHeader(new StandardEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
|
||||||
info.setVerifier(new StandardEncryptionVerifier(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) {
|
} else if (value instanceof Boolean) {
|
||||||
toAppendTo.append(value.toString().toUpperCase(Locale.ROOT));
|
toAppendTo.append(value.toString().toUpperCase(Locale.ROOT));
|
||||||
} else {
|
} else {
|
||||||
toAppendTo.append(value.toString());
|
toAppendTo.append(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,10 @@ public class ConditionalFormattingEvaluator {
|
||||||
protected List<EvaluationConditionalFormatRule> getRules(Sheet sheet) {
|
protected List<EvaluationConditionalFormatRule> getRules(Sheet sheet) {
|
||||||
final String sheetName = sheet.getSheetName();
|
final String sheetName = sheet.getSheetName();
|
||||||
List<EvaluationConditionalFormatRule> rules = formats.get(sheetName);
|
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 SheetConditionalFormatting scf = sheet.getSheetConditionalFormatting();
|
||||||
final int count = scf.getNumConditionalFormattings();
|
final int count = scf.getNumConditionalFormattings();
|
||||||
rules = new ArrayList<EvaluationConditionalFormatRule>(count);
|
rules = new ArrayList<EvaluationConditionalFormatRule>(count);
|
||||||
|
@ -149,12 +152,17 @@ public class ConditionalFormattingEvaluator {
|
||||||
public List<EvaluationConditionalFormatRule> getConditionalFormattingForCell(final CellReference cellRef) {
|
public List<EvaluationConditionalFormatRule> getConditionalFormattingForCell(final CellReference cellRef) {
|
||||||
String sheetName = cellRef.getSheetName();
|
String sheetName = cellRef.getSheetName();
|
||||||
Sheet sheet = null;
|
Sheet sheet = null;
|
||||||
if (sheetName == null) sheet = workbook.getSheetAt(workbook.getActiveSheetIndex());
|
if (sheetName == null) {
|
||||||
else sheet = workbook.getSheet(sheetName);
|
sheet = workbook.getSheetAt(workbook.getActiveSheetIndex());
|
||||||
|
} else {
|
||||||
|
sheet = workbook.getSheet(sheetName);
|
||||||
|
}
|
||||||
|
|
||||||
final Cell cell = SheetUtil.getCell(sheet, cellRef.getRow(), cellRef.getCol());
|
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);
|
return getConditionalFormattingForCell(cell, cellRef);
|
||||||
}
|
}
|
||||||
|
@ -202,7 +210,9 @@ public class ConditionalFormattingEvaluator {
|
||||||
boolean stopIfTrue = false;
|
boolean stopIfTrue = false;
|
||||||
for (EvaluationConditionalFormatRule rule : getRules(cell.getSheet())) {
|
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)) {
|
if (rule.matches(cell)) {
|
||||||
rules.add(rule);
|
rules.add(rule);
|
||||||
|
@ -268,13 +278,19 @@ public class ConditionalFormattingEvaluator {
|
||||||
for (CellRangeAddress region : rule.getRegions()) {
|
for (CellRangeAddress region : rule.getRegions()) {
|
||||||
for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
|
for (int r = region.getFirstRow(); r <= region.getLastRow(); r++) {
|
||||||
final Row row = sheet.getRow(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++) {
|
for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
|
||||||
final Cell cell = row.getCell(c);
|
final Cell cell = row.getCell(c);
|
||||||
if (cell == null) continue;
|
if (cell == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
List<EvaluationConditionalFormatRule> cellRules = getConditionalFormattingForCell(cell);
|
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
|
* Defined as equal sheet name and formatting and rule indexes
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
* @see java.lang.Object#equals(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) return false;
|
if (obj == null) {
|
||||||
if (! obj.getClass().equals(this.getClass())) return false;
|
return false;
|
||||||
|
}
|
||||||
|
if (! obj.getClass().equals(this.getClass())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final EvaluationConditionalFormatRule r = (EvaluationConditionalFormatRule) obj;
|
final EvaluationConditionalFormatRule r = (EvaluationConditionalFormatRule) obj;
|
||||||
return getSheet().getSheetName().equalsIgnoreCase(r.getSheet().getSheetName())
|
return getSheet().getSheetName().equalsIgnoreCase(r.getSheet().getSheetName())
|
||||||
&& getFormattingIndex() == r.getFormattingIndex()
|
&& getFormattingIndex() == r.getFormattingIndex()
|
||||||
|
@ -203,21 +208,29 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
* @param o
|
* @param o
|
||||||
* @return comparison based on sheet name, formatting index, and rule priority
|
* @return comparison based on sheet name, formatting index, and rule priority
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int compareTo(EvaluationConditionalFormatRule o) {
|
public int compareTo(EvaluationConditionalFormatRule o) {
|
||||||
int cmp = getSheet().getSheetName().compareToIgnoreCase(o.getSheet().getSheetName());
|
int cmp = getSheet().getSheetName().compareToIgnoreCase(o.getSheet().getSheetName());
|
||||||
if (cmp != 0) return cmp;
|
if (cmp != 0) {
|
||||||
|
return cmp;
|
||||||
|
}
|
||||||
|
|
||||||
final int x = getPriority();
|
final int x = getPriority();
|
||||||
final int y = o.getPriority();
|
final int y = o.getPriority();
|
||||||
// logic from Integer.compare()
|
// logic from Integer.compare()
|
||||||
cmp = (x < y) ? -1 : ((x == y) ? 0 : 1);
|
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()));
|
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()));
|
return new Integer(getRuleIndex()).compareTo(new Integer(o.getRuleIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = sheet.getSheetName().hashCode();
|
int hash = sheet.getSheetName().hashCode();
|
||||||
hash = 31 * hash + formattingIndex;
|
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();
|
final ConditionType ruleType = getRule().getConditionType();
|
||||||
|
|
||||||
|
@ -276,7 +292,9 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
|| (DataValidationEvaluator.isType(cell,CellType.STRING)
|
|| (DataValidationEvaluator.isType(cell,CellType.STRING)
|
||||||
&& (cell.getStringCellValue() == null || cell.getStringCellValue().isEmpty())
|
&& (cell.getStringCellValue() == null || cell.getStringCellValue().isEmpty())
|
||||||
)
|
)
|
||||||
) return false;
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ValueEval eval = unwrapEval(workbookEvaluator.evaluate(rule.getFormula1(), ConditionalFormattingEvaluator.getRef(cell), region));
|
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));
|
ValueEval comp = unwrapEval(workbookEvaluator.evaluate(rule.getFormula1(), ConditionalFormattingEvaluator.getRef(cell), region));
|
||||||
|
|
||||||
// Copied for now from DataValidationEvaluator.ValidationEnum.FORMULA#isValidValue()
|
// Copied for now from DataValidationEvaluator.ValidationEnum.FORMULA#isValidValue()
|
||||||
if (comp instanceof BlankEval) return true;
|
if (comp instanceof BlankEval) {
|
||||||
if (comp instanceof ErrorEval) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if (comp instanceof ErrorEval) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (comp instanceof BoolEval) {
|
if (comp instanceof BoolEval) {
|
||||||
return ((BoolEval) comp).getBooleanValue();
|
return ((BoolEval) comp).getBooleanValue();
|
||||||
}
|
}
|
||||||
|
@ -343,7 +365,9 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
|
|
||||||
private boolean checkFilter(Cell cell, CellRangeAddress region) {
|
private boolean checkFilter(Cell cell, CellRangeAddress region) {
|
||||||
final ConditionFilterType filterType = rule.getConditionFilterType();
|
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,
|
// 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,
|
// 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.
|
// numbers stored as text are ignored, but numbers formatted as text are treated as numbers.
|
||||||
|
|
||||||
final ValueAndFormat cv10 = getCellValue(cell);
|
final ValueAndFormat cv10 = getCellValue(cell);
|
||||||
if (! cv10.isNumber()) return false;
|
if (! cv10.isNumber()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return getMeaningfulValues(region, false, new ValueFunction() {
|
return getMeaningfulValues(region, false, new ValueFunction() {
|
||||||
|
@Override
|
||||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||||
List<ValueAndFormat> values = allValues;
|
List<ValueAndFormat> values = allValues;
|
||||||
final ConditionFilterData conf = rule.getFilterConfiguration();
|
final ConditionFilterData conf = rule.getFilterConfiguration();
|
||||||
|
|
||||||
if (! conf.getBottom()) Collections.sort(values, Collections.reverseOrder());
|
if (! conf.getBottom()) {
|
||||||
else Collections.sort(values);
|
Collections.sort(values, Collections.reverseOrder());
|
||||||
|
} else {
|
||||||
|
Collections.sort(values);
|
||||||
|
}
|
||||||
|
|
||||||
int limit = (int) conf.getRank();
|
int limit = (int) conf.getRank();
|
||||||
if (conf.getPercent()) limit = allValues.size() * limit / 100;
|
if (conf.getPercent()) {
|
||||||
if (allValues.size() <= limit) return new HashSet<ValueAndFormat>(allValues);
|
limit = allValues.size() * limit / 100;
|
||||||
|
}
|
||||||
|
if (allValues.size() <= limit) {
|
||||||
|
return new HashSet<ValueAndFormat>(allValues);
|
||||||
|
}
|
||||||
|
|
||||||
return new HashSet<ValueAndFormat>(allValues.subList(0, limit));
|
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
|
// 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
|
// 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() {
|
return getMeaningfulValues(region, true, new ValueFunction() {
|
||||||
|
@Override
|
||||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||||
List<ValueAndFormat> values = allValues;
|
List<ValueAndFormat> values = allValues;
|
||||||
Collections.sort(values);
|
Collections.sort(values);
|
||||||
|
@ -402,6 +437,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
// Per Excel help, "duplicate" means matching value AND format
|
// 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
|
// 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() {
|
return getMeaningfulValues(region, true, new ValueFunction() {
|
||||||
|
@Override
|
||||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||||
List<ValueAndFormat> values = allValues;
|
List<ValueAndFormat> values = allValues;
|
||||||
Collections.sort(values);
|
Collections.sort(values);
|
||||||
|
@ -428,6 +464,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
|
|
||||||
// actually ordered, so iteration order is predictable
|
// actually ordered, so iteration order is predictable
|
||||||
List<ValueAndFormat> values = new ArrayList<ValueAndFormat>(getMeaningfulValues(region, false, new ValueFunction() {
|
List<ValueAndFormat> values = new ArrayList<ValueAndFormat>(getMeaningfulValues(region, false, new ValueFunction() {
|
||||||
|
@Override
|
||||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||||
List<ValueAndFormat> values = allValues;
|
List<ValueAndFormat> values = allValues;
|
||||||
double total = 0;
|
double total = 0;
|
||||||
|
@ -449,7 +486,9 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
|
|
||||||
final ValueAndFormat cv = getCellValue(cell);
|
final ValueAndFormat cv = getCellValue(cell);
|
||||||
Double val = cv.isNumber() ? cv.getValue() : null;
|
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 avg = values.get(0).value.doubleValue();
|
||||||
double stdDev = values.get(1).value.doubleValue();
|
double stdDev = values.get(1).value.doubleValue();
|
||||||
|
@ -464,11 +503,17 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
|
|
||||||
OperatorEnum op = null;
|
OperatorEnum op = null;
|
||||||
if (conf.getAboveAverage()) {
|
if (conf.getAboveAverage()) {
|
||||||
if (conf.getEqualAverage()) op = OperatorEnum.GREATER_OR_EQUAL;
|
if (conf.getEqualAverage()) {
|
||||||
else op = OperatorEnum.GREATER_THAN;
|
op = OperatorEnum.GREATER_OR_EQUAL;
|
||||||
|
} else {
|
||||||
|
op = OperatorEnum.GREATER_THAN;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (conf.getEqualAverage()) op = OperatorEnum.LESS_OR_EQUAL;
|
if (conf.getEqualAverage()) {
|
||||||
else op = OperatorEnum.LESS_THAN;
|
op = OperatorEnum.LESS_OR_EQUAL;
|
||||||
|
} else {
|
||||||
|
op = OperatorEnum.LESS_THAN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return op != null && op.isValid(val, comp, null);
|
return op != null && op.isValid(val, comp, null);
|
||||||
case CONTAINS_TEXT:
|
case CONTAINS_TEXT:
|
||||||
|
@ -522,17 +567,23 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
*/
|
*/
|
||||||
private Set<ValueAndFormat> getMeaningfulValues(CellRangeAddress region, boolean withText, ValueFunction func) {
|
private Set<ValueAndFormat> getMeaningfulValues(CellRangeAddress region, boolean withText, ValueFunction func) {
|
||||||
Set<ValueAndFormat> values = meaningfulRegionValues.get(region);
|
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));
|
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++) {
|
for (int r=region.getFirstRow(); r <= region.getLastRow(); r++) {
|
||||||
final Row row = sheet.getRow(r);
|
final Row row = sheet.getRow(r);
|
||||||
if (row == null) continue;
|
if (row == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
|
for (int c = region.getFirstColumn(); c <= region.getLastColumn(); c++) {
|
||||||
Cell cell = row.getCell(c);
|
Cell cell = row.getCell(c);
|
||||||
final ValueAndFormat cv = getCellValue(cell);
|
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 {
|
public static enum OperatorEnum {
|
||||||
NO_COMPARISON {
|
NO_COMPARISON {
|
||||||
/** always false/invalid */
|
/** always false/invalid */
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
BETWEEN {
|
BETWEEN {
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||||
return cellValue.compareTo(v1) >= 0 && cellValue.compareTo(v2) <= 0;
|
return cellValue.compareTo(v1) >= 0 && cellValue.compareTo(v2) <= 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NOT_BETWEEN {
|
NOT_BETWEEN {
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||||
return cellValue.compareTo(v1) < 0 || cellValue.compareTo(v2) > 0;
|
return cellValue.compareTo(v1) < 0 || cellValue.compareTo(v2) > 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
EQUAL {
|
EQUAL {
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
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
|
// need to avoid instanceof, to work around a 1.6 compiler bug
|
||||||
if (cellValue.getClass() == String.class) {
|
if (cellValue.getClass() == String.class) {
|
||||||
|
@ -602,6 +657,7 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
NOT_EQUAL {
|
NOT_EQUAL {
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
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
|
// need to avoid instanceof, to work around a 1.6 compiler bug
|
||||||
if (cellValue.getClass() == String.class) {
|
if (cellValue.getClass() == String.class) {
|
||||||
|
@ -611,21 +667,25 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GREATER_THAN {
|
GREATER_THAN {
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||||
return cellValue.compareTo(v1) > 0;
|
return cellValue.compareTo(v1) > 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LESS_THAN {
|
LESS_THAN {
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||||
return cellValue.compareTo(v1) < 0;
|
return cellValue.compareTo(v1) < 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GREATER_OR_EQUAL {
|
GREATER_OR_EQUAL {
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||||
return cellValue.compareTo(v1) >= 0;
|
return cellValue.compareTo(v1) >= 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LESS_OR_EQUAL {
|
LESS_OR_EQUAL {
|
||||||
|
@Override
|
||||||
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
public <C extends Comparable<C>> boolean isValid(C cellValue, C v1, C v2) {
|
||||||
return cellValue.compareTo(v1) <= 0;
|
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.
|
* 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 Double value;
|
||||||
private final String string;
|
private final String string;
|
||||||
|
@ -671,7 +731,11 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof ValueAndFormat)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ValueAndFormat o = (ValueAndFormat) obj;
|
ValueAndFormat o = (ValueAndFormat) obj;
|
||||||
return ( value == o.value || value.equals(o.value))
|
return ( value == o.value || value.equals(o.value))
|
||||||
&& ( format == o.format || format.equals(o.format))
|
&& ( format == o.format || format.equals(o.format))
|
||||||
|
@ -683,18 +747,30 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
||||||
* @param o
|
* @param o
|
||||||
* @return value comparison
|
* @return value comparison
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int compareTo(ValueAndFormat o) {
|
public int compareTo(ValueAndFormat o) {
|
||||||
if (value == null && o.value != null) return 1;
|
if (value == null && o.value != null) {
|
||||||
if (o.value == null && value != null) return -1;
|
return 1;
|
||||||
|
}
|
||||||
|
if (o.value == null && value != null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
int cmp = value == null ? 0 : value.compareTo(o.value);
|
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 (string == null && o.string != null) {
|
||||||
if (o.string == null && string != null) return -1;
|
return 1;
|
||||||
|
}
|
||||||
|
if (o.string == null && string != null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return string == null ? 0 : string.compareTo(o.string);
|
return string == null ? 0 : string.compareTo(o.string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return (string == null ? 0 : string.hashCode()) * 37 * 37 + 37 * (value == null ? 0 : value.hashCode()) + (format == null ? 0 : format.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));
|
stack.push(attrPtg.toFormulaString(operands));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Unexpected tAttr: " + attrPtg.toString());
|
throw new RuntimeException("Unexpected tAttr: " + attrPtg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ptg instanceof WorkbookDependentFormula) {
|
if (ptg instanceof WorkbookDependentFormula) {
|
||||||
|
|
|
@ -336,7 +336,7 @@ public final class WorkbookEvaluator {
|
||||||
if (isDebugLogEnabled()) {
|
if (isDebugLogEnabled()) {
|
||||||
String sheetName = getSheetName(sheetIndex);
|
String sheetName = getSheetName(sheetIndex);
|
||||||
CellReference cr = new CellReference(rowIndex, columnIndex);
|
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())
|
// Usually (result === cce.getValue())
|
||||||
// But sometimes: (result==ErrorEval.CIRCULAR_REF_ERROR, cce.getValue()==null)
|
// 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 */
|
/** Pattern to find "AM/PM" marker */
|
||||||
private static final Pattern amPmPattern = Pattern.compile("((A|P)[M/P]*)", Pattern.CASE_INSENSITIVE);
|
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].
|
* A regex to find locale patterns like [$$-1009] and [$?-452].
|
||||||
|
@ -312,14 +315,16 @@ public class DataFormatter implements Observer {
|
||||||
|
|
||||||
String formatStr = formatStrIn;
|
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
|
// or (>1000),(>0),(0),(negative). As Java doesn't handle these kinds
|
||||||
// of different formats for different ranges, just +ve/-ve, we need to
|
// of different formats for different ranges, just +ve/-ve, we need to
|
||||||
// handle these ourselves in a special way.
|
// 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
|
// TODO Going forward, we should really merge the logic between the two classes
|
||||||
if (formatStr.contains(";") &&
|
if (formatStr.contains(";") &&
|
||||||
formatStr.indexOf(';') != formatStr.lastIndexOf(';')) {
|
(formatStr.indexOf(';') != formatStr.lastIndexOf(';')
|
||||||
|
|| rangeConditionalPattern.matcher(formatStr).matches()
|
||||||
|
) ) {
|
||||||
try {
|
try {
|
||||||
// Ask CellFormat to get a formatter for it
|
// Ask CellFormat to get a formatter for it
|
||||||
CellFormat cfmt = CellFormat.getInstance(formatStr);
|
CellFormat cfmt = CellFormat.getInstance(formatStr);
|
||||||
|
|
|
@ -42,5 +42,5 @@ public enum SheetVisibility {
|
||||||
* <code>ThisWorkbook.Sheets("MySheetName").Visible = xlSheetVeryHidden </code>
|
* <code>ThisWorkbook.Sheets("MySheetName").Visible = xlSheetVeryHidden </code>
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
VERY_HIDDEN;
|
VERY_HIDDEN
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,14 @@ package org.apache.poi.ss.usermodel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A common interface for simple shapes.
|
* A common interface for simple shapes.
|
||||||
* (Currently the HSSF and XSSF classes don't share common method signatures ...)
|
|
||||||
*
|
*
|
||||||
* @since POI 3.16-beta2
|
* @since POI 3.16-beta2
|
||||||
*/
|
*/
|
||||||
public interface SimpleShape extends Shape {
|
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]);
|
File f = new File(args[0]);
|
||||||
if(! f.exists()) {
|
if(! f.exists()) {
|
||||||
System.err.println("Error, file not found!");
|
System.err.println("Error, file not found!");
|
||||||
System.err.println("\t" + f.toString());
|
System.err.println("\t" + f);
|
||||||
System.exit(2);
|
System.exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public class OOXMLLister implements Closeable {
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
lister.disp.println(f.toString() + "\n");
|
lister.disp.println(f + "\n");
|
||||||
lister.displayParts();
|
lister.displayParts();
|
||||||
lister.disp.println();
|
lister.disp.println();
|
||||||
lister.displayRelations();
|
lister.displayRelations();
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class OOXMLPrettyPrint {
|
||||||
File f = new File(args[i]);
|
File f = new File(args[i]);
|
||||||
if(! f.exists()) {
|
if(! f.exists()) {
|
||||||
System.err.println("Error, file not found!");
|
System.err.println("Error, file not found!");
|
||||||
System.err.println("\t" + f.toString());
|
System.err.println("\t" + f);
|
||||||
System.exit(2);
|
System.exit(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ public final class PackageRelationship {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(id == null ? "id=null" : "id=" + id);
|
sb.append(id == null ? "id=null" : "id=" + id);
|
||||||
sb.append(container == null ? " - container=null" : " - container="
|
sb.append(container == null ? " - container=null" : " - container="
|
||||||
+ container.toString());
|
+ container);
|
||||||
sb.append(relationshipType == null ? " - relationshipType=null"
|
sb.append(relationshipType == null ? " - relationshipType=null"
|
||||||
: " - relationshipType=" + relationshipType);
|
: " - relationshipType=" + relationshipType);
|
||||||
sb.append(source == null ? " - source=null" : " - source="
|
sb.append(source == null ? " - source=null" : " - source="
|
||||||
|
@ -221,7 +221,7 @@ public final class PackageRelationship {
|
||||||
sb.append(targetUri == null ? " - target=null" : " - target="
|
sb.append(targetUri == null ? " - target=null" : " - target="
|
||||||
+ getTargetURI().toASCIIString());
|
+ getTargetURI().toASCIIString());
|
||||||
sb.append(targetMode == null ? ",targetMode=null" : ",targetMode="
|
sb.append(targetMode == null ? ",targetMode=null" : ",targetMode="
|
||||||
+ targetMode.toString());
|
+ targetMode);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,7 +617,7 @@ public final class PackagePropertiesPart extends PackagePart implements
|
||||||
sb.append(", ").append(fStr);
|
sb.append(", ").append(fStr);
|
||||||
}
|
}
|
||||||
throw new InvalidFormatException("Date " + dateStr + " not well formatted, "
|
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);
|
setChainingMode(ChainingMode.cfb);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new EncryptedDocumentException("Unsupported chaining mode - "+keyData.getCipherChaining().toString());
|
throw new EncryptedDocumentException("Unsupported chaining mode - "+ keyData.getCipherChaining());
|
||||||
}
|
}
|
||||||
|
|
||||||
int hashSize = keyData.getHashSize();
|
int hashSize = keyData.getHashSize();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
|
||||||
found |= (ks == keyBits);
|
found |= (ks == keyBits);
|
||||||
}
|
}
|
||||||
if (!found) {
|
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.setHeader(new AgileEncryptionHeader(cipherAlgorithm, hashAlgorithm, keyBits, blockSize, chainingMode));
|
||||||
info.setVerifier(new AgileEncryptionVerifier(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);
|
setChainingMode(ChainingMode.cfb);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new EncryptedDocumentException("Unsupported chaining mode - "+keyData.getCipherChaining().toString());
|
throw new EncryptedDocumentException("Unsupported chaining mode - "+ keyData.getCipherChaining());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!encList.hasNext()) {
|
if (!encList.hasNext()) {
|
||||||
|
|
|
@ -349,14 +349,14 @@ public class XAdESXLSignatureFacet extends SignatureFacet {
|
||||||
|
|
||||||
// create a XAdES time-stamp container
|
// create a XAdES time-stamp container
|
||||||
XAdESTimeStampType xadesTimeStamp = XAdESTimeStampType.Factory.newInstance();
|
XAdESTimeStampType xadesTimeStamp = XAdESTimeStampType.Factory.newInstance();
|
||||||
xadesTimeStamp.setId("time-stamp-" + UUID.randomUUID().toString());
|
xadesTimeStamp.setId("time-stamp-" + UUID.randomUUID());
|
||||||
CanonicalizationMethodType c14nMethod = xadesTimeStamp.addNewCanonicalizationMethod();
|
CanonicalizationMethodType c14nMethod = xadesTimeStamp.addNewCanonicalizationMethod();
|
||||||
c14nMethod.setAlgorithm(signatureConfig.getXadesCanonicalizationMethod());
|
c14nMethod.setAlgorithm(signatureConfig.getXadesCanonicalizationMethod());
|
||||||
|
|
||||||
// embed the time-stamp
|
// embed the time-stamp
|
||||||
EncapsulatedPKIDataType encapsulatedTimeStamp = xadesTimeStamp.addNewEncapsulatedTimeStamp();
|
EncapsulatedPKIDataType encapsulatedTimeStamp = xadesTimeStamp.addNewEncapsulatedTimeStamp();
|
||||||
encapsulatedTimeStamp.setByteArrayValue(timeStampToken);
|
encapsulatedTimeStamp.setByteArrayValue(timeStampToken);
|
||||||
encapsulatedTimeStamp.setId("time-stamp-token-" + UUID.randomUUID().toString());
|
encapsulatedTimeStamp.setId("time-stamp-token-" + UUID.randomUUID());
|
||||||
|
|
||||||
return xadesTimeStamp;
|
return xadesTimeStamp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class AesZipFileZipEntrySource implements ZipEntrySource {
|
||||||
zipFile.close();
|
zipFile.close();
|
||||||
if (!tmpFile.delete()) {
|
if (!tmpFile.delete()) {
|
||||||
LOG.log(POILogger.WARN, tmpFile.getAbsolutePath()+" can't be removed (or was already removed.");
|
LOG.log(POILogger.WARN, tmpFile.getAbsolutePath()+" can't be removed (or was already removed.");
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
closed = true;
|
closed = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -232,7 +232,7 @@ public class EmbeddedExtractor implements Iterable<EmbeddedExtractor> {
|
||||||
// check for emf+ embedded pdf (poor mans style :( )
|
// check for emf+ embedded pdf (poor mans style :( )
|
||||||
// Mac Excel 2011 embeds pdf files with this method.
|
// Mac Excel 2011 embeds pdf files with this method.
|
||||||
PictureData pd = source.getPictureData();
|
PictureData pd = source.getPictureData();
|
||||||
if (pd != null && pd.getPictureType() != Workbook.PICTURE_TYPE_EMF) {
|
if (pd == null || pd.getPictureType() != Workbook.PICTURE_TYPE_EMF) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,6 @@ public final class OOXMLLite {
|
||||||
if (!(destDirectory.exists() || destDirectory.mkdirs())) {
|
if (!(destDirectory.exists() || destDirectory.mkdirs())) {
|
||||||
throw new RuntimeException("Can't create destination directory: "+destDirectory);
|
throw new RuntimeException("Can't create destination directory: "+destDirectory);
|
||||||
}
|
}
|
||||||
;
|
|
||||||
OutputStream destStream = new FileOutputStream(destFile);
|
OutputStream destStream = new FileOutputStream(destFile);
|
||||||
try {
|
try {
|
||||||
IOUtils.copy(srcStream, destStream);
|
IOUtils.copy(srcStream, destStream);
|
||||||
|
|
|
@ -26,11 +26,11 @@ public class XDGFException {
|
||||||
* Creates an error message to be thrown
|
* Creates an error message to be thrown
|
||||||
*/
|
*/
|
||||||
public static POIXMLException error(String message, Object o) {
|
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) {
|
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,
|
public static POIXMLException wrap(POIXMLDocumentPart part,
|
||||||
POIXMLException e) {
|
POIXMLException e) {
|
||||||
return new POIXMLException(part.getPackagePart().getPartName()
|
return new POIXMLException(part.getPackagePart().getPartName()
|
||||||
.toString()
|
|
||||||
+ ": " + e.getMessage(), e.getCause() == null ? e
|
+ ": " + e.getMessage(), e.getCause() == null ? e
|
||||||
: e.getCause());
|
: e.getCause());
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,10 +84,10 @@ public class XDGFBaseContents extends XDGFXMLDocumentPart {
|
||||||
XDGFShape to = _shapes.get(connect.getToSheet());
|
XDGFShape to = _shapes.get(connect.getToSheet());
|
||||||
|
|
||||||
if (from == null)
|
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)
|
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));
|
_connections.add(new XDGFConnection(connect, from, to));
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ public class GeometryRowFactory {
|
||||||
_rowTypes.put("LineTo", LineTo.class, RowType.class);
|
_rowTypes.put("LineTo", LineTo.class, RowType.class);
|
||||||
_rowTypes.put("MoveTo", MoveTo.class, RowType.class);
|
_rowTypes.put("MoveTo", MoveTo.class, RowType.class);
|
||||||
_rowTypes.put("NURBSTo", NURBSTo.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("PolyLineTo", PolyLineTo.class, RowType.class);
|
||||||
_rowTypes.put("RelCubBezTo", RelCubBezTo.class, RowType.class);
|
_rowTypes.put("RelCubBezTo", RelCubBezTo.class, RowType.class);
|
||||||
_rowTypes.put("RelEllipticalArcTo", RelEllipticalArcTo.class,
|
_rowTypes.put("RelEllipticalArcTo", RelEllipticalArcTo.class,
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class HierarchyPrinter {
|
||||||
os.append(" ");
|
os.append(" ");
|
||||||
}
|
}
|
||||||
// TODO: write text?
|
// TODO: write text?
|
||||||
os.println(shape.toString() + " [" + shape.getShapeType()
|
os.println(shape + " [" + shape.getShapeType()
|
||||||
+ ", " + shape.getSymbolName() + "] "
|
+ ", " + shape.getSymbolName() + "] "
|
||||||
+ shape.getMasterShape() + " "
|
+ shape.getMasterShape() + " "
|
||||||
+ shape.getTextAsString().trim());
|
+ shape.getTextAsString().trim());
|
||||||
|
|
|
@ -1848,7 +1848,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperti
|
||||||
} else if (props instanceof CTTextCharacterProperties) {
|
} else if (props instanceof CTTextCharacterProperties) {
|
||||||
obj = new TextCharDelegate((CTTextCharacterProperties)props);
|
obj = new TextCharDelegate((CTTextCharacterProperties)props);
|
||||||
} else {
|
} 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1856,7 +1856,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTBackgroundProperti
|
||||||
return (T)obj;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ public abstract class XSLFSimpleShape extends XSLFShape
|
||||||
return ((CTShapeProperties)xo).addNewXfrm();
|
return ((CTShapeProperties)xo).addNewXfrm();
|
||||||
} else {
|
} else {
|
||||||
// ... group shapes have their own getXfrm()
|
// ... 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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1132,7 @@ public abstract class XSLFSimpleShape extends XSLFShape
|
||||||
private static CTLineProperties getLn(XSLFShape shape, boolean create) {
|
private static CTLineProperties getLn(XSLFShape shape, boolean create) {
|
||||||
XmlObject pr = shape.getShapeProperties();
|
XmlObject pr = shape.getShapeProperties();
|
||||||
if (!(pr instanceof CTShapeProperties)) {
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ implements Slide<XSLFShape,XSLFTextParagraph> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(_layout == null) {
|
if(_layout == null) {
|
||||||
throw new IllegalArgumentException("SlideLayout was not found for " + this.toString());
|
throw new IllegalArgumentException("SlideLayout was not found for " + this);
|
||||||
}
|
}
|
||||||
return _layout;
|
return _layout;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ implements MasterSheet<XSLFShape,XSLFTextParagraph> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_master == null) {
|
if (_master == null) {
|
||||||
throw new IllegalStateException("SlideMaster was not found for " + this.toString());
|
throw new IllegalStateException("SlideMaster was not found for " + this);
|
||||||
}
|
}
|
||||||
return _master;
|
return _master;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class XSLFTableStyle {
|
||||||
private CTTableStyle _tblStyle;
|
private CTTableStyle _tblStyle;
|
||||||
|
|
||||||
public enum TablePartStyle {
|
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){
|
/*package*/ XSLFTableStyle(CTTableStyle style){
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.poi.xssf.binary;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.Comparator;
|
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
|
@Override
|
||||||
public int compare(CellAddress o1, CellAddress o2) {
|
public int compare(CellAddress o1, CellAddress o2) {
|
||||||
if (o1.getRow() < o2.getRow()) {
|
if (o1.getRow() < o2.getRow()) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ public abstract class XSSFBParser {
|
||||||
* @param is inputStream
|
* @param is inputStream
|
||||||
* @param bitSet call {@link #handleRecord(int, byte[])} only on those records in this bitSet
|
* @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);
|
this.is = new LittleEndianInputStream(is);
|
||||||
records = bitSet;
|
records = bitSet;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,8 @@ public enum XSSFBRecordType {
|
||||||
|
|
||||||
BrtBundleSh(156), //defines worksheet in wb part
|
BrtBundleSh(156), //defines worksheet in wb part
|
||||||
|
|
||||||
|
BrtAbsPath15(2071), //Excel 2013 path where the file was stored in wbpart
|
||||||
|
|
||||||
//TODO -- implement these as needed
|
//TODO -- implement these as needed
|
||||||
//BrtFileVersion(128), //file version
|
//BrtFileVersion(128), //file version
|
||||||
//BrtWbProp(153), //Workbook prop contains 1904/1900-date based bit
|
//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.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.BitSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.PackageRelationship;
|
||||||
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
|
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
|
||||||
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
||||||
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
|
@ -62,6 +64,26 @@ public class XSSFBReader extends XSSFReader {
|
||||||
super(pkg);
|
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
|
* Returns an Iterator which will let you get at all the
|
||||||
* different Sheets in turn.
|
* 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 {
|
private static class SheetRefLoader extends XSSFBParser {
|
||||||
List<XSSFSheetRef> sheets = new LinkedList<XSSFSheetRef>();
|
List<XSSFSheetRef> sheets = new LinkedList<XSSFSheetRef>();
|
||||||
|
|
||||||
|
|
|
@ -316,7 +316,7 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ERROR:
|
case ERROR:
|
||||||
thisStr = "ERROR:" + value.toString();
|
thisStr = "ERROR:" + value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FORMULA:
|
case FORMULA:
|
||||||
|
|
|
@ -274,7 +274,7 @@ public class SheetDataWriter {
|
||||||
XSSFRichTextString rt = new XSSFRichTextString(cell.getStringCellValue());
|
XSSFRichTextString rt = new XSSFRichTextString(cell.getStringCellValue());
|
||||||
int sRef = _sharedStringSource.addEntry(rt.getCTRst());
|
int sRef = _sharedStringSource.addEntry(rt.getCTRst());
|
||||||
|
|
||||||
_out.write(" t=\"" + STCellType.S.toString() + "\">");
|
_out.write(" t=\"" + STCellType.S + "\">");
|
||||||
_out.write("<v>");
|
_out.write("<v>");
|
||||||
_out.write(String.valueOf(sRef));
|
_out.write(String.valueOf(sRef));
|
||||||
_out.write("</v>");
|
_out.write("</v>");
|
||||||
|
|
|
@ -184,7 +184,7 @@ public final class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
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) {
|
public XSSFObjectData createObjectData(ClientAnchor anchor, int storageId, int pictureIndex) {
|
||||||
XSSFSheet sh = getSheet();
|
XSSFSheet sh = getSheet();
|
||||||
PackagePart sheetPart = sh.getPackagePart();
|
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
|
// add reference to OLE part
|
||||||
PackagePartName olePN;
|
PackagePartName olePN;
|
||||||
|
@ -446,6 +463,7 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
|
||||||
|
|
||||||
CTNonVisualDrawingProps cNvPr = ctShape.getNvSpPr().getCNvPr();
|
CTNonVisualDrawingProps cNvPr = ctShape.getNvSpPr().getCNvPr();
|
||||||
cNvPr.setId(shapeId);
|
cNvPr.setId(shapeId);
|
||||||
|
cNvPr.setName("Object "+shapeId);
|
||||||
|
|
||||||
XmlCursor extCur = cNvPr.getExtLst().getExtArray(0).newCursor();
|
XmlCursor extCur = cNvPr.getExtLst().getExtArray(0).newCursor();
|
||||||
extCur.toFirstChild();
|
extCur.toFirstChild();
|
||||||
|
@ -520,7 +538,10 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSS
|
||||||
}
|
}
|
||||||
|
|
||||||
private long newShapeId(){
|
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 {
|
try {
|
||||||
if (cur.toChild(XSSFRelation.NS_SPREADSHEETML, "objectPr")) {
|
if (cur.toChild(XSSFRelation.NS_SPREADSHEETML, "objectPr")) {
|
||||||
String blipId = cur.getAttributeText(new QName(PackageRelationshipTypes.CORE_PROPERTIES_ECMA376_NS, "id"));
|
String blipId = cur.getAttributeText(new QName(PackageRelationshipTypes.CORE_PROPERTIES_ECMA376_NS, "id"));
|
||||||
return (XSSFPictureData)getDrawing().getRelationById(blipId);
|
return (XSSFPictureData)getSheet().getRelationById(blipId);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue