diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 40fe9bb2e..6f49c59b9 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 52369 - XSSFExcelExtractor should format numeric cells based on the format strings applied to them 52369 - Event based XSSF parsing should handle formatting of formula values in XSSFSheetXMLHandler 52348 - Avoid exception when creating cell style in a workbook that has an empty xf table 52219 - fixed XSSFSimpleShape to set rich text attributes from XSSFRichtextString diff --git a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java index 5d7e2dcaa..0c470f8e6 100644 --- a/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java +++ b/src/ooxml/java/org/apache/poi/xssf/eventusermodel/XSSFSheetXMLHandler.java @@ -254,7 +254,7 @@ public class XSSFSheetXMLHandler extends DefaultHandler { thisStr = fv; } } else { - // No formatter supplied, just do raw value in all cases + // No formating applied, just do raw value in all cases thisStr = fv; } } diff --git a/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java b/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java index c606471f8..5e687b5d7 100644 --- a/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java +++ b/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFExcelExtractor.java @@ -18,13 +18,16 @@ package org.apache.poi.xssf.extractor; import java.io.IOException; import java.util.Iterator; +import java.util.Locale; import org.apache.poi.POIXMLTextExtractor; import org.apache.poi.hssf.extractor.ExcelExtractor; import org.apache.poi.openxml4j.exceptions.OpenXML4JException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Comment; +import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.HeaderFooter; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFCell; @@ -43,6 +46,7 @@ public class XSSFExcelExtractor extends POIXMLTextExtractor implements org.apach XSSFRelation.MACROS_WORKBOOK }; + private Locale locale; private XSSFWorkbook workbook; private boolean includeSheetNames = true; private boolean formulasNotResults = false; @@ -96,14 +100,28 @@ public class XSSFExcelExtractor extends POIXMLTextExtractor implements org.apach public void setIncludeHeadersFooters(boolean includeHeadersFooters) { this.includeHeadersFooters = includeHeadersFooters; } + /** + * What Locale should be used for formatting numbers (based + * on the styles applied to the cells) + */ + public void setLocale(Locale locale) { + this.locale = locale; + } + - /** - * Retreives the text contents of the file - */ - public String getText() { - StringBuffer text = new StringBuffer(); - - for(int i=0; i