Text Format Options of Table Cells Are Incorrect

Use the following code, I can’t get the right value of text in table
image.png (10.3 KB)
78ddccfea733f7a6b89a23dc9c0ef40.png (65.3 KB)
table.zip (31.9 KB)

import com.aspose.slides.*;

public class TestConvert {

public static void main (String[] args) throws Exception {

    Presentation presentation = new Presentation("table.pptx");

    IShape shape = presentation.getSlides().get_Item(0).getShapes().get_Item(0);

    if (shape instanceof ITable) {

        ITable table = (ITable) shape;

        IColumnCollection columns = table.getColumns();
        IRowCollection rows = table.getRows();

        for (int i = 0; i < columns.size(); i++) {
            IColumn column = columns.get_Item(i);
            for (int j = 0; j < rows.size(); j++) {
                ICell cell = column.get_Item(j);
                byte strikethroughType = cell.getTextFrame().getTextFrameFormat().getEffective().getTextStyle().getDefaultParagraphFormat().getDefaultPortionFormat().getStrikethroughType();
                byte fontUnderline = cell.getTextFrame().getTextFrameFormat().getEffective().getTextStyle().getDefaultParagraphFormat().getDefaultPortionFormat().getFontUnderline();
                boolean fontBold = cell.getTextFrame().getTextFrameFormat().getEffective().getTextStyle().getDefaultParagraphFormat().getDefaultPortionFormat().getFontBold();
                float fontHeight = cell.getTextFrame().getTextFrameFormat().getEffective().getTextStyle().getDefaultParagraphFormat().getDefaultPortionFormat().getFontHeight();
                boolean fontItalic = cell.getTextFrame().getTextFrameFormat().getEffective().getTextStyle().getDefaultParagraphFormat().getDefaultPortionFormat().getFontItalic();
                int alignment = cell.getTextFrame().getTextFrameFormat().getEffective().getTextStyle().getDefaultParagraphFormat().getAlignment();
                byte fillTypeText = cell.getTextFrame().getTextFrameFormat().getEffective().getTextStyle().getDefaultParagraphFormat().getDefaultPortionFormat().getFillFormat().getFillType();
                byte fillTypeCell = cell.getCellFormat().getFillFormat().getEffective().getFillType();
            }
        }


    }
}

}

@iyyb930,

It seems you are using Aspose.Slides API, so I am moving your thread to respective forum. One of our fellow colleagues from Aspose.Slides team will assist you soon there.

@iyyb930,
Thank you for the issue description.

I’ve reproduced the problem with the text format of table cells and added a ticket with ID SLIDESJAVA-38687 in our issue tracking system. Our development team will investigate this case. You will be notified when the issue is resolved.

@iyyb930,
You are reading text format options from default settings. If you read the options from text portions, you will have the correct values. The following code snippet shows you how to do it:

var firstParagraph = cell.getTextFrame().getParagraphs().get_Item(0);
var firstPortion = firstParagraph.getPortions().get_Item(0);
var portionFormat = firstPortion.getPortionFormat().getEffective();
var fontHeight = portionFormat.getFontHeight();

More examples: Manage Cells, Text Formatting
API Reference: IPortionFormatEffectiveData interface