Free Support Forum -

Aspose Cells is not copying rows as expected

Hi, I’m using Aspose Cells Java v18.7 and when I copy some rows to some newly added rows, the copied rows don’t have the row height expected.

final Workbook wb = new Workbook();
final Worksheet sheet = wb.getWorksheets().get(0);
sheet.getCells().get(0, 0).setValue("&open");
sheet.getCells().get(1, 0).setValue("#open");
sheet.getCells().get(2, 0).setValue(“Content”);
sheet.getCells().get(3, 0).setValue("#close");
sheet.getCells().get(4, 0).setValue("&close");
sheet.getCells().setRowHeightPixel(2, 120);
sheet.getCells().insertRows(4, 3);
final Range rangeFrom = sheet.getCells().createRange(1, 0, 3, 1);
final Range rangeToInsert = sheet.getCells().createRange(4, 0, 3, 1);
final PasteOptions opts = new PasteOptions();
rangeToInsert.copy(rangeFrom, opts);“C:\Users\Hugo Freixo\Desktop\tests\test.xlsx”);

When I set the options PasteType to ALL, shouldn’t the rows format keep the height? (Copied Row “Content” should have 120px height)
How can I copy several rows to a newly added zone keeping the height property?

Hugo Freixo

Thanks for your query.

I have tried this scenario using Aspose.Cells for Java 18.10 but could not re-produce it as copied content column contains same height i.e. 120px. You may please try this scenario with the latest version and share the feedback. If some issue is there, please send us the program output file, an expected output file created by Excel and a console application (runnable) which can be used to observe the issue here. It will be helpful for us to observe the problem and provide our feedback.

Output file created by the latest version is attached here for your reference. (5.6 KB)

Hi, thanks for your answer.

I tested the same scenario with Aspose Cells 18.10 and it seems the behaviour is fixed.
Thanks for your help.

Kind regards,
Hugo Freixo


Good to know that your issue is sorted out by the new/fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.