Change XSSFSheetXMLHandler.SheetContentsHandler to require fewer backwards incompatible changes for #56023

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1614576 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2014-07-30 07:41:01 +00:00
parent c9e6a7345c
commit f0dc1291ad
2 changed files with 8 additions and 8 deletions

View File

@ -466,7 +466,7 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
private void outputEmptyCellComment(CellReference cellRef) { private void outputEmptyCellComment(CellReference cellRef) {
String cellRefString = cellRef.formatAsString(); String cellRefString = cellRef.formatAsString();
XSSFComment comment = commentsTable.findCellComment(cellRefString); XSSFComment comment = commentsTable.findCellComment(cellRefString);
output.emptyCellComment(cellRefString, comment); output.cell(cellRefString, null, comment);
} }
private enum EmptyCellCommentsCheckType { private enum EmptyCellCommentsCheckType {
@ -497,10 +497,10 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
public void startRow(int rowNum); public void startRow(int rowNum);
/** A row with the (zero based) row number has ended */ /** A row with the (zero based) row number has ended */
public void endRow(int rowNum); public void endRow(int rowNum);
/** A cell, with the given formatted value, and possibly a comment, was encountered */ /**
* A cell, with the given formatted value (may be null),
* and possibly a comment (may be null), was encountered */
public void cell(String cellReference, String formattedValue, XSSFComment comment); public void cell(String cellReference, String formattedValue, XSSFComment comment);
/** A comment for an otherwise-empty cell was encountered */
public void emptyCellComment(String cellReference, XSSFComment comment);
/** A header or footer has been encountered */ /** A header or footer has been encountered */
public void headerFooter(String text, boolean isHeader, String tagName); public void headerFooter(String text, boolean isHeader, String tagName);
} }

View File

@ -268,14 +268,17 @@ public class XSSFEventBasedExcelExtractor extends POIXMLTextExtractor
this.headerFooterMap = includeHeadersFooters ? new HashMap<String, String>() : null; this.headerFooterMap = includeHeadersFooters ? new HashMap<String, String>() : null;
} }
@Override
public void startRow(int rowNum) { public void startRow(int rowNum) {
firstCellOfRow = true; firstCellOfRow = true;
} }
@Override
public void endRow(int rowNum) { public void endRow(int rowNum) {
output.append('\n'); output.append('\n');
} }
@Override
public void cell(String cellRef, String formattedValue, XSSFComment comment) { public void cell(String cellRef, String formattedValue, XSSFComment comment) {
if(firstCellOfRow) { if(firstCellOfRow) {
firstCellOfRow = false; firstCellOfRow = false;
@ -296,10 +299,7 @@ public class XSSFEventBasedExcelExtractor extends POIXMLTextExtractor
} }
} }
public void emptyCellComment(String cellRef, XSSFComment comment) { @Override
cell(cellRef, null, comment);
}
public void headerFooter(String text, boolean isHeader, String tagName) { public void headerFooter(String text, boolean isHeader, String tagName) {
if (headerFooterMap != null) { if (headerFooterMap != null) {
headerFooterMap.put(tagName, text); headerFooterMap.put(tagName, text);