/** * Add a new run of text * * @return a new run of text */ public XSSFTextRun addNewTextRun(){ CTRegularTextRun r = _p.addNewR(); CTTextCharacterProperties rPr = r.addNewRPr(); rPr.setLang("en-US"); XSSFTextRun run = new XSSFTextRun(r, this); _runs.add(run); return run; }
XSSFTextParagraph(CTTextParagraph p, CTShape ctShape){ _p = p; _shape = ctShape; _runs = new ArrayList<>(); for(XmlObject ch : _p.selectPath("*")){ if(ch instanceof CTRegularTextRun){ CTRegularTextRun r = (CTRegularTextRun)ch; _runs.add(new XSSFTextRun(r, this)); } else if (ch instanceof CTTextLineBreak){ CTTextLineBreak br = (CTTextLineBreak)ch; CTRegularTextRun r = CTRegularTextRun.Factory.newInstance(); r.setRPr(br.getRPr()); r.setT("\n"); _runs.add(new XSSFTextRun(r, this)); } else if (ch instanceof CTTextField){ CTTextField f = (CTTextField)ch; CTRegularTextRun r = CTRegularTextRun.Factory.newInstance(); r.setRPr(f.getRPr()); r.setT(f.getT()); _runs.add(new XSSFTextRun(r, this)); } } }
/** * Add a new run of text * * @return a new run of text */ public XSSFTextRun addNewTextRun(){ CTRegularTextRun r = _p.addNewR(); CTTextCharacterProperties rPr = r.addNewRPr(); rPr.setLang("en-US"); XSSFTextRun run = new XSSFTextRun(r, this); _runs.add(run); return run; }
XSSFTextParagraph(CTTextParagraph p, CTShape ctShape){ _p = p; _shape = ctShape; _runs = new ArrayList<>(); for(XmlObject ch : _p.selectPath("*")){ if(ch instanceof CTRegularTextRun){ CTRegularTextRun r = (CTRegularTextRun)ch; _runs.add(new XSSFTextRun(r, this)); } else if (ch instanceof CTTextLineBreak){ CTTextLineBreak br = (CTTextLineBreak)ch; CTRegularTextRun r = CTRegularTextRun.Factory.newInstance(); r.setRPr(br.getRPr()); r.setT("\n"); _runs.add(new XSSFTextRun(r, this)); } else if (ch instanceof CTTextField){ CTTextField f = (CTTextField)ch; CTRegularTextRun r = CTRegularTextRun.Factory.newInstance(); r.setRPr(f.getRPr()); r.setT(f.getT()); _runs.add(new XSSFTextRun(r, this)); } } }