We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bold Style Did Not Get Applied on Text

Hi,


In the attached presentation, I created new Portion with some text and applied some formatting. I then cleared the old portions from a paragraph and added new portion to it. As a result of that, bold style did not get applied on text. Please see screenshot for your reference.

Here’s the code I use:

String presentationPath = “0804Presentation_Francois_Atger.ppt”;

InputStream inputStream = new FileInputStream(presentationPath);

Presentation presentation = new Presentation(inputStream);

inputStream.close();

ISlide slide = presentation.getSlides().get_Item(0);

IAutoShape shape = (IAutoShape) slide.getShapes().get_Item(1);

IParagraph paragraph = shape.getTextFrame().getParagraphs().get_Item(0);

IPortion portion = paragraph.getPortions().get_Item(0);

IPortionFormatEffectiveData effectiveData = portion
.createPortionFormatEffective();

float fontHeight = effectiveData.getFontHeight();
boolean bold = effectiveData.getFontBold();
Color color = effectiveData.getFillFormat().getSolidFillColor();
int red = color.getRed();
int green = color.getGreen();
int blue = color.getBlue();
int alpha = color.getAlpha();

String fontName = effectiveData.getLatinFont().getFontName();

IPortion newPortion = new Portion(“T_François Atger, Territorial Director”);

IPortionFormat newPortionFormat = newPortion.getPortionFormat();

newPortionFormat.setFontHeight(fontHeight);
newPortionFormat.setLatinFont(new FontData(fontName));
newPortionFormat.setFontBold(bold ? NullableBool.True
: NullableBool.False);

System.out.println("Bold: " + newPortionFormat.getFontBold());
newPortionFormat.getFillFormat().setFillType(FillType.Solid);
newPortionFormat.getFillFormat().getSolidFillColor()
.setColorType(ColorType.RGB);
newPortionFormat.getFillFormat().getSolidFillColor()
.setColor(new Color(red, green, blue, alpha));

paragraph.getPortions().clear();
paragraph.getPortions().add(newPortion);

presentation.save(“0804Presentation_Francois_Atger-aspose.ppt”, SaveFormat.Ppt);

Can you check this?

Thanks,
Zeljko

Hi Zeljko,


I have worked with the presentation file and sample code shared by you and have been able to observe the issue while setting boldness of text. An issue with ID SLIDESJAVA-35322 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-35322) have been fixed in this update.