Copy a Range with Paste Options PasteType.ALL not copying row heights properly

Hi,

While copying a Range from one sheet to other, I am facing problems with Row heights. Also, any images/icons with in the copied range are also loosing their size properties.

I am using Aspose.cells for java “aspose-cells-18.4” and trying to copy a range from one sheet to another with PasteOptions All.

The results is some what inconsistent especially with row heights. However, column widths, values formatting all looks fine.

Hidden rows are being set with proper height ‘0’, where in non hidden rows seem to have some issue copying row heights.

Below is the sample code that I used. Also, I am attaching the sample file I have used for further analysis. Kindly validate Image properties after copying the Range.

/** Code piece **/
private static final int START_COL = 0;
private static final int END_COL = 500;
private static final int START_ROW = 0;
private static final int END_ROW = 15;

Workbook wb = new Workbook(new FileInputStream(new File(path + fileName + extension)));
Worksheet workSheet = wb.getWorksheets().get(0);

PasteOptions pasteOptions = new PasteOptions();
pasteOptions.setPasteType(PasteType.ALL);

/pasteOptions.setPasteType(PasteType.COLUMN_WIDTHS);
pasteOptions.setPasteType(PasteType.ROW_HEIGHTS);
pasteOptions.setPasteType(PasteType.COMMENTS);
pasteOptions.setPasteType(PasteType.FORMULAS_AND_NUMBER_FORMATS);
pasteOptions.setPasteType(PasteType.VALIDATION);
/

Workbook tempWorkBookForReference = new Workbook();
Worksheet tempWorkSheetForRerence = tempWorkBookForReference.getWorksheets().get(0);
tempWorkSheetForRerence.setName(wb.getWorksheets().get(0).getName());

Range target = tempWorkSheetForRerence.getCells().createRange(START_ROW, START_COL,
END_ROW - START_ROW, END_COL);
Range src = workSheet.getCells().createRange(START_ROW, START_COL,
END_ROW - START_ROW, END_COL);

target.copy(src, pasteOptions);

tempWorkBookForReference.save(path + fileName + “_CopyWithPasteOptions” + extension);

/** Code piece **/

Kindly validate and advice me of what can be done to achieve copying a Range from one sheet to another with Column_Widths, Row_Heights, Values, Formatting, Formula, Validations etc…

Sample.zip (18.4 KB)

Regards,
Kalyan

@fintellix,

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-42724 - Copy a Range with Paste Options PasteType.ALL not copying row heights properly

@fintellix,

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Much appreciated,

Looking forward to validate it.

Regards,
Kalyan

@fintellix,

You are welcome.

@fintellix,

Please find attached our latest version/fix: Aspose.Cells for Java v18.9.3

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells for Java_v18.9.3.zip (6.3 MB)

The issues you have found earlier (filed as CELLSJAVA-42724) have been fixed in Aspose.Cells for Java 18.10. You can also get the latest Aspose.Cells for Java version from Maven repos. with simple configurations. Please see the document for your reference: Installation|Documentation

This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi