// Create a new workbook Workbook workbook = new Workbook(); InputStream fileStream = this.getResourceStream("xlsx\\TemplateWorkWithChart.xlsx"); workbook.open(fileStream, OpenFileFormat.Xlsx); IWorksheet worksheet = workbook.getWorksheets().get(0); IShape shape1 = worksheet.getShapes().addShape(AutoShapeType.RoundedRectangle, (double)10, (double)10, (double)320, (double)150); shape1.getTextFrame().getTextRange().setTextAlignment(TextAlignmentAnchor.Left); shape1.getTextFrame().getTextRange().getFont().setName("Calibri"); shape1.getTextFrame().getTextRange().getFont().setSize(16); shape1.getTextFrame().getTextRange().getFont().getColor().setRGB(Color.GetBlack()); shape1.getTextFrame().getTextRange().getFont().setUnderline(TextUnderlineType.None); shape1.getTextFrame().getTextRange().getParagraphs().add("Quarterly Results"); shape1.getTextFrame().getTextRange().getParagraphs().get(0).setTextAlignment(TextAlignmentAnchor.Center); shape1.getTextFrame().getTextRange().getParagraphs().get(0).getFont().setSize(28); shape1.getTextFrame().getTextRange().getParagraphs().get(0).getFont().setUnderline(TextUnderlineType.Single); shape1.getTextFrame().getTextRange().getParagraphs().add(""); shape1.getTextFrame().getTextRange().getParagraphs().add("Business Domain: E-Commerce"); shape1.getTextFrame().getTextRange().getParagraphs().get(2).setTextAlignment(TextAlignmentAnchor.Left); shape1.getTextFrame().getTextRange().getParagraphs().add("Quarter: Q4"); shape1.getTextFrame().getTextRange().getParagraphs().get(3).setTextAlignment(TextAlignmentAnchor.Left); shape1.getLine().setDashStyle(LineDashStyle.Solid); shape1.getLine().setStyle(LineStyle.Single); shape1.getLine().getColor().setRGB(Color.GetBlack()); shape1.getFill().getColor().setRGB(Color.FromArgb(242, 242, 242)); // Save to an excel file workbook.save("UseCaseOfShapeTextAlignment.xlsx");