void copy(XSLFTextRun r){ String srcFontFamily = r.getFontFamily(); if(srcFontFamily != null && !srcFontFamily.equals(getFontFamily())){ setFontFamily(srcFontFamily);
/** * Specifies the typeface, or name of the font that is to be used for this text run. * * @param typeface the font to apply to this text run. * The value of <code>null</code> unsets the Typeface attrubute from the underlying xml. */ public void setFontFamily(String typeface){ setFontFamily(typeface, (byte)-1, (byte)-1, false); }
XSLFTextRun run1 = p.addNewTextRun(); run1.setText("This is test"); run1.setFontFamily(HSSFFont.FONT_ARIAL); run1.setFontColor(Color.red); run1.setFontSize(24);
XSLFTextShape[] phs = slide[i].getPlaceholders(); for (XSLFTextShape ts : phs) { java.util.List<XSLFTextParagraph> tpl = ts.getTextParagraphs(); for(XSLFTextParagraph tp: tpl) { java.util.List<XSLFTextRun> trs = tp.getTextRuns(); for(XSLFTextRun tr: trs) { logger.info(tr.getFontFamily()); tr.setFontFamily("SimSun"); } } }
XSLFTextRun run = par.addNewTextRun(); run.setText("unicode ->\u30B4\u30DF\u7BB1<-"); run.setFontFamily("GE Inspira"); run.setFontSize(12.0); return ss;
XSLFTextRun run = par.addNewTextRun(); run.setText("/\u02CCin\u0259\u02C8v\u0101SH\u0259n/"); run.setFontFamily("DejaVu Serif"); run.setFontSize(12); par.addLineBreak(); run = par.addNewTextRun(); run.setText("/\u02CCin\u0259\u02C8v\u0101SH\u0259n/"); run.setFontFamily("GE Inspira"); run.setFontSize(12);
void copy(XSLFTextRun r){ String srcFontFamily = r.getFontFamily(); if(srcFontFamily != null && !srcFontFamily.equals(getFontFamily())){ setFontFamily(srcFontFamily); } Color srcFontColor = r.getFontColor(); if(srcFontColor != null && !srcFontColor.equals(getFontColor())){ setFontColor(srcFontColor); } double srcFontSize = r.getFontSize(); if(srcFontSize != getFontSize()){ setFontSize(srcFontSize); } boolean bold = r.isBold(); if(bold != isBold()) setBold(bold); boolean italic = r.isItalic(); if(italic != isItalic()) setItalic(italic); boolean underline = r.isUnderline(); if(underline != isUnderline()) setUnderline(underline); boolean strike = r.isStrikethrough(); if(strike != isStrikethrough()) setStrikethrough(strike); } }
void copy(XSLFTextRun r){ String srcFontFamily = r.getFontFamily(); if(srcFontFamily != null && !srcFontFamily.equals(getFontFamily())){ setFontFamily(srcFontFamily);
Color fontColor = null; String fontFamily = null; double fontSize = 0.0; boolean italic = false; boolean bold = false; boolean underline = false; for (XSLFTextParagraph paragraph : autoShape.getTextParagraphs()) { for (XSLFTextRun text : paragraph.getTextRuns()) { fontColor = text.getFontColor(); fontFamily = text.getFontFamily(); fontSize = text.getFontSize(); italic = text.isItalic(); bold = text.isBold(); underline = text.isUnderline(); } } autoShape.clearText(); XSLFTextParagraph addNewTextParagraph = autoShape.addNewTextParagraph(); XSLFTextRun addNewTextRun = addNewTextParagraph.addNewTextRun(); addNewTextRun.setText(values.get(0)[1]); addNewTextRun.setFontColor(fontColor); addNewTextRun.setFontFamily(fontFamily); addNewTextRun.setFontSize(fontSize); addNewTextRun.setItalic(italic); addNewTextRun.setBold(bold); addNewTextRun.setUnderline(underline);