Font size changed

Hi,


I opened the attached presentation, removed one portion of text, added another one to its place and set font height, bold and underline values. When I opened the saved presentation, font size changed from 28 to 27 in the whole paragraph. Even in the next paragraph, font size changed from 24 to 23, etc.

Here’s the code I used:

String presentationPath = “Praesentation_bayHochschulen_BayBIDS_komprimiert96ppi.pptx”;

InputStream stream = new FileInputStream(presentationPath);

Presentation presentation = new Presentation(stream);

stream.close();

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

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

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

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

IPortion newPortion = new Portion("NewPortion ");

paragraph.getPortions().removeAt(0);
paragraph.getPortions().insert(0, newPortion);

newPortion.getPortionFormat().setFontHeight((float) 28.0);
newPortion.getPortionFormat().setFontBold(NullableBool.True);
newPortion.getPortionFormat().setFontUnderline(TextUnderlineType.Single);

presentation
.save(“Praesentation_bayHochschulen_BayBIDS_komprimiert96ppi-aspose.pptx”,
SaveFormat.Pptx);

Can you check this?

Thanks,
Zeljko

Hi Zeljko,


Thank you for posting.

I have observed your comments and worked with the presentation file shared by you. I have been able to reproduce the specified issue. A ticket with ID SLIDESJAVA-35181 has been logged 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 resolved.

We are sorry for your inconvenience,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,


The issue I reported above is fixed with the latest Aspose.Slides (16.2.0). But that was just one slide I extracted from an presentation. For the rest of slides, the issue still persists. Please check the attached presentation from the slide #3 and so on.

Here’s the code I use:

public void test() throws Exception {

String presentationPath = “Praesentation_bayHochschulen_BayBIDS_komprimiert96ppi.pptx”;

InputStream inputStream = new FileInputStream(presentationPath);

Presentation presentation = new Presentation(inputStream);

inputStream.close();

// Slide #2
ISlide slide = presentation.getSlides().get_Item(1);

IShapeCollection shapes = slide.getShapes();

IAutoShape shape = (IAutoShape) shapes.get_Item(1);

IParagraphCollection paragraphs = shape.getTextFrame().getParagraphs();

for (IParagraph paragraph : paragraphs) {
translateParagraph(paragraph);
}

// Slide #3
slide = presentation.getSlides().get_Item(2);

shapes = slide.getShapes();

shape = (IAutoShape) shapes.get_Item(0);

paragraphs = shape.getTextFrame().getParagraphs();

for (IParagraph paragraph : paragraphs) {
translateParagraph(paragraph);
}

// Slide #4
slide = presentation.getSlides().get_Item(3);

shapes = slide.getShapes();

shape = (IAutoShape) shapes.get_Item(1);

paragraphs = shape.getTextFrame().getParagraphs();

for (IParagraph paragraph : paragraphs) {
translateParagraph(paragraph);
}

// Slide #5
slide = presentation.getSlides().get_Item(4);

shapes = slide.getShapes();

shape = (IAutoShape) shapes.get_Item(1);

paragraphs = shape.getTextFrame().getParagraphs();

for (IParagraph paragraph : paragraphs) {
translateParagraph(paragraph);
}

// Slide #6
slide = presentation.getSlides().get_Item(5);

shapes = slide.getShapes();

shape = (IAutoShape) shapes.get_Item(1);

paragraphs = shape.getTextFrame().getParagraphs();

for (IParagraph paragraph : paragraphs) {
translateParagraph(paragraph);
}

presentation
.save(“Praesentation_bayHochschulen_BayBIDS_komprimiert96ppi-aspose.pptx”,
SaveFormat.Pptx);

}

public void translateParagraph(IParagraph paragraph) {

if (paragraph.getText().trim().isEmpty()) {
return;
}

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

IPortionFormatEffectiveData effectiveData = portion
.createPortionFormatEffective();

float fontHeight = effectiveData.getFontHeight();
boolean bold = effectiveData.getFontBold();
boolean italic = effectiveData.getFontItalic();
byte underline = effectiveData.getFontUnderline();

IPortion newPortion = new Portion(“T_” + portion.getText());

paragraph.getPortions().removeAt(0);
paragraph.getPortions().insert(0, newPortion);

newPortion.getPortionFormat().setFontHeight(fontHeight);

if (bold) {
newPortion.getPortionFormat().setFontBold(NullableBool.True);
}

if (italic) {
newPortion.getPortionFormat().setFontItalic(NullableBool.True);
}

newPortion.getPortionFormat().setFontUnderline(underline);
}

Thanks,
Zeljko

Hi Zeljko,


Thank you for getting back to us.

I have observed your comments and like to share with you that this issue has been reopened to investigate it further. We will notify you as soon as the issue will be fixed.

We are sorry for your inconvenience,