Hi,
after updating from slides 8.6.0 to 15.1.0 I am facing some problems when I try to add an rectangle text frame to a slide. TextFrame doesn’t have the following methods anymore:
textFrame.getX(), textFrame.getY(), textFrame.getHeight() , textFrame.getWidth(), setFitShapeToText(boolena value)
Here is my code, I replaced Rectangle as IShape:
Rectangle rectangle = slide.getShapes().addRectangle(textFrame.getX(), (textFrame.getY() + (textFrame.getHeight() * indice) + 10), textFrame.getWidth(), textFrame.getHeight());
rectangle.getLineFormat().setShowLines(false);
TextFrame rectangleTextFrame = rectangle.addTextFrame(variaveis.get(indice).getTexto());
rectangleTextFrame.setFitShapeToText(false);
What is the workaround for this issue?
Thank you.
Hi Thander,
I have observed your requirements and like to share that you need to add AutoShape of Rectangle type in new API to serve the purpose. Please visit the following documentation link to see how to add Rectangle shape using new API.
Many Thanks,
Hi,
the documentation link you sent me helped me solve some doubts but I still dont know how to get height, width, x and y from textFrame.
Thank you.
Hi Thander,
The height, width, X and Y coordinates of text frame as same as that of added auto shape. You can use Ashp.getX(), Ashp.getY(), Ashp.getWidth() and Ashp.getHeight() methods to get desired results. The Ashp here is IAuotShape object. Also, the values X, Y can be given from 0,0 to 720,540, where later is the maximum slide size and bottom right corner of slide.
Many Thanks,
I had the following code:
private void adicionaTextFrameAoSlide(ISlide slide, ITextFrame textFrame, List variaveis, int indice, Presentation pres) throws Exception{
Rectangle rectangle = slide.getShapes().addRectangle(textFrame.getX(), (textFrame.getY() + (textFrame.getHeight() * indice) + 10), textFrame.getWidth(), textFrame.getHeight());
and with the information provided, I did the following:
IAutoShape shape = (IAutoShape) textFrame;
IAutoShape rectangle = slide.getShapes().addAutoShape(ShapeType.Rectangle, shape.getX(), (shape.getY() + (shape.getHeight() * indice) + 10), shape.getWidth(), shape.getHeight());
Did I do it right?
Hi Thander,
No, you are doing wrong. You are creating a shape object and using its value for setting X, Y, Width and Height. You need to give the values of X,Y, Width and Height when you are creating a shape even if you were working with old API. Please visit the following link for your further elaboration.
Many Thanks,
In the link you gave me, the parameters are given statically:
IAutoShape ashp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 150, 75, 150, 50);
I whant to get this parameters (X, Y, Height and Width) more dynamically, like I used to do in slides version 8.6.0. Something like this:
IAutoShape rectangle = slide.getShapes().addAutoShape(ShapeType.Rectangle, textFrame.getX(), (textFrame.getY() + (textFrame.getHeight() * indice) + 10), textFrame.getWidth(), textFrame.getHeight());
Is there anyway I can get the height, width x and y coordnates from the text frame?
Thank you.
I am trying to do the samething.
I cant get the textFrame coordinates from a ITextFrame object before add autoShape.
Hi Thander,
I have observed the same inquiry by you in another forum thread as well and have shared my feedback over this link. You need to set the position of shape and once you add a shape then you add text frame to that if that shape is of IAutoShape. Its not like that you have a TextFrame and you use its position to create a shape. I hope this will clarify the concept.
Many Thanks,