List of usage examples for org.apache.poi.xslf.usermodel XSLFTextRun isBold
@Override
public boolean isBold()
From source file:org.joeffice.presentation.ShapeComponent.java
License:Apache License
private AttributeSet getFontAttributes(XSLFTextRun textPart) { SimpleAttributeSet attributes = new SimpleAttributeSet(); String fontFamily = textPart.getFontFamily(); if (fontFamily != null) { StyleConstants.setFontFamily(attributes, fontFamily); }//from ww w . j av a 2s . c o m Color textColor = textPart.getFontColor(); if (textColor != null) { StyleConstants.setForeground(attributes, textColor); } double fontSize = textPart.getFontSize(); if (fontSize > 0) { fontSize = fontSize * slideComponent.getScale(); StyleConstants.setFontSize(attributes, (int) fontSize); } boolean italic = textPart.isItalic(); if (italic) { StyleConstants.setItalic(attributes, true); } boolean bold = textPart.isBold(); if (bold) { StyleConstants.setBold(attributes, true); } boolean underlined = textPart.isUnderline(); if (underlined) { StyleConstants.setUnderline(attributes, true); } boolean strikeThrough = textPart.isStrikethrough(); if (strikeThrough) { StyleConstants.setStrikeThrough(attributes, true); } boolean subScript = textPart.isSubscript(); if (subScript) { StyleConstants.setSubscript(attributes, true); } boolean superScript = textPart.isSuperscript(); if (superScript) { StyleConstants.setSuperscript(attributes, true); } return attributes; }
From source file:poi.xslf.usermodel.tutorial.Step1.java
License:Apache License
public static void main(String[] args) throws Exception { if (args.length == 0) { System.out.println("Input file is required"); return;//from w w w. j av a 2 s . c om } XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(args[0])); for (XSLFSlide slide : ppt.getSlides()) { System.out.println("Title: " + slide.getTitle()); for (XSLFShape shape : slide.getShapes()) { if (shape instanceof XSLFTextShape) { XSLFTextShape tsh = (XSLFTextShape) shape; for (XSLFTextParagraph p : tsh) { System.out.println("Paragraph level: " + p.getLevel()); for (XSLFTextRun r : p) { System.out.println(r.getText()); System.out.println(" bold: " + r.isBold()); System.out.println(" italic: " + r.isItalic()); System.out.println(" underline: " + r.isUnderline()); System.out.println(" font.family: " + r.getFontFamily()); System.out.println(" font.size: " + r.getFontSize()); System.out.println(" font.color: " + r.getFontColor()); } } } } } }