We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Border style for merged cell not workings

Hi.


I have founded that border style for merged cell detected incorrectly. Moreover for simple border style it works, but for another line style it not works.

@Test
public void bordersTest() throws Exception {
Workbook wb = new Workbook(“D://in.xlsx”);

Cells cells = wb.getWorksheets().get(0).getCells();

Style style = cells.get(“F3”).getStyle(true);
    //works (1, 1, 1, 1);
System.out.println(style.getBorders().getByBorderType(BorderType.LEFT_BORDER).getLineStyle());
System.out.println(style.getBorders().getByBorderType(BorderType.TOP_BORDER).getLineStyle());
System.out.println(style.getBorders().getByBorderType(BorderType.RIGHT_BORDER).getLineStyle());
System.out.println(style.getBorders().getByBorderType(BorderType.BOTTOM_BORDER).getLineStyle());

style = cells.get(“C3”).getStyle(true);
    //not works for right and bottom (2,2,0,0)
System.out.println(style.getBorders().getByBorderType(BorderType.LEFT_BORDER).getLineStyle());
System.out.println(style.getBorders().getByBorderType(BorderType.TOP_BORDER).getLineStyle());
System.out.println(style.getBorders().getByBorderType(BorderType.RIGHT_BORDER).getLineStyle());
System.out.println(style.getBorders().getByBorderType(BorderType.BOTTOM_BORDER).getLineStyle());
}

Best regards.

Hi,


Thanks for the template file and sample code.

I have tested your scenario/ case a bit using your sample code and template file. Well, this is expected behavior as per your comments pasted in the code segment.
Since C3 is a merged cell, and if we un-merge it to the range (C3:D5), it will not have any border for its right or bottom borders of the cell (C3). For any merged range of cells, we only get top-left borders for the cell’s top and left border of the range’s outline border, and also get the right-bottom cell’s border as the range’s outline border. We actually do this for our component for performance considerations as we only process top-left and bottom-right cells.

Thanks for your understanding!

Thanks for reply

Hi,


Thanks for your understanding. Feel free to write back if you have further comments or questions, we will be happy to assist you soon.

Thank you.