Hi Mikki and others,
I'm actually only dealing with one SlideShow which I read in from disk
(it is a template). I search for substitution text and replace it
(kind of like Velocity) and then save the template back out under a
new name.
The core of my code that does the substitution is:
// Loop over all the shapes in the slide to replace the substitution text.
for (Shape shape : slide.getShapes())
{
if (shape instanceof TextBox)
{
TextBox textBox = (TextBox) shape;
// Get the candidate substitution text.
String substitutionText = textBox.getText();
// If the substitution text matches a key in the substitution
map, replace it.
if (substitutionMap.containsKey(substitutionText))
textBox.setText(substitutionMap.get(substitutionText) ==
null ? "" : substitutionMap.get(substitutionText));
}
}
All I'm doing is setting the text to values. I'm not changing the
font name or font size, but for some reason when I save the SlideShow,
some of my TextBoxes (not all) have changed to Arial 24pt (and I don't
use Arial anywhere in the template, only Calibri). I'd have expected
only the text to change, but for some reason more is changing and I
don't know why.
Any ideas would be appreciated.
Thanks,
mrg
On Wed, Aug 18, 2010 at 3:15 AM, mikki <[email protected]> wrote:
>
> Hi!
>
> May help you this code
>
> SlideShow write_SlideShow = new SlideShow( new HSLFSlideShow( "New_File.ppt"
> ) );
> SlideShow read_SlideShow = new SlideShow( new HSLFSlideShow( "Old_File.ppt"
> ) );
> // Add Font
> for (int k=0; k < read_SlideShow.getNumberOfFonts(); k++){
> PPFont rf=read_SlideShow.getFont(k);
> int j=0;
> for (j=0; j < write_SlideShow.getNumberOfFonts(); j++){
> if (rf.equals(write_SlideShow.getFont(j))){
> break;
> }
> }
> if (j>=write_SlideShow.getNumberOfFonts()){
> write_SlideShow.addFont(rf);
> }
> }
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Problem-with-PowerPoint-fonts-tp2638655p2639025.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]