Free Support Forum - aspose.com

Export range to html with merged cells -> not rendered correctly

I am trying to export a range to HTML. The range is defined via the following name: DR_PUBv2__1618237080.
The actual range is F2:H3. (see pic).

static void Main(string[] args)
{
var dataDir = @“some_dir”;

// Creating a file stream containing the Excel file to be opened
using (var fstream = new FileStream(dataDir + "local1.xlsx", FileMode.Open))
{
    // Instantiate a Workbook object that represents the existing Excel file
    var workbook = new Workbook(fstream);

    var range = workbook.Worksheets.GetRangeByName("DR_PUBv2__1618237080");

    workbook.Worksheets[0].PageSetup.PrintArea = range.Address;
    
    // Save the Excel file
    workbook.Save(dataDir + "1.html", new HtmlSaveOptions
    {
        ExportImagesAsBase64 = true,
        ExportPrintAreaOnly = true,
        ExportHiddenWorksheet = false,
        ExportActiveWorksheetOnly = true
    });
}

}

The issue is following: I am getting only the column H rendered. The columns F and G are ignored. (see pic).
This behavior happens only when there is a merged cell left to the range I am trying to export. In this case, columns D and E. If I unmerge them - I am getting the correct output.
I am attaching the sample file and very simplified source code.
AsposeConsole.zip (3.7 KB)
file_and_output.zip (9.9 KB)

image.png (8.2 KB)

image.png (7.7 KB)

  • When I try to export it to an image - it works correctly.
  • Happens in both, .NET and Java.
  • Aspose version 21.3.

@eyalmolad,

Please notice, I am able to reproduce the issue as you mentioned by using your sample code with your template file. I found when exporting a range (with merged cells) to HTML is not rendered correctly. I have logged a ticket with an id “CELLSNET-47981” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@eyalmolad,

Please try the latest fix 21.4.4.
Aspose.Cells21.4.4 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.4.4 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.4.4 For .NetStandard20.Zip (5.5 MB)

Thanks. I can confirm this works on the sent version. :slight_smile:
Is the fix available on Java also?
Thanks

@eyalmolad,

Good to know that your issue is resolved by the new fix.

Could you please try our latest Java fix:
aspose-cells-21.4.6-java.zip (7.3 MB)

and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-47981) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao