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

Free Support Forum - aspose.com

Range.AutoFill Question

Hi,

I have a question about Range.AutoFill functionality.

Workbook workbook = new Workbook();
// Get the first Worksheet Cells.
Cells cells = workbook.Worksheets[0].Cells;

// AutoFill bottom -> up 
  cells["B10"].Formula = "=A10";
  Range source = cells.CreateRange("B10");
  Range target = cells.CreateRange("B1:B10");
  source.AutoFill(target);

// AutoFill top -> down
cells[“D1”].Formula = “=C1”;
Range source1 = cells.CreateRange(“D1”);
Range target1 = cells.CreateRange(“D1:D10”);
source1.AutoFill(target1);

//Save the Excel file
workbook.Save(“book1.xlsx”);

in the code above you can see two usage of autoFill usage, top-down bottom-up
Seems like there is a different behavior in these two scenarios, when the target range includes the source range (top-down fails, while bottom-up succeeded). please see attached result file.

book1.zip (6.9 KB)

Any ideas?
Thanks,
Ori

@orik
Please change codes as
cells[“D1”].Formula = “=C1”;
Range source1 = cells.CreateRange(“D1”);
Range target1 = cells.CreateRange(“D2:D10”);
source1.AutoFill(target1);

Thanks for your replay.
I know your example will work, the question is why isn’t working the way when doing top-down vs. bottom-up)

@orik
There is an issue to auto fill data if the range area intersected.
I have logged a ticket with an id “CELLSNET-50821” for your issue. We will look into it soon.

@orik,

This is to inform you that the issue (logged earlier as “CELLSNET-50821”) has been resolved now. The fix will be included in the next release (Aspose.Cells for .NET v22.4) which is scheduled to be published before the end of this week. You will also be notified when the next version is released.

The issues you have found earlier (filed as CELLSNET-50821) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi