reformat file

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913066 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2023-10-17 15:09:26 +00:00
parent 5035a531c5
commit 0dd2b18b56

View File

@ -40,10 +40,10 @@ import org.xml.sax.helpers.DefaultHandler;
* This class handles the streaming processing of a sheet#.xml
* sheet part of a XSSF .xlsx file, and generates
* row and cell events for it.
*
* <p>
* This allows to build functionality which reads huge files
* without needing large amounts of main memory.
*
* <p>
* See {@link SheetContentsHandler} for the interface that
* you need to implement for reading information from a file.
*/
@ -242,15 +242,13 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
} else {
fIsOpen = true;
}
}
else if("oddHeader".equals(localName) || "evenHeader".equals(localName) ||
} else if ("oddHeader".equals(localName) || "evenHeader".equals(localName) ||
"firstHeader".equals(localName) || "firstFooter".equals(localName) ||
"oddFooter".equals(localName) || "evenFooter".equals(localName)) {
hfIsOpen = true;
// Clear contents cache
headerFooter.setLength(0);
}
else if("row".equals(localName)) {
} else if ("row".equals(localName)) {
String rowNumStr = attributes.getValue("r");
if (rowNumStr != null) {
rowNum = Integer.parseInt(rowNumStr) - 1;
@ -336,13 +334,11 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
// indicate that this sheet is now done
output.endSheet();
}
else if("oddHeader".equals(localName) || "evenHeader".equals(localName) ||
} else if ("oddHeader".equals(localName) || "evenHeader".equals(localName) ||
"firstHeader".equals(localName)) {
hfIsOpen = false;
output.headerFooter(headerFooter.toString(), true, localName);
}
else if("oddFooter".equals(localName) || "evenFooter".equals(localName) ||
} else if ("oddFooter".equals(localName) || "evenFooter".equals(localName) ||
"firstFooter".equals(localName)) {
hfIsOpen = false;
output.headerFooter(headerFooter.toString(), false, localName);
@ -516,23 +512,27 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
/**
* This interface allows to provide callbacks when reading
* a sheet in streaming mode.
*
* <p>
* The XSLX file is usually read via {@link XSSFReader}.
*
* <p>
* By implementing the methods, you can process arbitrarily
* large files without exhausting main memory.
*/
public interface SheetContentsHandler {
/** A row with the (zero based) row number has started */
/**
* A row with the (zero based) row number has started
*/
void startRow(int rowNum);
/** A row with the (zero based) row number has ended */
/**
* A row with the (zero based) row number has ended
*/
void endRow(int rowNum);
/**
* A cell, with the given formatted value (may be null),
* and possibly a comment (may be null), was encountered.
*
* <p>
* Sheets that have missing or empty cells may result in
* sparse calls to <code>cell</code>. See the code in
* <code>poi-examples/src/main/java/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java</code>
@ -540,10 +540,16 @@ public class XSSFSheetXMLHandler extends DefaultHandler {
*/
void cell(String cellReference, String formattedValue, XSSFComment comment);
/** A header or footer has been encountered */
default void headerFooter(String text, boolean isHeader, String tagName) {}
/**
* A header or footer has been encountered
*/
default void headerFooter(String text, boolean isHeader, String tagName) {
}
/** Signal that the end of a sheet was been reached */
default void endSheet() {}
/**
* Signal that the end of a sheet was been reached
*/
default void endSheet() {
}
}
}