Hi,
We have a requirement where we have to process the data from an excel sheet we download.
The input excel sheet comes with grouped rows. Until now we were using Apache POI api for reading the excel sheets but are unable to classify the row into the input groups.
Is there a way we can parse the rows based on the groups in an excel sheet using Aspose.Cells?
Thanks in advance,
Raj
Hi,
Thanks for your posting and considering Aspose.Cells for Java.
I am not sure that you will be able to read cell values based on groups. You will have to read cell values in a normal way.
However, you can group and ungroup rows and columns using Aspose.Cells.
Please see this article for your reference.
mshakeel.faiz:
Hi,
Thanks for your posting and considering Aspose.Cells for Java.
I am not sure that you will be able to read cell values based on groups. You will have to read cell values in a normal way.
However, you can group and ungroup rows and columns using Aspose.Cells.
Please see this article for your reference.
( http://www.aspose.com/docs/display/cellsjava/Grouping+Ungrouping+Rows+and+Columns )
Hi,
Thanks for the quick clarification. We are looking for an API that allows us to use already existing macros (Like row groups) while reading from excel files, which in this case i am assuming is not being facilitated. Is there any chance we could get this feature in Aspose.Cells anytime soon in the future.
Also I would like to know how Aspose.Cells is better than Apache POI API, as we are on the verge of concluding which API to use.
Thanks in advance,
Raj
Hi,
Thanks for your question and interest in Aspose.Cells.
a)
Yes, you can use your existing macros inside a workbook.
Please note, Aspose.Cells does not allow you to inject/modify new or existing macros. But it preserves the existing macros in your workbook.
Means, if you workbook has already macros, then they will not be deleted.
However, we cannot provide the injection or modification of macros feature in near future.
Regarding preservation of macros while converting one format into another, please see the summary below.
Xls --> Xlsm (macros will be preserved)
Xlsm --> Xls (macros will be lost)
Xlsx does not support any macros.
Please Note:
Xls is old Ms-Excel 2003 file format
Xlsx/Xlsm are newer Ms-Excel 2007/2010 file formats.
b)
For reading cell values based on groups, we will analyze this feature and if it is possible, we will implement it and let you know asap.
This issue has been logged as CELLSJAVA-40253.
Hi Raj,
“Also I would like to know how Aspose.Cells is better than Apache POI API, as we are on the verge of concluding which API to use”
Please see the article which may help you to compare (general view) Aspose.Cells for Java Vs Apache POI although it might not be very accurate and cover all the features:
Thank you.
rajgumma:
Is there a way we can parse the rows based on the groups in an excel sheet using Aspose.Cells?
Hi,
For this requirement of yours, we need your more elaboration.
Could you please provide us a sample xlsx file and the your expected output? It will help us look into your requirements more precisely and we will be able to provide you a solution.
To start with, I have attached a
source.xlsx file and the screenshot for a reference.
Let us know your expected output.
Screenshot:
Hi,
We could not provide such API because there is no special info to know which group is your need.
The following codes with the attached file is used to print all grouped data and level:
Java
public static int GetGroupData(RowCollection rows,int index,int groupLevel)
{
for( ; index < rows.getCount() ;index++)
{
Row rowInfo = rows.getRowByIndex(index);
int rowGroupLevel = rowInfo.getGroupLevel();
if(rowGroupLevel > groupLevel)
{
index = GetGroupData(rows,index,rowGroupLevel);
}else if(rowGroupLevel < groupLevel)
{
return index;
}else
{
System.out.println(“groupLevel " + groupLevel +” "+ rowInfo.get(0).getStringValue());
}
}
return index;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try
{
//Workbook workbook = new Workbook(“D:\FileTemp\Demo_Calculator_1.xls”);
Workbook workbook = new Workbook(“d:\FileTEmp\Book1.xls”);
Worksheet sheet = workbook.getWorksheets().get(“Sheet1”);
RowCollection rows = sheet.getCells().getRows();
for(int i = 0 ; i < rows.getCount() ;i++)
{
Row rowInfo = rows.getRowByIndex(i);
int rowGroupLevel =rowInfo.getGroupLevel();
if(rowGroupLevel != 0)
{
i = GetGroupData(rows,i,rowGroupLevel);
}
}
}catch(Exception e)
{
e.printStackTrace();
System.out.println(e.getMessage());
}
}
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan