Extra Blank Column Appears in Pivot Table HTML Export

Summary

When converting an Excel workbook with a pivot table to HTML using Aspose.Cells for Node.js via Java, an unexpected blank column is appearing after the pivot table in the generated HTML output.

Environment

  • Library: Aspose.Cells for Node.js via Java
  • Platform: Node.js

Description

I am using Aspose.Cells to convert an Excel file containing a pivot table to HTML format. The pivot table in the original Excel file is positioned starting at cell B3 (after one entire row and two entire columns). However, when the workbook is exported to HTML using HtmlSaveOptions, an extra blank column is being added after the pivot table, which is not present in the original Excel file.

Expected Behavior

The HTML output should match the Excel layout exactly, with the pivot table starting at cell B3 and no additional blank columns appearing after the table content.

Actual Behavior

An extra blank column is visible after the pivot table in the generated HTML file, causing layout inconsistencies.

Code Implementation

try {
    workbook = new aspose.cells.Workbook(tempExcelFile);
    LOGGER.info(
        `[processReportWithAspose] Aspose Workbook loaded | request_id=${request_id}`
    );
} catch (wbErr) {
    LOGGER.error(
        `[processReportWithAspose] Failed to load workbook | request_id=${request_id}`,
        wbErr
    );
    return null;
}

const htmlAsposeTempFile = path.join(
    process.cwd(),
    `${ReportConstants.HTML_ASPOSE_PREFIX}${crypto.randomUUID()}.html`
);

saveWorkbookAsHtml(workbook, htmlAsposeTempFile);

HTML Export Function

function saveWorkbookAsHtml(workBook, fileName) {
    const sheets = workBook.getWorksheets();
    const sheetcount = sheets.getCount();
    
    // Hide all sheets except pivot sheet
    for (let i = 0; i < sheetcount; i++) {
        const sheet = sheets.get(i);
        if (sheet.getName() !== CONSTWORKSHEET.PIVOT) {
            sheet.setVisible(false);
        } else {
            // Refresh and calculate pivot tables
            const pivots = sheet.getPivotTables();
            const pivotcount = pivots.getCount();
            for (let j = 0; j < pivotcount; j++) {
                const pivot = pivots.get(j);
                pivot.refreshData();
                pivot.calculateData();
            }
        }
    }
    
    workBook.calculateFormula();
    
    // Configure HTML export options
    const saveOptions = new aspose.cells.HtmlSaveOptions();
    saveOptions.setExportActiveWorksheetOnly(true);
    saveOptions.setPresentationPreference(true);
    saveOptions.setExportGridLines(true);
    
    workBook.save(fileName, saveOptions);
}

ExtraColumnIssue.zip (166.8 KB)

Attachments

  • Original Excel file (with pivot table)
  • Generated HTML output file (showing the extra blank column)

@amjad.sahi can you please help

Hi @KarthikMunjam ,

I have tested your scenario using Aspose.Cells for Java 26.1, there is no extra blank column appears after the pivot table.
I have attached it here for your reference. output.zip (2.4 KB)

@Eric.wang I checked this in 26.1 as well—it’s still happening.
Note ::
Issue wont reproduce on local machine,
but it consistently reproduces in QA and Prod environments.

@KarthikMunjam
Could you list info on your QA and Prod environments?
And please check version with CellsHelper.getversion(); on your QA.

@KarthikMunjam ,

To rule out whether the behavior originates from the HTML conversion process itself, could you please help verify the following:

Temporarily disable pivot refresh and formula recalculation, for example:
comment out pivot.refreshData()
comment out pivot.calculateData()
comment out workBook.calculateFormula()

Export to HTML again in QA or Prod enviroments.

console.log(
‘Aspose version:’,
aspose.cells.CellsHelper.getVersion()
);
Result ::
Aspose version: 26.1.0

still the same issue @Eric.wang ,
ExtraColumnIssue-New.zip (173.0 KB)

@KarthikMunjam
It’s so strange . We can not reproduce your issue.
Could you list info on your QA and Prod environments?

what info do you need from QA and Prod ?

@KarthikMunjam
Os, java version, nodejs version

Os, java version, nodejs version

Code

try {
    // Aspose version
    LOGGER.info(
        'Aspose version:',
        aspose.cells.CellsHelper.getVersion()
    );

    // Node.js version
    LOGGER.info(`Node.js version: ${process.version}`);

    // OS details
    LOGGER.info(`OS: ${os.type()} ${os.release()} ${os.arch()}`);

    // Aspose Cells version
    LOGGER.info(
        `Aspose Cells version: ${aspose.cells.CellsHelper.getVersion()}`
    );

    // Java version
    const { execSync } = require('child_process');
    try {
        const javaVersion = execSync('java -version 2>&1', {
            encoding: 'utf-8'
        });
        LOGGER.info(`Java version:\n${javaVersion}`);
    } catch (error) {
        LOGGER.warn('Java is not installed or not in PATH');
    }

    workbook = new aspose.cells.Workbook(tempExcelFile);
    LOGGER.info(
        `[processReportWithAspose] Aspose Workbook loaded | request_id=${request_id}`
    );
} catch (wbErr) {
    LOGGER.error(
        `[processReportWithAspose] Failed to load workbook | request_id=${request_id}`,
        wbErr
    );
    return null;
}

Output

Node.js version      : v20.19.4
OS                  : Linux 6.1.147-172.266.amzn2023.aarch64 arm64
Aspose Cells version: 26.1.0
Java version        :
  openjdk version "17.0.18" 2026-01-20
  OpenJDK Runtime Environment (build 17.0.18+8-Debian-1deb12u1)
  OpenJDK 64-Bit Server VM (build 17.0.18+8-Debian-1deb12u1, mixed mode, sharing)

@Eric.wang / @amjad.sahi please help here

@KarthikMunjam,

Thank you for sharing the QA/Production environment details. We will work on setting up the environment to evaluate and test the issue. We will get back to you soon.

okay , once this issue identified , please let me know

@KarthikMunjam

Sure, we will give feedback soon when we get some findings.

@amjad.sahi , @johnson.shi whats the update on this ?

@KarthikMunjam

We have tested your case with the similar environment, unfortunately, we cannot reproduce the issue yet. It is hard for us to guess the possible reason for such kind of strange issue too. Would you please compare your locale machine with the QA and Prod to see whether there are some possible differences that may cause issue? Such as the for those info(OS, JDK…) you provided?

And please call Cells.getMaxDisplayRange() before and after the saving process and output the result so we can check whether the range needs to be output has changed.