Howdy,
I have encounter an issue with textbox text alignments and wondered if there has been a change to the way it used to work. Originally this textbox was fine in previous versions but now is doing something different. The text was being aligned correctly but now, the second line doesn’t align to the centre and vertical alignment is set to middle centred, meaning if you changed the horizontal alignment to left or right, it doesn’t go to the edge of the textbox. Here is the following code:
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>final Workbook wb = new Workbook();
final Worksheet ws = wb.getWorksheets().get(0);
TextBox t = ws.getTextBoxes().get(
ws.getTextBoxes().add(
3,
3,
100,
100));
t.setText(“Line 1\nLine2”);
t.setTextVerticalAlignment(TextAlignmentType.CENTER);
t.setTextHorizontalAlignment(TextAlignmentType.CENTER);
wb.save(“C:/export/Test Report.xlsx”);
Desktop.getDesktop().open(new File(“C:/export/Test Report.xlsx”));
final Worksheet ws = wb.getWorksheets().get(0);
TextBox t = ws.getTextBoxes().get(
ws.getTextBoxes().add(
3,
3,
100,
100));
t.setText(“Line 1\nLine2”);
t.setTextVerticalAlignment(TextAlignmentType.CENTER);
t.setTextHorizontalAlignment(TextAlignmentType.CENTER);
wb.save(“C:/export/Test Report.xlsx”);
Desktop.getDesktop().open(new File(“C:/export/Test Report.xlsx”));