How to create a non contiguous range

Hi,

I am using aspose-cells-7.7.1.5.jar
Can you please help me with how to create a non contiguous range like :
R1C1refersto : =Sheet3!R4C8:R5C8,Sheet3!R9C11

Thanks,
Jaspreet

Hi Jaspreet,

Thanks for your posting and using Aspose.Cells.

You can create a non-contiguous range with the following code. However, you will have to convert your R1C1 cell references into A1 cell references. You can use CellsHelper.celllIndexToName() method for this purpose.

Java


Workbook workbook = new Workbook();


int nameIdx = workbook.getWorksheets().getNames().add(“TestRange”);

Name name = workbook.getWorksheets().getNames().get(nameIdx);


//Create non-contigous range

name.setRefersTo("=Sheet1!H4:H10,Sheet1!K9");


workbook.save(“output.xlsx”);

Hi,


Please see the document on how to create non sequenced ranges:
http://www.aspose.com/docs/display/cellsnet/Implementing+Non+Sequenced+Ranges

The article is in .NET but you may easily convert it to JAVA using the relevant APIs.

Thank you.