CellArea() and Coldfusion

Hi,

Coldfusion + Aspose.Cells

I’m trying to use CellArea() method to sort columns in excel.
i’m getting method not found or improper parameters passed error.

can anyone explain me how to do this

Thanx
Sanjay

Hi Sanjay,

Thanks for your inquiry, we will get back to you soon.

Thank you.

Hi Sanjay,

I am not very sure about your requirement, do you need to sort data in excel? I think you can try DataSorter.sort(Cells cells, CellArea area). If it is not what you need, please give us more details, such as the version of Aspose.Cells for Java you used, your sample code, and your template files before and after your operation, thank you.

Hi Join,

Thank you for getting back.

yes i’m trying to sort excel sheet generated by Aspose.
When i use DataSorter.sort(Cells cells, CellArea area)
i get cannot find CellArea method or wrong parameters passed.

Thank you
Sanjay

Hi,

Thanks for providing us further details.

We will check it soon.

By the way, which version of Aspose.Cells for Java you are using, did you try our latest version 1.9.5: http://www.aspose.com/community/files/51/file-format-components/aspose.cells/entry132221.aspx if it works fine.

Thank you.

Hi,

For DataSorter.sort() method issue, could you post us your code snippet so we can check what parameters you are passing into the method.

Thank you.

Hi,

sorry for the delay,
here is my code snippet.
it fails in the last line of snippet or may be i’m not passing parameters properly.
how to define cellarea().
i’m doing it this way which is not going thru.
CellArea = _sheet.getCellArea(“A1”);

wb.open(strFilePath);

_sheets = wb.getWorksheets();

// get the first sheet
_sheet = _sheets.getSheet(‘sheet1’);

// get the cells
_cells = _sheet.getCells();

// define cell area
CellArea = _sheet.getCellArea(“A1”);

// define sorter
sorter = wb.getDataSorter();
SortOrderType = “ASCENDING”;
sorter.setOrder1(1);
sorter.setKey1(0);
sorter.sort(_cells, CellArea(“A1”));

Hi,

How do you define the "wb" as a Workbook object in Coldfusion? CellArea is a common java Object, I think you can construct a new CellArea object in the same way of constructing a new Workbook object, assume it as "ca", then set the range for this CellArea object with the apis: setStartRow(), setStartColumn(), setEndRow(), setEndColumn(); For a range "A1", the code should be:

ca.setStartRow(0);ca.setStartColumn(0);ca.setEndRow(0);ca.setEndColumn(0)

then call sorter.sort(_cells, ca);

Hi,
Thank you for guiding me.

This is how i’m defining CellArea

ca = CreateObject(“java”, “com.aspose.cells.CellArea”).init();

I’m trying to sort on column B, for set of rows, (eg: 4 to 18)
ca.setStartRow(_sortStartRow);
ca.setStartColumn(1);
ca.setEndRow(_sortEndRow);
ca.setEndColumn(1);

when i do sorter.sort(cells, ca);

I’m getting an error saying “invalid column index: -1”,
can you guide me further

Thank you
Sanjay

Thank you Johnson for pointing me in the right direction.
the value in setEndColumn() doesn’t matter, i just gave random number.

solved:
ca = CreateObject(“java”, “com.aspose.cells.CellArea”).init();
ca.setStartColumn(0);
ca.setEndColumn(20);
ca.setStartRow(_sortStartRow);
ca.setEndRow(_sortEndRow);

sorter = wb.getDataSorter();
sorter.setKey1(1);
sorter.setOrder1(1);
sorter.sort(cells, ca);