Version: Java AsposeCells-184.108.40.206
I am having issue on cell format in merge cell. here are the snipped code in ruby:
def format_decimal_places(decimal_place, source_cell)
decimal_formatting_style = source_cell.style.clone
decimal_format_str = “”
if decimal_place > 0
decimal_format = “0” * decimal_place
decimal_format_str = “#,##0.” + decimal_format
elsif decimal_place == nil || decimal_place == 0
decimal_format_str = “#,##0”
workbook = Workbook.new
worksheet = workbook.getWorksheets().getSheet(0)
num = BigDecimal.new “2.5678"
cell = worksheet.cells.getCell(“A1”)
The above code is trying to format the cell (Number type) with specified decimal places. If you open the excel ‘s.xls’ and right click on cell ‘A1’ and select ‘Format Cells’. In Number tab, there is no category is being selected where it should be Number Category.
However, this issue does not happen on non-merge cell.
Actually, it was pretty suprise for me that 1 decimal places is working as expected however, if you try more than 2 decimal places, the problem starts showing.
For performance consideration, when you set a style to a cell, we do not check the merged cells settings on this cell and so we do not update style of other cells in the same merged areas. So, following code for aspose.cells:
Another issue of similar kind, with
No, it is not needed for you to unmerge the cells at first. We were just showing how to reproduce such kind of issue when editing your template file in ms excel. For your application with aspose.cells and for this specific template file, you just need to use following code:
Last one was for .Net api. There is no getMergedArea() method available in cell Class. Did you mean GetMergedRange().
Yes, you are right. You should use GetMergedRange() method instead in .NET API.