You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Rupanu Ranjaneswar <ru...@yahoo.com> on 2008/03/18 08:03:57 UTC
how to get font names used in PPT, TXT
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.
Re: how to get font names used in PPT, TXT
Posted by rohit_sh1 <ro...@yahoo.ca>.
Thanks Yegor for the post,
I followed the code mentioned above but for some reason when I am line
debugging the code I see "calibri", font used in my ppt file for
obj.getFontName() method but when I open the merged ppt file the fonr is set
to Arial.
Any ideas what I might be doing incorrectly?
Rohit
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/how-to-get-font-names-used-in-PPT-TXT-tp2297377p5710060.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: how to get font names used in PPT, TXT
Posted by Yegor Kozlov <ye...@dinom.ru>.
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
Re: how to get font names used in PPT, TXT
Posted by Nick Burch <ni...@torchbox.com>.
On Tue, 18 Mar 2008, Rupanu Ranjaneswar wrote:
> I want to get all the font names used in a presentation.
RichTextRun.getFontName() is what you'll want:
http://poi.apache.org/apidocs/org/apache/poi/hslf/usermodel/RichTextRun.html
Nick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org