How to apply styles to a merged cells in aspose cells java

Hi,

Please let me know, how to apply styles for merged cells in aspose cells for java. I have tried like below:

range.applyStyle(style, styleFlag); but got IndexOutofBound exception.

Please let me know if you have any standard practice. I am trying to style merged cells in LightCells API implementation. The cells are merged properly before dataProvider is called.

I am able to place values in merged cells properly, but when I apply styles it throws exception.

I am using latest aspose.cells java jar 18.4 version.

Thanks,
Balakumar

@BalakumarSeethapathy,

Thanks for some details.

Could you provide a sample JAVA program (runnable, with main class with interface) to reproduce the issue, we will check it soon.

Hi,

I have attached the program files, if you un-comment lines 143-161 we get the IndexOutofBound exception. If I comment those lines program out put is fine without styling the data.

I have attached the program output as well, am using aspose-cells-18.3.jar version.

Please let me know whats wrong with this.sample program.zip (12.5 KB)

Thanks,
Balakumar

@BalakumarSeethapathy,

Thanks for the sample Java classes.

Could you remove json data and other dependencies from “DemoTestDetails.java” file and re-share the file again (after updating the code segments), so we can evaluate your issue precisely.

Hi,

I have reattached the code by removing dependencies. Please comment out the lines between 143-161 in LightCellsDataProviderTestDetails.java to produce the output, other we will see OutofBoundException.

I have attached the out put file again.

Let me know if you need any info from my end. Thanks a lot for helping me on this.

Thanks,
BalakumarSample Code Reattached.zip (11.4 KB)

@BalakumarSeethapathy,

Thanks for the updated code segments.

After an initial test, I am able to observe the issue as you mentioned by using your sample code. I found an exception “IndexOutOfBoundsException” when merging cells in light-weight mode. If I comment out the lines between 143-161 in “LightCellsDataProviderTestDetails.java”, it works fine. This is the culprit code segment:
e.g
Sample code:

............ 
Style style = null; 
///* 
if (cell.isMerged()) { 
System.out.println("In Merged Cell if condn..."); 
Range range = cell.getMergedRange(); 
range.setName("Header" + System.currentTimeMillis()); 
} else { 
style = cell.getStyle(); 
style.setTextWrapped(true); 
style.setHorizontalAlignment(TextAlignmentType.RIGHT); 
style.setVerticalAlignment(TextAlignmentType.CENTER); 
style.setBorder(BorderType.BOTTOM_BORDER, CellBorderType.THIN, Color.getBlack()); 

Font font = style.getFont(); 
font.setName("Tahoma"); 
font.setSize(10); 
font.setColor(Color.getBlack()); 
font.setBold(true);	

cell.setStyle(style); 
} 
//*/ 
............  

I have logged a ticket with an id “CELLSJAVA-42602” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Hi,

Thanks again for taking a look. This feature is something very essential for us now, Is it possible to have ETA on this?

Regards,
Balakumar

@BalakumarSeethapathy,

Could you spare us a little time (2,3 days or so) so we could evaluate your issue precisely before updating you or provide an ETA (if it takes more time).

Once we have any new information, we will let you know here.

Thank you!

Regards,
Balakumar

@BalakumarSeethapathy,

This is to inform you that we have fixed your issue “CELLSJAVA-42602” now. We will soon provide the fix after performing QA and including other enhancements and fixes.

Keep in touch.

Thanks for keeping me posted!!

Regards,
Balakumar

@BalakumarSeethapathy

Thanks for using Aspose APIs.

Please download and try the following fix and let us know your feedback.

Hi,

The issue is fixed now. Thanks for your quick turn around.

Thanks,
Balakumar

@BalakumarSeethapathy,

Good to know that your issue is sorted out by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSJAVA-42602) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Please also see the document for your reference: Installation|Documentation