pjfanning commented on code in PR #10058:
URL: https://github.com/apache/nifi/pull/10058#discussion_r2180641109


##########
nifi-extension-bundles/nifi-poi-bundle/nifi-poi-services/src/main/java/org/apache/nifi/excel/ExcelRowCopier.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.excel;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellCopyContext;
+import org.apache.poi.ss.usermodel.CellCopyPolicy;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.ss.util.CellUtil;
+
+public class ExcelRowCopier {
+
+    private static final CellCopyPolicy CELL_COPY_POLICY = new 
CellCopyPolicy.Builder()
+        .cellFormula(false)
+        .cellStyle(CellCopyPolicy.DEFAULT_COPY_CELL_STYLE_POLICY)
+        .cellValue(CellCopyPolicy.DEFAULT_COPY_CELL_VALUE_POLICY)
+        .condenseRows(CellCopyPolicy.DEFAULT_CONDENSE_ROWS_POLICY)
+        .copyHyperlink(CellCopyPolicy.DEFAULT_COPY_HYPERLINK_POLICY)
+        .mergeHyperlink(CellCopyPolicy.DEFAULT_MERGE_HYPERLINK_POLICY)
+        .mergedRegions(false)
+        .rowHeight(CellCopyPolicy.DEFAULT_COPY_ROW_HEIGHT_POLICY)
+        .build();
+    private static final CellCopyContext CELL_COPY_CONTEXT = new 
CellCopyContext();

Review Comment:
   * you can't share the context as a static
   * it is meant to be one context instance per copy job (eg if you are copying 
one sheet to another sheet, share the context across all the related copy cell 
calls) - you can't reuse that context if you are start on a new workbook



-- 
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]

Reply via email to