Hi,

I try to merge some pptx together with a specific template. Everything is
okay but i saw that some TextShape aren't properly formatted.

The importContent fonction doesn't provide a full import of some content so
I had to develop it my self.

When i use the .setFontSize() method, i saw the font size change but not to
the assigned value.

For example, with the following programm:

for(XSLFTextParagraph paragraph : textShape.getTextParagraphs())
        {
            for(XSLFTextParagraph layoutParagraph :
layoutTextShape.getTextParagraphs())
            {
                if(paragraph.getLevel() == layoutParagraph.getLevel())
                {
                    if(layoutParagraph.getTextAlign() != null)
                    {
                       
paragraph.setTextAlign(layoutParagraph.getTextAlign());
                    }
                    
                    paragraph.setBullet(layoutParagraph.isBullet());
                    
                    if(layoutParagraph.getBulletCharacter() != null) 
                    {
                       
paragraph.setBulletCharacter(layoutParagraph.getBulletCharacter());
                    }
                    
                    if(layoutParagraph.getBulletFont() != null) 
                    {
                       
paragraph.setBulletFont(layoutParagraph.getBulletFont());
                    }
                    
                    if(layoutParagraph.getBulletFontColor() != null) 
                    {
                       
paragraph.setBulletFontColor(layoutParagraph.getBulletFontColor());
                    }
                    
                    if(layoutParagraph.getBulletFontSize() >= 1) 
                    {
                       
paragraph.setBulletFontSize(layoutParagraph.getBulletFontSize());
                    }
                    
                    for(XSLFTextRun tr : layoutParagraph.getTextRuns())
                    {
                        this.boldEnable  = tr.isBold();
                        this.textColor = tr.getFontColor();
                        this.textFamily = tr.getFontFamily();
                        this.textSize = tr.getFontSize();
                        this.italicEnable = tr.isItalic();
                        this.underlineEnable = tr.isUnderline();
                    }
                    
                    for(XSLFTextRun tr : paragraph.getTextRuns())
                    {
                        tr.setBold(this.boldEnable);
                        
                        if(this.textColor != null) 
                        {
                            tr.setFontColor(this.textColor);
                        }
                        
                        if(this.textFamily != null) 
                        {
                            tr.setFontFamily(this.textFamily);
                        }
                        
                        if(tr.getText().contains("applications"))
                        {
                            System.out.println("Texte:" + tr.getText() + "
Size: " + tr.getFontSize() + " Register: " + this.textSize);
                        }
                        
                        if(this.textSize >= 1) 
                        {
                            tr.setFontSize(this.textSize);
                        }
                        
                        if(tr.getText().contains("applications")) 
                        {
                            System.out.println("Texte:" + tr.getText() + "
Size: " + tr.getFontSize() + " Police: " + tr.getFontFamily());
                        }
                        tr.setItalic(this.italicEnable);
                        tr.setUnderline(this.underlineEnable);
                    }
                }
            }
        }
        
        return textShape;

I obtain the following output:

Slide 1:
Texte:Military applications (examples): Size: 27.2 Register: 18.0
Texte:Military applications (examples): Size: 15.299999999999999 Police:
Arial Black

Slide 2:
Texte:Civil applications (examples): Size: 32.0 Register: 18.0
Texte:Civil applications (examples): Size: 18.0 Police: Arial Black

Slide 3:
Texte:Military applications (examples): Size: 32.0 Register: 18.0
Texte:Military applications (examples): Size: 18.0 Police: Arial Black

Slide 4:
Texte:Civil applications (examples): Size: 32.0 Register: 18.0
Texte:Civil applications (examples): Size: 18.0 Police: Arial Black

As you can see, for slides 2,3,4 the font is properly paste but not for the
first one.

Do you have any idea to solve this problem?

Thanks a lot, have a nice day.



--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/POI-XSLF-4-0-SetFontSize-issue-with-some-XSLFTextShape-tp5712805.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]

Reply via email to