Hi Michael,
Thank you for your interest in Aspose.Slides.
The issues you have found earlier (filed as SLIDESNET-36886) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
(4)
Now, Aspose.Slides API provides the provision to access the actual coordinates on slide for any text frame paragraph or its respective portions. In the following example, you can use verify the usage of the feature. We have also attached sample presentation for your convenience too.
public static void GetParagraphCoordinates()
{
// The path to the documents directory.
string dataDir = @"C:\Aspose Data\";
// Instantiate a Presentation object that represents a presentation file
using (Presentation presentation = new Presentation(dataDir + "TestText.pptx"))
{
IAutoShape shape = (IAutoShape)presentation.Slides[0].Shapes[0];
var textFrame = (ITextFrame)shape.TextFrame;
RectangleF rect = ((Paragraph)textFrame.Paragraphs[0]).GetRect();
Console.WriteLine("The following shows the paragraph's actual coordinates on slide");
Console.WriteLine(String.Format("Paragraph Text: {4} has coordinates (X: {0}, Y: {1}), Width: {2} and Height{3}", rect.X, rect.Y, rect.Width, rect.Height, ((Paragraph)textFrame.Paragraphs[0]).Text));
}
}
public static void GetPortionCoordinates()
{
string dataDir = @"C:\Aspose Data\";
using (Presentation presentation = new Presentation(dataDir + "TestText.pptx"))
{
IAutoShape shape = (IAutoShape)presentation.Slides[0].Shapes[0];
var textFrame = (ITextFrame)shape.TextFrame;
foreach (var paragraph in textFrame.Paragraphs)
{
Console.WriteLine("The following shows the coordinates for all the portions inside paragraph");
foreach (Portion portion in paragraph.Portions)
{
var rect = portion.GetRect();//.GetCoordinates();
//Console.Write(Environment.NewLine + "Corrdinates X =" + point.X + " Corrdinates Y =" + point.Y);
Console.WriteLine(String.Format("Portion Text: {4} has coordinates (X: {0}, Y: {1}), Width: {2} and Height{3}", rect.X, rect.Y, rect.Width, rect.Height, portion.Text));
}
}
}
}
TestText.zip (24.0 KB)