/** * Sets the rich text string used by this comment. * * @param string the XSSFRichTextString used by this object. */ @Override public void setString(RichTextString string) { if(!(string instanceof XSSFRichTextString)){ throw new IllegalArgumentException("Only XSSFRichTextString argument is supported"); } _str = (XSSFRichTextString)string; _comment.setText(_str.getCTRst()); }
/** * Add an entry to this Shared String table (a new value is appended to the end). * * <p> * If the Shared String table already contains this string entry, its index is returned. * Otherwise a new entry is added. * </p> * * @param string the entry to add * @since POI 4.0.0 * @return index the index of added entry */ public int addSharedStringItem(RichTextString string) { if(!(string instanceof XSSFRichTextString)){ throw new IllegalArgumentException("Only XSSFRichTextString argument is supported"); } return addEntry(((XSSFRichTextString) string).getCTRst()); }
/** * Sets the rich text string used by this comment. * * @param string the XSSFRichTextString used by this object. */ public void setString(RichTextString string) { if(!(string instanceof XSSFRichTextString)){ throw new IllegalArgumentException("Only XSSFRichTextString argument is supported"); } _str = (XSSFRichTextString)string; _comment.setText(_str.getCTRst()); }
@Override public CTRst getEntryAt(int idx) { return ((XSSFRichTextString)getItemAt(idx)).getCTRst(); }
/** * Sets the rich text string used by this comment. * * @param string the XSSFRichTextString used by this object. */ @Override public void setString(RichTextString string) { if(!(string instanceof XSSFRichTextString)){ throw new IllegalArgumentException("Only XSSFRichTextString argument is supported"); } _str = (XSSFRichTextString)string; _comment.setText(_str.getCTRst()); }
/** * Add an entry to this Shared String table (a new value is appended to the end). * * <p> * If the Shared String table already contains this string entry, its index is returned. * Otherwise a new entry is added. * </p> * * @param string the entry to add * @since POI 4.0.0 * @return index the index of added entry */ public int addSharedStringItem(RichTextString string) { if(!(string instanceof XSSFRichTextString)){ throw new IllegalArgumentException("Only XSSFRichTextString argument is supported"); } return addEntry(((XSSFRichTextString) string).getCTRst()); }
XSSFRichTextString rt = (XSSFRichTextString)str; rt.setStylesTableReference(_stylesSource); int sRef = _sharedStringSource.addEntry(rt.getCTRst()); _cell.setV(Integer.toString(sRef));
public void setText(XSSFRichTextString str){ XSSFWorkbook wb = (XSSFWorkbook)getDrawing().getParent().getParent(); str.setStylesTableReference(wb.getStylesSource()); CTTextParagraph p = CTTextParagraph.Factory.newInstance(); 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()); } } ctShape.getTxBody().setPArray(new CTTextParagraph[]{p}); }
XSSFRichTextString rt = new XSSFRichTextString(str); rt.setStylesTableReference(_stylesSource); int sRef = _sharedStringSource.addEntry(rt.getCTRst()); _cell.setV(Integer.toString(sRef));