Aspose Java - Support mulitple record set in a row

Hello All,

I am looking for a way that we could use aspose cells for java where we can have multiple recordset tags in a row.

each record set can contain any number of columns and can be unrelated.

Like A-E has tags for recordset A which in turn has 10 rows of data.

and G-Z has tabs for recordset B which has 20 rows of data. Totally distinct, but shown on same row.


col1 col2 col3 … col10 col11 col12
x x` x y y y
x x x y y y
x x x
x x x
x x x

Something to implement like this.

Thanks,
Dhruv

Hi Dhruv,

Thank you for your inquiry.

As per my understanding, you want to insert the data in worksheet cells in a predefined manner. You can achieve this by accessing the cells and setting the data for one cell at a time. Please read about how to access a particular cell and add data to a cell.

Alternatively, you may use the Cells.importArrayList() method to import arrays in worksheet columns or rows. Please check the below source code and read about how to import data in worksheets,

Java


//Instantiating an ArrayList object
ArrayList list=new ArrayList();

//Add few names to the list as string values
list.add(“John”);
list.add(“Mickel”);
list.add(“Diana”);

//Load workbook
Workbook book = new Workbook(“Template.xlsx”);
Worksheet sheet = book.getWorksheets().get(0);
Cells cells = sheet.getCells();

//Importing the contents of ArrayList
//to 2nd row and first column vertically

//If you set the last parameter to true
//the data will be imported horizontally,
//means row wise
cells.importArrayList(list,1,0,false);

//Save workbook
book.save(“out1.xlsx”);


Please correct me if I am wrong in my understanding.

Hey,


I am working of result sets. I am pretty new to this. Also our templates have code to do aggregation at the end of the insertion. Will this affect how cells work …


-Dhruv

Hi Dhruv,

Could you please share one of your templates to help us understand your requirement? If possible, please share your desired results that you can create manually using MS Excel. We can then try to achieve the same outcome through Aspose.Cells for Java API.

Thank you.