Hi,
I would like to set the range style for individual columns range
For example
A7-A30-Range1
B7-B30-Range 2 etc.
I am populating the the cells.importArray() for setting the columns and rows for the table data.
This will be an example
H1 H2 H3................Hn(Column Headers)
V1 V2 V3................Vn(Data Values)
I tried with named range and cells.applyrangeStyle doesn't help me out.The formats will be custom(numbers,text,datetime,date).
Could you please tell me how to achieve it.
Regards
Joe
Hi Joe,
Which version of Aspose.Cells for Java you are using. Kindly use the latest version of the product. Moreover, please use setRangeStyle() method of Cells class.
Following is my testing code and attached is the output file, it works fine (kindly check it):
Workbook workbook = new Workbook();
try {
Worksheets worksheets = workbook.getWorksheets();
//Accessing the first worksheet in the Excel file
Worksheet sheet = worksheets.getSheet(0);
Cells cells = sheet.getCells();
//Creating a named range
//NamedRange namedRange = cells.createNamedRange("Range1","A7", "A30");
//Setting the display format of the date to number 15 to show date as "d-mmm-yy"
Style style = cells.getCell(0,0).getStyle();
style.setCustom("d-mmm-yy");
cells.setRangeStyle(6,29,0,0,style);
//Saving the modified Excel file in default format
workbook.save("e:\\Files\\out_Bkrange.xls",FileFormatType.DEFAULT);
}
catch (IOException e) {
e.printStackTrace();
}
Thank you.
Thanks a lot it works perfect.