Please note that the textual values (unlike numbers) are aligned top & left by default. However, you may also achieve this with the following piece of code.
Java
//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.getWorksheets().get(0);
//Accessing the cells of first worksheet
Cells cells = worksheet.getCells();
//Accessing the “A1” cell from the worksheet
Cell cell=cells.get(“A1”);
//Adding some value to the “A1” cell
cell.setValue(“Hello Aspose!”);
Style style = workbook.createStyle();
//Setting the vertical alignment of the text in the “A1” cell
style.setVerticalAlignment(TextAlignmentType.TOP);
//Setting the horizontal alignment of the text in the “A1” cell
style.setHorizontalAlignment(TextAlignmentType.LEFT);
//Apply style onto the cell
cell.setStyle(style);
//Saving the modified Excel file
workbook.save(“D:/output.xlsx”, SaveFormat.XLSX);
If we have misunderstood your requirement then please share your desired results, that you may create manually using MS Excel application. Upon reviewing your desired results, we will be in a better position to mimic the same functionality using Aspose.Cells for Java API.
Thank you for the confirmation. It is good to know that you are up & running again, Please feel free to contact us back in case you need our further assistance with Aspose APIs.