Fix whitespace
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1563653 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
720b4a3aad
commit
85bee89fe3
@ -60,99 +60,99 @@ public class XSSFEventBasedExcelExtractor extends POIXMLTextExtractor
|
|||||||
private boolean formulasNotResults = false;
|
private boolean formulasNotResults = false;
|
||||||
private boolean includeTextBoxes = true;
|
private boolean includeTextBoxes = true;
|
||||||
|
|
||||||
public XSSFEventBasedExcelExtractor(String path) throws XmlException, OpenXML4JException, IOException {
|
public XSSFEventBasedExcelExtractor(String path) throws XmlException, OpenXML4JException, IOException {
|
||||||
this(OPCPackage.open(path));
|
this(OPCPackage.open(path));
|
||||||
}
|
}
|
||||||
public XSSFEventBasedExcelExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
|
public XSSFEventBasedExcelExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
|
||||||
super(null);
|
super(null);
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
|
||||||
properties = new POIXMLProperties(container);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
properties = new POIXMLProperties(container);
|
||||||
if(args.length < 1) {
|
}
|
||||||
System.err.println("Use:");
|
|
||||||
System.err.println(" XSSFEventBasedExcelExtractor <filename.xlsx>");
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
POIXMLTextExtractor extractor =
|
|
||||||
new XSSFEventBasedExcelExtractor(args[0]);
|
|
||||||
System.out.println(extractor.getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public static void main(String[] args) throws Exception {
|
||||||
* Should sheet names be included? Default is true
|
if(args.length < 1) {
|
||||||
*/
|
System.err.println("Use:");
|
||||||
public void setIncludeSheetNames(boolean includeSheetNames) {
|
System.err.println(" XSSFEventBasedExcelExtractor <filename.xlsx>");
|
||||||
this.includeSheetNames = includeSheetNames;
|
System.exit(1);
|
||||||
}
|
}
|
||||||
/**
|
POIXMLTextExtractor extractor =
|
||||||
* Should we return the formula itself, and not
|
new XSSFEventBasedExcelExtractor(args[0]);
|
||||||
* the result it produces? Default is false
|
System.out.println(extractor.getText());
|
||||||
*/
|
}
|
||||||
public void setFormulasNotResults(boolean formulasNotResults) {
|
|
||||||
this.formulasNotResults = formulasNotResults;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Should sheet names be included? Default is true
|
||||||
|
*/
|
||||||
|
public void setIncludeSheetNames(boolean includeSheetNames) {
|
||||||
|
this.includeSheetNames = includeSheetNames;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Should we return the formula itself, and not
|
||||||
|
* the result it produces? Default is false
|
||||||
|
*/
|
||||||
|
public void setFormulasNotResults(boolean formulasNotResults) {
|
||||||
|
this.formulasNotResults = formulasNotResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Should text from textboxes be included? Default is true
|
* Should text from textboxes be included? Default is true
|
||||||
*/
|
*/
|
||||||
public void setIncludeTextBoxes(boolean includeTextBoxes) {
|
public void setIncludeTextBoxes(boolean includeTextBoxes) {
|
||||||
this.includeTextBoxes = includeTextBoxes;
|
this.includeTextBoxes = includeTextBoxes;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Would control the inclusion of cell comments from the document,
|
|
||||||
* if we supported it
|
|
||||||
*/
|
|
||||||
public void setIncludeCellComments(boolean includeCellComments) {
|
|
||||||
throw new IllegalStateException("Comment extraction not supported in streaming mode, please use XSSFExcelExtractor");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Would control the inclusion of cell comments from the document,
|
||||||
|
* if we supported it
|
||||||
|
*/
|
||||||
|
public void setIncludeCellComments(boolean includeCellComments) {
|
||||||
|
throw new IllegalStateException("Comment extraction not supported in streaming mode, please use XSSFExcelExtractor");
|
||||||
|
}
|
||||||
|
|
||||||
public void setLocale(Locale locale) {
|
public void setLocale(Locale locale) {
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the opened OPCPackage container.
|
* Returns the opened OPCPackage container.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public OPCPackage getPackage() {
|
public OPCPackage getPackage() {
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the core document properties
|
* Returns the core document properties
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CoreProperties getCoreProperties() {
|
public CoreProperties getCoreProperties() {
|
||||||
return properties.getCoreProperties();
|
return properties.getCoreProperties();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the extended document properties
|
* Returns the extended document properties
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ExtendedProperties getExtendedProperties() {
|
public ExtendedProperties getExtendedProperties() {
|
||||||
return properties.getExtendedProperties();
|
return properties.getExtendedProperties();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the custom document properties
|
* Returns the custom document properties
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public CustomProperties getCustomProperties() {
|
public CustomProperties getCustomProperties() {
|
||||||
return properties.getCustomProperties();
|
return properties.getCustomProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes the given sheet
|
* Processes the given sheet
|
||||||
*/
|
*/
|
||||||
public void processSheet(
|
public void processSheet(
|
||||||
SheetContentsHandler sheetContentsExtractor,
|
SheetContentsHandler sheetContentsExtractor,
|
||||||
StylesTable styles,
|
StylesTable styles,
|
||||||
ReadOnlySharedStringsTable strings,
|
ReadOnlySharedStringsTable strings,
|
||||||
InputStream sheetInputStream)
|
InputStream sheetInputStream)
|
||||||
throws IOException, SAXException {
|
throws IOException, SAXException {
|
||||||
|
|
||||||
DataFormatter formatter;
|
DataFormatter formatter;
|
||||||
if(locale == null) {
|
if(locale == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user