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

Free Support Forum - aspose.com

Problem with text in link

I have a problem with one presentation, in presentation is one big link, and size of that link is different than size of text of that link. The only text in presentation is text in link. this test is workin fine with lot of other presentations with links but this file is making problem.
I will send you test class and ppt file.

PptLinkTest
-------------------
import java.io.FileNotFoundException;
import org.junit.Test;

import com.aspose.slides.Link;
import com.aspose.slides.PptException;
import com.aspose.slides.Presentation;
import com.aspose.slides.Shape;
import com.aspose.slides.Slide;
import com.aspose.slides.Slides;

public class PptLinkTest {

@Test
public void testing() throws PptException, FileNotFoundException{

Presentation presentation = new Presentation(“d:/Merck Sigma Awarenes.ppt”);

Slides slides = presentation.getSlides();

Slide slide = slides.get(0);

Shape shape = slide.getShapes().get(1);

String text = shape.getTextFrame().getText();

Link link = shape.getTextFrame().getLinks().get(0);

String textLink = text.substring(link.getBegin(), link.getEnd());

}
}

error:
java.lang.StringIndexOutOfBoundsException: String index out of range: 116 (lenght of text is 115)

Please, can you check this test and see if error is aspose issue!


Hi Branko,

I have worked with the presentation file shared by you and have been able to observe the issue shared by you. An issue with ID 24283 has been created in our issue tracking system to further investigate and resolve the issue. This thread has also been linked with the issue, so that you may be automatically notified, once the issue is resolved.

We are sorry for your inconvenience,

Hello Aspose team,

I have another problem with links in aspose.slides. Maybe it is the same as this earlier problem, but I think it is double error here in this ppt file. First here is the test class:
===================================
package org.gs4tr.filters3.msoffice.ppt.test;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.junit.Test;

import com.aspose.slides.Link;
import com.aspose.slides.Links;
import com.aspose.slides.Presentation;
import com.aspose.slides.Shape;
import com.aspose.slides.Shapes;
import com.aspose.slides.Slide;
import com.aspose.slides.Slides;
import com.aspose.slides.TextFrame;

public class TestLinksptt {

@Test
public void testLink() throws IOException {

String path = “d:/5Z2W384dyt.ppt”;

InputStream testStream = new FileInputStream(path);

Presentation presentation = new Presentation(testStream);

Slides slides = presentation.getSlides();

Slide slide = slides.get(11);

Shapes shapes = slide.getShapes();

Shape shape = shapes.get(6);

TextFrame textFrame = shape.getTextFrame();

Links links = textFrame.getLinks();

Link link = links.get(0);

int begin = link.getBegin();

int end = link.getEnd();

}
}
======================================

Problem is thet text frame get link that I think is not link at all (it’s not correct text in link). Second problem is the link.getbegin returns -1.

Please check this file and test, and let me know if it is the same problem or different as old one.

Thanks for checking.
Branko

Hi Branko,

I have worked with the code snippet shared by you and have observed the inconsistency in the code snippet. Actually, you are trying to access the slide in slides collection at index 11, which never gives the guarantee that this slide will be at the same position in presentation it self. I have modified the code snippet for you and it gets the right text now. However, the link.getBegin() still returns -1. An issue with ID 25773 has been created in our issue tracking system to investigate and resolve this issue. This thread has also been linked with the same issue so that you may be automatically notified, once the issue is resolved.

public static void testLink() throws IOException {

String path = "d:/5Z2W384dyt.ppt";

InputStream testStream = new FileInputStream(path);

Presentation presentation = new Presentation(testStream);

Slides slides = presentation.getSlides();

// Slide slide = slides.get(11);
Slide slide =presentation.getSlideByPosition(12);

com.aspose.slides.Shapes shapes = slide.getShapes();

com.aspose.slides.Shape shape = shapes.get(0);

TextFrame textFrame = shape.getTextFrame();
String text=textFrame.getText();

Links links = textFrame.getLinks();

Link link = links.get(0);
String hyperText=link.getExternalHyperlink();

int begin = link.getBegin();

int end = link.getEnd();

}

We are sorry for your inconvenience,

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


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