poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <ye...@dinom.ru>
Subject Re: how to get font names used in PPT, TXT
Date Tue, 18 Mar 2008 14:50:19 GMT
We don't yet have a nice usermodel API to work with fonts.
Here is how you can use low-level HSLF API to access font records:

    public static void main(String[] args) throws Exception {

        SlideShow ppt = new SlideShow(new FileInputStream(args[0]));
        FontCollection fonts = ppt.getDocumentRecord().getEnvironment().getFontCollection();
        Record[] child = fonts.getChildRecords();
        for (int i = 0; i < child.length; i++) {
            if(child[i] instanceof FontEntityAtom){
                FontEntityAtom fontatom = (FontEntityAtom)child[i];
                System.out.println(fontatom.getFontName());
            }

        }
    }

    
Yegor

> Hello everyone,
>   I want to get all the font names used in a presentation. In the
> POI tutorial I found that PowerPoint stores information about the
> fonts used in FontEntityAtom and also FontCollection ia a container
> that holds information about all the fonts in the presentation. Can
> anyone tell me which one to use to get the required information. A
> simple code snippet to show the usage would be of help.
>     
>   Thanking 
>   pal

>        
> ---------------------------------
> Never miss a thing.   Make Yahoo your homepage.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message