bengbengbalabalabeng commented on code in PR #982:
URL: https://github.com/apache/fesod/pull/982#discussion_r3710503260
##########
fesod-sheet/src/main/java/org/apache/fesod/sheet/analysis/csv/CsvExcelReadExecutor.java:
##########
@@ -223,13 +223,27 @@ private void dealRecord(CSVRecord record, int rowIndex) {
csvReadContext.csvReadWorkbookHolder().globalConfiguration().getAutoTrim();
Boolean autoStrip =
csvReadContext.csvReadWorkbookHolder().globalConfiguration().getAutoStrip();
+ List<Integer> includeColumnIndexes =
csvReadContext.readSheetHolder().getReadSheet().getColumnIndexes();
+
while (cellIterator.hasNext()) {
String cellString = cellIterator.next();
+ int currentColumnIndex = columnIndex++;
+ int targetColumnIndex;
+
+ if (includeColumnIndexes == null) {
+ targetColumnIndex = currentColumnIndex;
+ } else {
+ targetColumnIndex =
includeColumnIndexes.indexOf(currentColumnIndex);
+ if (targetColumnIndex < 0) {
+ continue;
+ }
+ }
+
ReadCellData<String> readCellData = new ReadCellData<>();
readCellData.setRowIndex(rowIndex);
- readCellData.setColumnIndex(columnIndex);
- // csv is an empty string of whether <code>,,</code> is read or
<code>,"",</code>
+ readCellData.setColumnIndex(targetColumnIndex);
+
Review Comment:
It is recommended to remove any unnecessary blank lines between
`setRowIndex()` and `setColumnIndex()` and restore the original comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]