We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

CopyCellRange Problem

Hi there,

I have following problem on Cells.CopyCellRange method. Does this method actually copying the data validation as well for that cell?

I have 2 simple cell which being configure as:
Allow: Whole Number
Data: greater than or equal to
Minimum: 0

And then I open Workbook using Aspose 2.5.4.12 (Aspose.Cells Java version) and then Copy the these two cell using API Cells.CopyCellRange. The result is All the cells has been copied (including the color and background) however, the data validation is not being copy at all.

please help me.

Cheers,


Hi,


Could you give us your sample template file and paste your code here. We will soon check your issue.

thank you.

here are the sample of copy cell:

worbook = new Workbook();
workbook.open(“TestExcel.xls”);
sheet1 = workbok.getWorksheets().sheet(0);

sheet1.getCells().copyCellRange(sheet1.getCells(), 0, 0, 0, 1, 2, 1);
sheet1.getCells().copyCellRange(sheet1.getCells(), 0, 0, 0, 2, 2, 1);

workbook.save(“saveTest.xls”);

if you open ‘saveTest.xls’ using excel, those validation only apply for 1st column but not the other 2 columns.

Cheers,

Hi,


Thanks for providing us the template file.

I have tested your issue and found it. The data validation is not copied with the cells/formatting. I have logged your issue with an id: CELLSJAVA-29247. We will look into your issue soon.

thank you.

Hi Sahi,

Just wondering how is the fix going? In mean time, how do I copy the validation from one cell to another cell while waiting for the fixes?

Cheers,


Hi,


Well, I am afraid we cannot support it soon. To be honest we might not support it in the next two months as we are scheduled to work on some other important tasks (on hand) to finish them soon. Actually it is a limitation with copyCellRange() method at the moment. As a workaround, I think at the moment, you can create new Validation for the new cell ranges and then set all the properties of the source Validation to the new Validation.

Thank you.

Hi,

Currently we do not support to copy other objects such as Shape,
Validation, ConditionalFormattings and so on when copying cell range.


However, in next fix we will provide a method for your related requirement at https://forum.aspose.com/t/125063 soon:


Validation com.aspose.cells.Validations.getValidationInCell(int row, short column)

Gets the Validation for given cell.

Parameters:
row cell's row index
column cell's column index
Returns:
Validation for given cell. If no validation defined for given cell, null will be returned.

The issues you have found earlier (filed as 29247; 29247) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.