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

Free Support Forum - aspose.com

Bug with merged cells?

Here is what appears to be a bug with callout positioning when the table has merged cells:
private void process(int col, int row){
PresentationEx presEx = new PresentationEx(“template.pptx”);

SlidesEx slides = presEx.getSlides();

SlideEx slide = slides.get(0);
int idx = slide.getShapes().addAutoShape(
ShapeTypeEx.CALLOUT_WEDGE_ROUND_RECTANGLE, 150, 150, 50, 50);
AutoShapeEx pptxAutoShape = (AutoShapeEx) slide.getShapes().get(idx);
TableEx table = (TableEx) slide.getShapes().get(0);

table.mergeCells(table.get(0, 0), table.get(1, 0), false);
table.mergeCells(table.get(0, 0), table.get(2, 0), false);
table.mergeCells(table.get(0, 0), table.get(3, 0), false);
table.mergeCells(table.get(0, 0), table.get(4, 0), false);
table.mergeCells(table.get(0, 0), table.get(5, 0), false);

table.mergeCells(table.get(2, 1), table.get(3, 1), false);

table.get(0, 0).getTextFrame().setText(“Merged Cells”);

int iDesiredCol, iDesiredRow, iColWidth = 0, iRowHeight = 0;
iDesiredCol = col;
iDesiredRow = row;

iColWidth = (int) table.getX();
iRowHeight = (int) table.getY();

CellEx c2 = table.get(iDesiredCol, iDesiredRow);
iColWidth = (int) table.getX() + (int) c2.getOffsetX();
iRowHeight = (int) table.getY() + (int) c2.getOffsetY();
iRowHeight -= pptxAutoShape.getHeight();
pptxAutoShape.setX((float) iColWidth);
pptxAutoShape.setY((float) iRowHeight);

This code works fine as long as the desired column is greater than the merged cell when the desired row is 0. IOW, if I call the code with col = 7 and row = 0, the callout appears at the correct place. If I use col = 5 and row = 0, however, the callout appears too far to the left, because col = 5 falls within the area of the merged cell at (0,0).

Dear Ken,

I have verified the issue and I don't feel that its a problem with Aspose.Slides for Java. Actually, you have merged the cell(5,0) with cell(0,0) and it is now denoted by cell(0,0) after merging. So, when you cell(5,0), it actually gives the reference position of cell(0,0) as it has been merged with it.

Thanks and Regards,

OK, your explanation makes sense. As we used to say when I was with IBM, “functions as designed.”