Shape Rectangle for Cell Textframe is not consistent

I have an application I’m designing for a client, the issue I’m having is that he wants the slides to have notes(comments) related to the data being displayed. I have setup the notes to render within the Cell, unfortunately to my dismay, the Cell does not have a shape rectangle I can access, and using


Cell.BottomRightCell and Cell.TopLeftCell just return the origin point of the slide. 0,0…

So I found that the Textframes for the Cells do indeed have a proper X,Y location, but these points are not consistent across the table, as it gets further to the bottom, it seems to be pushed off by an offset.


Here’s my code, the -400 is for the offset of the Comment box.
foreach (FormattedCell fc in FormattedCells)
{
Cell cell = Table.GetCell(fc.column, fc.row);
if (fc.comment != null && fc.comment != "") {
Point commentPoint = new Point(cell.TextFrame.ShapeRectangle.Right - 400/*comment size offset*/, cell.TextFrame.ShapeRectangle.Bottom);
CommentAuthor[] commentAuthor = m_presentation.CommentAuthors.FindByName("Notes");
if (commentAuthor.Length == 0)
commentAuthor = new CommentAuthor[1] { m_presentation.CommentAuthors.AddAuthor("Notes") }; m_presentation.GetSlideById(Table.ParentSlide.SlideId).SlideComments.AddComment(commentAuthor[0], "Notes ", fc.comment, DateTime.Now, commentPoint);
} }

So I’ve figured out what the issue here was. So the Textframe is actually larger than the Cell. So the X,Y positions are going outside of the cell shape… Unfortunately your Cell.TopLeftCell and Cell.BottomRightCell point coordinates don’t actually work for the document position, and therefore I don’t really see a good solution here until you fix your Cell.TopLeftCell and Cell.BottomRightCell methods.

Hi Mike,

Thank you for the details.

To get further understanding of your issue and reproduce at our end, I would request you to share your complete code and generated file with us. We will further look into your issue and get back to you soon.

Thanks & Regards,

I've attached a ppt to demonstrate the problem. The values returned from TopLeftCell and BottomRightCell aren't document based, not sure what their reference is, but it seems rather useless to have them return 1,0... 0,0... and other such minimal values that are not based off document position.

test code, C#


for (int row = 0; row < Table.RowsNumber; row++)
{
for(int col = 0; col < Table.ColumnsNumber; col++)
{
Cell cell = Table.GetCell(col,row);
System.Diagnostics.Debug.WriteLine("TopLeftCell values:");
System.Diagnostics.Debug.WriteLine("X:"+cell.TopLeftCell.X+"Y:"+cell.TopLeftCell.Y);
System.Diagnostics.Debug.WriteLine("BottomRightCell values:");
System.Diagnostics.Debug.WriteLine("X:"+cell.BottomRightCell.X+"Y:"+cell.BottomRightCell.Y);
}
}

Hi Mike,

Thanks for your inquiring Aspose.Slides.

I have observed the requirements shared by you and like to share that the cell text frame position is actually w.r.t to table. I suppose, you wish to get the cell position w.r.t slide. I suggest you to please try using the following sample code on your end to serve the purpose.

double cellX = pptTable.X + cell.TextFrame.X;
double cellY = pptTable.Y + cell.TextFrame.Y;


The above code will give you the cell position in accordance to slide rather than Table. I hope this will be helpful. Please share, if I may help you further in this regard.

Many Thanks,