Package io.github.dornol.excelkit.core
Class Cursor
java.lang.Object
io.github.dornol.excelkit.core.Cursor
Tracks the current writing position during an export operation.
Used internally during streaming writing to track row position within the current sheet (or file) and the total number of rows processed globally (across multiple sheets). This allows support for sheet rollover, row-based formatting, and row-level indexing.
- Since:
- 2025-07-19
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the total number of processed rows, across all sheets.intReturns the current row index within the sheet.voidinitRow()Resets the current sheet's row index to the base row.voidplusRow()Increments the current row index in the current sheet by 1.voidIncrements the total number of processed rows (across all sheets) by 1.voidsetRowOfSheet(int row) Sets the current sheet's row index to the given value.
-
Constructor Details
-
Cursor
public Cursor()Creates a new Cursor with row index and total count initialized to 0. -
Cursor
public Cursor(int baseRow) Creates a new Cursor starting from a specific row index.- Parameters:
baseRow- The starting row index for each sheet (e.g., if there's a title)
-
-
Method Details
-
plusRow
public void plusRow()Increments the current row index in the current sheet by 1. -
initRow
public void initRow()Resets the current sheet's row index to the base row. Typically called when a new sheet or file section is created. -
setRowOfSheet
public void setRowOfSheet(int row) Sets the current sheet's row index to the given value. Used when sheet preamble (beforeHeader) writes rows that shift the starting position.- Parameters:
row- the new row index
-
plusTotal
public void plusTotal()Increments the total number of processed rows (across all sheets) by 1. -
getRowOfSheet
public int getRowOfSheet()Returns the current row index within the sheet.- Returns:
- Row index in the current sheet (0-based)
-
getCurrentTotal
public long getCurrentTotal()Returns the total number of processed rows, across all sheets.- Returns:
- Total number of rows written
-