We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

RIght Border missing when HorizontalAlignment is set to "Fill"

Hi Team,

I noticed that in an Excel Workbook, if we apply Fill Horizontal Alignment to a cell, and add long text to the cell, which wouldn’t fit in it, the right border of the cell goes missing in .tiff format of the excel.

Sample reproducer function

      static void HorizontalAlignmentFillBug()
    {
        var workbook = new Workbook();
        workbook.Worksheets.Add();
        var worksheet = workbook.Worksheets[0];
        worksheet.Outline.SummaryRowBelow = false;
        for (int i = 1; i <= 9; ++i)
        {
            worksheet.Cells[$"A{i}"].PutValue($"Row{i}");
            Cell cell = worksheet.Cells[$"A{i}"];
            Style borderStyle = cell.GetStyle();
            borderStyle.SetBorder(BorderType.BottomBorder, CellBorderType.Thin, Color.Black );
            borderStyle.SetBorder(BorderType.TopBorder, CellBorderType.Thin, Color.Black);
            borderStyle.SetBorder(BorderType.LeftBorder, CellBorderType.Thin, Color.Black);
            borderStyle.SetBorder(BorderType.RightBorder, CellBorderType.Thin, Color.Black);
            cell.SetStyle(borderStyle);
        }

        //Setting A3 as the cell with HorizontalALignment as "Fill"
        Cell cellOne = worksheet.Cells["A3"];
        cellOne.PutValue("This is the filled cell");
        Style style = cellOne.GetStyle();
        style.HorizontalAlignment = TextAlignmentType.Fill;
        cellOne.SetStyle(style);
        workbook.FileFormat = FileFormatType.TIFF;
        workbook.Save("HorizontalAlignmentFillBug.tiff");
    }

Expected output
image.png (3.1 KB)

Generated Output
image.png (19.6 KB)

@dfactset,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46966 – Right Border missing when HorizontalAlignment is set to “Fill”
1 Like

Sample reproducer function for PDF.

    static void HorizontalAlignmentFillBug()
    {
        var workbook = new Workbook();
        workbook.Worksheets.Add();
        var worksheet = workbook.Worksheets[0];
        worksheet.Outline.SummaryRowBelow = false;
        for (int i = 1; i <= 9; ++i)
        {
            worksheet.Cells[$"A{i}"].PutValue($"Row{i}");
            Cell cell = worksheet.Cells[$"A{i}"];
            Style borderStyle = cell.GetStyle();
            borderStyle.SetBorder(BorderType.BottomBorder, CellBorderType.Thin, Color.Black );
            borderStyle.SetBorder(BorderType.TopBorder, CellBorderType.Thin, Color.Black);
            borderStyle.SetBorder(BorderType.LeftBorder, CellBorderType.Thin, Color.Black);
            borderStyle.SetBorder(BorderType.RightBorder, CellBorderType.Thin, Color.Black);
            cell.SetStyle(borderStyle);
        }

        //Setting A3 as the cell with HorizontalALignment as "Fill"
        Cell cellOne = worksheet.Cells["A3"];
        cellOne.PutValue("This is the filled cell");
        Style style = cellOne.GetStyle();
        style.HorizontalAlignment = TextAlignmentType.Fill;
        cellOne.SetStyle(style);
        workbook.FileFormat = FileFormatType.Pdf;
        workbook.Save("HorizontalAlignmentFillBug.pdf");
    }

The issue persists even for the situation when we save the file as a PDF. Please take a note of that as well.

@dfactset,
We have noted this feedback and will update you in this topic once we will have some news for you.

@dfactset,
Please try our latest version/fix: Aspose.Cells for .NET v19.10.3 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells19.10.3 For .Net2_AuthenticodeSigned.Zip (5.0 MB)
Aspose.Cells19.10.3 For .Net4.0.Zip (5.0 MB)

Thanks.
This Aspose update fixed the issue.
When will the release version be available?

@dfactset,

Good to know that your issue is sorted out by the new fix/version. You may use this fix as an official release as it contains all the functionality of Aspose.Cells for .NET v19.10 (full fledged) till this fix. The fix is fully tested regarding QA. The hot fixes are posted into forums and are safe to use in production server. However, if you still want to use official release of the product, you have to wait for 2/3 weeks as the next official release (e.g Aspose.Cells for .NET v19.11) is scheduled to be published (both on Downloads module and Nuget repos.) in the third week of November 2019 (the date is not finalized as releases are published when ready). You will also be automatically notified in the thread once the next release is published.

The issues you have found earlier (filed as CELLSNET-46966) have been fixed in Aspose.Cells for .NET v19.11. This message was posted using Bugs notification tool by Amjad_Sahi