Free Support Forum - aspose.com

Problem with poritons

Hi,

When you collect portions from presentation test1.ppt you can see that contains just one portion. Collected portion contains all text from shape, including one symbol. Is this bad behavior or not? You can test this with following code:

public class RunTest {

public static void main(String args[]) throws Exception {
Presentation presentation = new Presentation(“d:/test/test1.ppt”);

Slide slide = presentation.getSlideByPosition(1);

Shapes shapes = slide.getShapes();

List portionList = new ArrayList();

iterateShapes(shapes, portionList);

Portion portion = portionList.get(0);

System.out.println(portion.getText());
}

private static void iterateShapes(Shapes shapes, List portionList) {
if (shapes != null) {
for (int shapeIndex = 0; shapeIndex < shapes.size(); shapeIndex++) {

Shape shape = shapes.get(shapeIndex);

if (shape instanceof GroupShape) {
GroupShape groupShape = (GroupShape) shape;

iterateShapes(groupShape.getShapes(), portionList);

continue;
}

if (shape instanceof TextFrame) {
TextFrame textFrame = (TextFrame) shape;

Paragraphs paragraphs = textFrame.getParagraphs();

iterateParagraphs(paragraphs, portionList);

continue;
}

if (shape.getTextFrame() != null) {
TextFrame textFrame = shape.getTextFrame();

Paragraphs paragraphs = textFrame.getParagraphs();

iterateParagraphs(paragraphs, portionList);
}
}
}
}

private static void iterateParagraphs(Paragraphs paragraphs,
List portionList) {
if (paragraphs == null) {
return;
}

for (int paragraphIndex = 0; paragraphIndex < paragraphs.size(); paragraphIndex++) {
Paragraph paragraph = paragraphs.get(paragraphIndex);

Portions portions = paragraph.getPortions();

for (int portionIndex = 0; portionIndex < portions.size(); portionIndex++) {
portionList.add(portions.get(portionIndex));
}

}
}
}

test1.ppt is in attachment.

Thanks,

Zeljko

Hi,

Can you inform me about progress in this post, please?

Thanks,

Zeljko

Hi Zeljko,

Thanks for your interest in Aspose.Slides.

Well, in the current design, one Portion is meant to hold the text in a Paragraph with similar text formatting properties in that Paragraph. Can you please share your exact requirement for a portion having text that holds symbols? The character code range for SymbolFont is 0xF000 - 0xF0FF.

Hi,

If you get code of arrow in attached presentation you will get 61664 as character value. Is it symbol?
It is in range of 0xF000 - 0xF0FF.

Thanks,

Zeljko

Hi Zeljko,

Thanks for your interest in Aspose.Slides.

Yes, I think so. For more discussion on similar topic in a separate thread, please visit this thread.

Thanks and Best Regards