public XSSFTextParagraph addNewTextParagraph(XSSFRichTextString str) {
CTTextBody txBody = ctShape.getTxBody();
CTTextParagraph p = txBody.addNewP();
if(str.numFormattingRuns() == 0){
CTRegularTextRun r = p.addNewR();
CTTextCharacterProperties rPr = r.addNewRPr();
rPr.setLang("en-US");
rPr.setSz(1100);
r.setT(str.getString());
} else {
for (int i = 0; i < str.getCTRst().sizeOfRArray(); i++) {
CTRElt lt = str.getCTRst().getRArray(i);
CTRPrElt ltPr = lt.getRPr();
if(ltPr == null) ltPr = lt.addNewRPr();
CTRegularTextRun r = p.addNewR();
CTTextCharacterProperties rPr = r.addNewRPr();
rPr.setLang("en-US");
applyAttributes(ltPr, rPr);
r.setT(lt.getT());
}
}
// Note: the XSSFTextParagraph constructor will create its required XSSFTextRuns from the provided CTTextParagraph
XSSFTextParagraph paragraph = new XSSFTextParagraph(p, ctShape);