From b065bd4b67d210f183da58aa51cb3b64cd42c0b6 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 7 Oct 2021 10:16:23 +0000 Subject: [PATCH] update javadoc for cell/row copy git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893963 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xssf/usermodel/XSSFRow.java | 15 +++++++++++---- .../org/apache/poi/hssf/usermodel/HSSFRow.java | 11 +++++++---- .../java/org/apache/poi/ss/util/CellUtil.java | 5 ++++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java index b0f02eaa54..b35c71e858 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java @@ -638,11 +638,14 @@ public class XSSFRow implements Row, Comparable { } /** - * Copy the cells from srcRow to this row + * Copy the cells from srcRow to this row. * If this row is not a blank row, this will merge the two rows, overwriting - * the cells in this row with the cells in srcRow - * If srcRow is null, overwrite cells in destination row with blank values, styles, etc per cell copy policy - * srcRow may be from a different sheet in the same workbook + * the cells in this row with the cells in srcRow. + * If srcRow is null, overwrite cells in destination row with blank values, styles, etc per cell copy policy. + * + * Note that if you are copying from a non-XSSF row then you will need to disable style copying + * in the {@link CellCopyPolicy} (XSSF styles are not compatible with HSSF styles, for instance). + * * @param srcRow the rows to copy from * @param policy the policy to determine what gets copied */ @@ -657,6 +660,10 @@ public class XSSFRow implements Row, Comparable { * the cells in this row with the cells in srcRow * If srcRow is null, overwrite cells in destination row with blank values, styles, etc per cell copy policy * srcRow may be from a different sheet in the same workbook + * + * Note that if you are copying from a non-XSSF row then you will need to disable style copying + * in the {@link CellCopyPolicy} (XSSF styles are not compatible with HSSF styles, for instance). + * * @param srcRow the rows to copy from * @param policy the policy to determine what gets copied * @param context the context - see {@link CellCopyContext} diff --git a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java index e73e0a5365..3487e31595 100644 --- a/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java +++ b/poi/src/main/java/org/apache/poi/hssf/usermodel/HSSFRow.java @@ -801,11 +801,14 @@ public final class HSSFRow implements Row, Comparable { } /** - * Copy the cells from srcRow to this row + * Copy the cells from srcRow to this row. * If this row is not a blank row, this will merge the two rows, overwriting - * the cells in this row with the cells in srcRow - * If srcRow is null, overwrite cells in destination row with blank values, styles, etc per cell copy policy - * srcRow may be from a different sheet in the same workbook + * the cells in this row with the cells in srcRow. + * If srcRow is null, overwrite cells in destination row with blank values, styles, etc per cell copy policy. + * + * Note that if you are copying from a non-HSSF row then you will need to disable style copying + * in the {@link CellCopyPolicy} (HSSF styles are not compatible with XSSF styles, for instance). + * * @param srcRow the rows to copy from * @param policy the policy to determine what gets copied * @param context the context - see {@link CellCopyContext} diff --git a/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java b/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java index 0407550b19..ea54ee8ff2 100644 --- a/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java +++ b/poi/src/main/java/org/apache/poi/ss/util/CellUtil.java @@ -181,7 +181,10 @@ public final class CellUtil { /** * Copy cell value, formula and style, from srcCell per cell copy policy - * If srcCell is null, clears the cell value and cell style per cell copy policy + * If srcCell is null, clears the cell value and cell style per cell copy policy. + * + * Note that if you are copying from a source cell from a different type of then you may need to disable style copying + * in the {@link CellCopyPolicy} (HSSF styles are not compatible with XSSF styles, for instance). * * This does not shift references in formulas. * -- 2.39.5