Thanks for the sample code segment.
I have tested your scenario/ case a bit. I used the following sample code and it works fine. The right border and indentation are applied fine. I have also attached the output file for your reference. It looks like your text is more than cell’s width, so the right border might not be displayed. I suggest you to kindly extend the width of the column appropriately as you can see in my code, I have applied auto-fit column operation so the cell’s width should be extended accordingly based on the text length.
e.g
Sample code:
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Accessing the added worksheet in the Excel file
int sheetIndex = workbook.getWorksheets().add();
Worksheet worksheet = workbook.getWorksheets().get(sheetIndex);
Cells cells = worksheet.getCells();
// Adding the current system date to “A1” cell
Cell cell = cells.get(“A1”);
Style style = cell.getStyle();
// Adding some value to the “A1” cell
cell.setValue(“Visit Aspose!”);
// Setting the vertical alignment of the text in a cell
Style style1 = cell.getStyle();
style1.setBorder(BorderType.RIGHT_BORDER, CellBorderType.THICK, Color.getBlack());
style1.setIndentLevel(2);
cell.setStyle(style1);
// Saved style
cell.setStyle(style1);
worksheet.autoFitColumn(0);
// Saving the modified Excel file in default format
workbook.save(“out1Indentation1.xlsx”);
If you still find any issue, kindly do paste your complete JAVA program (runnable) with template file to reproduce the issue on our end, we will check it soon.
Thank you.