Hi,
In the attached file, there’s a table with some merged cells. It looks like Aspose.Slides for Java does not recognize if cells are merged, and prints the cell content twice.
Here’s the code I use:
String path = “Presentation1.pptx”;
Presentation presentation = new Presentation(path);
ISlide slide = presentation.getSlides().get_Item(0);
ITable table = (ITable) slide.getShapes().get_Item(1);
int rowsNumber = table.getRows().size();
int columnsNumber = table.getColumns().size();
for (int rowIndex = 0; rowIndex < rowsNumber; rowIndex++) {
for (int columnIndex = 0; columnIndex < columnsNumber; columnIndex++) {
ICell cell = table.get_Item(columnIndex, rowIndex);
ITextFrame textFrame = cell.getTextFrame();
if (textFrame != null) {
System.out.println(“Cell[” + rowIndex + ", " + columnIndex + "]: " + textFrame.getText());
}
}
}
Here’s the output:
Cell[0, 0]: Column A
Cell[0, 1]: Column B
Cell[0, 2]: Column C
Cell[1, 0]: Row 1
Cell[1, 1]: Merged in Row 1
Cell[1, 2]: Merged in Row 1
Cell[2, 0]: Row 2
Cell[2, 1]: Column B in Row 2
Cell[2, 2]: Column C in Row 2
Cell[3, 0]: Row 3
Cell[3, 1]: Merged in Row 3
Cell[3, 2]: Merged in Row 3
Cell[4, 0]: Row 4
Cell[4, 1]: Column B in Row 4
Cell[4, 2]: Column C in Row 4
Cells marked with the red color are being printed twice.
Can you check this?
Thanks,
Zeljko
Zeljko