Issue with Font Size in a Table with Aspose.Slides for Java 24.9

Hi, we are using Aspose.slides for generating presentations. Currently we are using aspose.slides 17.7 version and planning to upgrade to 24.9 version
However while testing with the trail version for 24.9 , we observed that there is an issue with the font size in the tables rendered in the slides. Previously(with version 17.7) we didnt have this issue, but with the new version of aspose(24.9), the font size is too big and flowing outside the table
Want to know what is causing this and how to fix this, this is one of the blocker for us to move forward with this new version of library

@anilgudla,
Thank you for contacting free support.

Could you please share a code example and sample files to reproduce the issue? We will then investigate the case and help you.

Hi Andrey, thanks for response. I will have to check if I can share the code base due to compliance issues. But is there any change in terms of font size in tables renderering between 17.7 and 24.9 ? There is no change in our code but this issue is happening after the version change

@anilgudla,
Unfortunately, I cannot answer this question. We need more details to investigate the case. Please try to isolate the problem.

Hi @andrey
Its a significant effort to separate the logic to share. My initial questions are:

  • Are there any changes done in terms of font size for table data in the new version

@anilgudla,
Thank you for the clarifications. Indeed, from version 17.7 to 24.9, Aspose.Slides has gone through many updates and improvements, including those related to fonts and table rendering. However, there is no specifically documented change that would automatically increase the font size in tables. The issue you are encountering might stem from various factors:

  1. Changes to the text autofit mechanism
    In newer Aspose.Slides versions, the logic for autofitting text in table cells may have been revised or fixed. For instance, if previously text was truncated without enlarging the font, the library might now be adjusting the font size in a different manner.
  2. Installed fonts and font substitution
    If the font specified in the presentation is not available in your environment, font substitution may occur. Sometimes, a substituted font appears visually larger or has different metrics, causing text to overflow.
  3. Adjustments in measurement units or DPI
    Some releases might alter the way DPI or measurement units (points, pixels) are handled, which can impact how text is rendered.
  4. Changes in the behavior of specific methods or properties (e.g., TextFrame, PortionFormat, etc.)
    There might have been tweaks to default settings, style overrides, automatic wrapping, and so forth in newer versions.

Without a minimal code sample or at least a detailed description of your table-creation logic (e.g., which properties are used, whether autofit is enabled, if a specific font size is assigned, etc.), pinpointing the exact cause is difficult. We understand you might be unable to share your full code, but if possible, you could:

  • Extract a small snippet of the code that creates the table (using “dummy” data).
  • Provide an example of a problematic cell (which specific font and size are set, and what the resulting size is).
  • Attach a sample output slide (PDF or PPTX) showing the issue, along with information about how it is supposed to look.

This will help us reproduce the problem locally and identify what is causing the font size to increase. If it turns out to be a bug in the new version, we will certainly pass this information on to the development team for a fix.

We’ll be happy to assist further if you have any additional details.

Thanks @andrey.potapov
Adding a snippet

public void applyData(
            final ITable tableShape,
            final Optional<PowerPointTableDataConfig> tableDataConfig,
            final PowerPointTablePlaceholder tablePlaceholder,
            final PowerPointJsonReplacement data,
            final List<ReplacementLog> replacementLog) {
        // Fetch the table dimensions
        int rows = tableShape.getRows().size();
        int cols = tableShape.getColumns().size();

        // fetch the table config
        List<Map<String, String>> tableData = data.getKeyValueMap();
        Optional<Map<String, Integer>> columnConfig = tableDataConfig.isPresent()
                ? tableDataConfig.ofNullable(tableDataConfig.get().getColumnPositionConfig()) : Optional.empty();
        Optional<Map<String, Integer>> rowConfig = tableDataConfig.isPresent() ? Optional.ofNullable(tableDataConfig.get().getRowConfig()) : Optional.empty();
        Map<String, Integer> columnPositions = getColumnPositionMapping(columnConfig, tableData, cols);

        // convert beginning and ending from 1-based to 0-based
        int rowBegin = rowConfig.map(config -> config.get(PowerPointTableDataConfig.ROW_CONFIG_BEGINNING)).orElse(1) - 1;
        int rowEnd = rowConfig.map(config -> config.get(PowerPointTableDataConfig.ROW_CONFIG_ENDING)).orElse(rows) - 1;

        // Table data & config validation
        if (!validateTableDataAndConfig(rowBegin, rowEnd, rows, cols, columnPositions, tableData, tablePlaceholder, replacementLog)) {
            return;
        }

        // fill data into table
        IRowCollection allTableRows = tableShape.getRows();
        int actualRowEnd = Math.min(rowEnd, rowBegin + tableData.size() - 1);
        for (int currRowIdx = rowBegin; currRowIdx <= actualRowEnd; currRowIdx++) {
            IRow currRow = allTableRows.get_Item(currRowIdx);
            Map<String, String> dataForCurrRow = tableData.get(currRowIdx - rowBegin); // Get data for a row

            for (Map.Entry<String, String> cellData : dataForCurrRow.entrySet()) {
                if (columnPositions.containsKey(cellData.getKey())) {
                    // convert column-name-to-value mapping to column-index-to-value mapping
                    int cellColumn = columnPositions.get(cellData.getKey());
                    // Set the text string into cell by column idx
                    try {
                        currRow.get_Item(cellColumn).getTextFrame().setText(cellData.getValue());
                    } catch (Exception e) {
                        replacementLog.add(new ReplacementLog(ReplacementLog.LogType.ERROR, tablePlaceholder.toString(),
                                "Fail to find table value for tag " + tablePlaceholder.toString() + "\n"
                                        + "The table cell is at {row, col}: {" + currRowIdx + ", " + cellColumn + "}, and data is " + cellData.getValue() + "\n"
                                        + "with error message: \n" + e));
                    }
                }
            }
        }
    }

We have also observed that the behavior is inconsistent i.e., the font size looks good sometimes even with the new version. So at this point, we are not sure what is causing this inconsistency

@anilgudla,
Thank you for the code snippet. I am working on the issue and will get back to you soon.

Hi @andrey.potapov Thanks, any update you have ?

@anilgudla,
I need some time to check the issue. I will get back to you later.

@anilgudla,
Thank you for your patience. Unfortunately, I can’t use the sample code you provided to test the issue. Please try to isolate the problem and share the following:

  • sample presentation file
  • standalone code example