为有中文需求的客户提供多渠道中文技术支持.

Thu Jan 05, 2023 10:09 am

public void fontReadGroupList(IShape iShape){
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++) {
if(textRanges.get(k).getText().contains("字体颜色大小可选择参考模板")){
if(textRanges.get(k).getLatinFont() !=null){
System.out.println(textRanges.get(k).getText() + " font-family " +textRanges.get(k).getLatinFont().getFontName());

}else {
System.out.println(textRanges.get(k).getText() + " font-family null");

}
}

}
}

}else if(iShape instanceof GroupShape){
ShapeCollection shapes = ((GroupShape) iShape).getShapes();
for (int i = 0; i < shapes.size(); i++) {
fontReadGroupList(shapes.get(i));
}
}
}

@Test
public void fontRead() throws Exception{
Presentation presentation = new Presentation();
presentation.loadFromFile("E:\\work\\1比1复现\\未解决问题\\斜体丢失\\新局面模板-字体不一致.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);
fontReadGroupList(iShape);

}
String s = new String(iSlide.saveToSVG(), StandardCharsets.UTF_8);
//System.out.println(s);

}



//调用fontRead 函数 四段文本 有三段读取不到字体
// 于是我尝试使用转 svg 读取字体 但是转svg 读取到的字体全都是 simsun 与原来的不一样
// spire for java 7.12.4

911538126
 
Posts: 22
Joined: Thu Sep 29, 2022 6:50 am

Fri Jan 06, 2023 9:12 am

您好,

感谢咨询。
我测试您的代码复现了这个问题,已将此问题提交给研发进行进一步调查,编号为SPIREPPT-2144 。有消息我会及时反馈到您,很抱歉给您带来的不便!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Fri Feb 17, 2023 10:37 am

您好,

感谢您的耐心等待。
很高兴通知您我们刚刚发布了Spire.Presentation 8.2.1 for java,解决了您编号为SPIREPPT-2144的问题。欢迎下载测试。

网站下载链接: https://www.e-iceblue.cn/Downloads/Spir ... -JAVA.html

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 980
Joined: Tue Mar 08, 2022 2:02 am

Return to 中文技术支持