I recently upgraded to Aspose.Slides 1.9.1 and PowerPoint 2007 and I am now having an issue with tables. I have attached a file that shows the problem, and my description will be referring to it. In the template, my table starts off as 2 rows, with tags in the cells. The second row is repeated numerous times depending on the data set. The first and fourth (Trend) columns have Shapes from the template drawn onto the slide based on the location of the cell. I know the shapes aren’t actually part of the table, but they should give the appearance that they do, and this has always worked with previous versions of Aspose.Slides and PowerPoint. As you can see in the attached example, there is now a problem with the alignment. The problem seems to happen anytime the main column of text almost fills the entire column but does not wrap to the next line. And if you enter a carriage return after the text in the middle column of the first row all of the images are properly aligned. Do you have any idea what could be happening and what I could do about it? Thank you so much for your assistance.
Hello,
Please provide your source code. I need to examine how you are positioning the shapes and text. You should use cell itself to place text NT instead of using a separate textframe for it and you can also then align it horizontally as well as vertically. It will save you from repositioning them every time.
Thank you for the reply. I unfortunately cannot send the code for security reasons. We cannot just place text into the cell for all cases, such as the diamonds in the far left column. We are using the location of the cell to place the shapes. But it seems like the table is resizing after it has been completely written to the slide, causing rows to shrink in height (fitting the row height to the text). Is this behavior that you know about and is expected. And if I set the row height to a very small value after each text insertion, would that guarantee that the row is resized to its smallest possible value at that point, thus eliminating the problem of table row resizing after the table is completed? Thanks.
Hello,
In order to place them correctly, you need to calculate their position using the X, Y, Width and Height of the cells. In most case, X position will not change, so you need to calculate only the Y position
For example, if you want to place a diamond in second row and first column, you can calculate its position something like this.
Cell cl = tbl.getCell(0, 1);
int x = cl.getTextFrame().getX();
int y = cl.getTextFrame().getY();
int height = cl.getTextFrame().getHeight();
//Calculate Y position
int diamondPicY = y + height / 2; //the middle position
dimondPic = dimondPic + OFFSET; //where offset is some negative or positive constant number to adjust its position