Kamilkime commented on code in PR #10058:
URL: https://github.com/apache/nifi/pull/10058#discussion_r2205263879
##########
nifi-extension-bundles/nifi-poi-bundle/nifi-poi-services/src/main/java/org/apache/nifi/processors/excel/SplitExcel.java:
##########
@@ -230,6 +226,29 @@ public void onTrigger(ProcessContext context,
ProcessSession session) throws Pro
session.transfer(flowFileSplits, REL_SPLIT);
}
+ private int copyRows(final Sheet originalSheet, final Sheet
destinationSheet) {
+ final CellCopyContext cellCopyContext = new CellCopyContext();
+ int rowCount = 0;
+
+ for (final Row sourceRow : originalSheet) {
+ final Row destinationRow =
destinationSheet.createRow(sourceRow.getRowNum());
+ destinationRow.setHeight(sourceRow.getHeight());
+
+ for (final Cell sourceCell : sourceRow) {
+ final Cell destCell =
destinationRow.createCell(sourceCell.getColumnIndex());
+ CellUtil.copyCell(sourceCell, destCell, CELL_COPY_POLICY,
cellCopyContext);
+ }
+
+ ++rowCount;
+ }
+
+ for (final CellRangeAddress sourceRegion :
originalSheet.getMergedRegions()) {
+ destinationSheet.addMergedRegion(sourceRegion.copy());
+ }
+
+ return rowCount;
+ }
Review Comment:
Hi @dan-s1, sorry for the delay - I had to take over this PR from @zhtk and
only today I finally found some time.
I've tested the processor and yes - the code without explicit hyperlink copy
did not work properly. I've changed it so now it works like in
[CopyToSXSSFUtil](https://github.com/pjfanning/excel-streaming-reader/blob/main/src/test/java/com/github/pjfanning/xlsx/CopyToSXSSFUtil.java),
and I've also added a unit test to make sure hyperlinks are copied correctly.
--
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]