//房地产建筑公司商业计划书PPT 这段文本加粗属性读取不到
textRange.getFormat().isBold().getName()
使用版本 Java
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.office</artifactId>
<version>7.11.2</version>
</dependency>
Presentation presentation = new Presentation();
//加载PowerPoint文档
presentation.loadFromFile("data/封面.pptx");
SlideCollection slides = presentation.getSlides();
ISlide iSlide = slides.get(0);
ShapeCollection shapes = iSlide.getShapes();
for (int i = 0; i < shapes.size(); i++) {
IShape iShape = shapes.get(i);
if (iShape instanceof IAutoShape) {
ParagraphCollection paragraphs = ((IAutoShape) iShape).getTextFrame().getParagraphs();
for (int j = 0; j < paragraphs.size(); j++) {
ParagraphEx paragraphEx = paragraphs.get(j);
TextRangeCollection textRanges = paragraphEx.getTextRanges();
for (int k = 0; k < textRanges.size(); k++) {
PortionEx portionEx = textRanges.get(k);
TriState bold = portionEx.getDisplayFormat().isBold();
System.out.println(portionEx.getText() +" isBold"+ bold.getName());
}
}
}