Bug 55307 - Analysis PPT cannot obtain font
Summary: Analysis PPT cannot obtain font
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: 3.9-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-25 07:48 UTC by Atom
Modified: 2015-11-29 17:39 UTC (History)
0 users



Attachments
it's WPS created PPT (113.00 KB, application/vnd.ms-powerpoint)
2013-07-25 07:48 UTC, Atom
Details
it's office 2003 created PPT (204.00 KB, application/vnd.ms-powerpoint)
2013-07-25 07:49 UTC, Atom
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Atom 2013-07-25 07:48:12 UTC
Created attachment 30626 [details]
it's WPS created PPT

if my ppt is Version 2003,

when i use  slide[i].getTextRuns()  Getting font ;

TextRun[] truns = slide[i].getTextRuns();

RichTextRun[] rtruns = truns[k].getRichTextRuns();

rtruns[l].getFontSize()

This is normal

When I create a PPT when using WPS

Access font : rtruns[l].getFontSize()   = 0;

Cause the resulting image is no font
Comment 1 Atom 2013-07-25 07:49:05 UTC
Created attachment 30627 [details]
it's office 2003 created PPT
Comment 2 Andreas Beeker 2015-11-29 17:39:02 UTC
Your bug report is a bit misleading, but I guess it's about reading the font 
size and that in POI 3.9 the font size was sometimes 0.
This seems to be fixed by now ... this was my test code:

@Test
public void bug55307() throws IOException {
    String files[] = { "bug55307-office.ppt", "bug55307-wps.ppt" };
    for (String file : files) {
        HSLFSlideShow ppt = open(file);
        for (HSLFSlide slide : ppt.getSlides()) {
            for (List<HSLFTextParagraph> paras : slide.getTextParagraphs()) {
                for (HSLFTextParagraph p : paras) {
                    for (HSLFTextRun r : p.getTextRuns()) {
                        String err = "Can't determine font size for 
\""+r.getRawText()+"\" on page "+slide.getSlideNumber();
                        assertNotEquals(err, r.getFontSize(), 0);
                        assertNotNull(r.getFontFamily());
                    }
                }
            }
        }
        ppt.close();
    }
}