Missing Borderlines on merged cells after excel export

Posted by: info on 14 August 2023, 11:15 pm EST

  • Posted 14 August 2023, 11:15 pm EST - Updated 14 August 2023, 11:20 pm EST

    I am migrating an application from .NET 4.x to .NET Core 6.x. I am using the same version of Spread (16.2.0.1475) for both applications. Within the application screens, the Spread worksheets look identical, but when exporting to MS Excel, there are problems with the borders on merged cells (see figure). This is despite the fact that the program code is exactly the same. The Excelexport happens in both cases with

    Spread1.SaveExcel(Filename, FarPoint.Excel.ExcelSaveFlags.UseOOXMLFormat | FarPoint.Excel.ExcelSaveFlags.SaveAsViewed);

    Can anyone help me here?

  • Posted 15 August 2023, 7:56 pm EST

    Hi Helmut,

    Unfortunately, we could not replicate the issue on our end. We have created a sample application that shows the implementation. (MergedCellBorderExport.zip)

    We request you update the attached sample or provide a stripped-down version of your sample application so that we could reproduce the issue on our end and provide a solution accordingly.

    In case the issue persists on your end using the attached sample, please provide the following information to us.

    1. OS version
    2. VS version
    3. Locale settings of the system
    4. Display setting of the system

    Thanks & Regards,

    Aastha

  • Posted 15 August 2023, 11:01 pm EST

    Dear Aastha,

    First of all thanks for your quick reply. Unfortunately, your example does not exactly match my problem. I am concerned with the assignment of borderlines. I have extended the example a bit, add a few cell contents via programming, connect a few cells via columnspan and assign the border to the first cell (Sheets[0].Cells[3,4]). In the WinForm is the result correct but in the Excelexport the result is not displayed correctly. I have also attached such an Excel to you. I have found a workaround in which I assign the borderline to each of the actually merged cells.

    With my old version in .NET 4.8 this was not necessary and it would be also time consuming to change, therefore my hope would be that also in the .NET 6 version the Excelexport can be done correct again. I hope you can understand from my example where the problem lies.

    Thanks for your effort.

    HelmutMergedCellBorderExport_VersionGabler20230815.zip

  • Posted 16 August 2023, 8:51 pm EST

    Hi Helmut,

    Thanks for sharing the updated sample with us.

    We could replicate the behavior on our end. We are in discussions with the developers regarding this issue. [Internal Tracking ID: SPNET-32695]

    We will notify you on getting further updates from the developers.

    For the time being, you can consider a workaround to handle this problem. The workaround involves applying the border to all the cells contained within the specified row/column span, as demonstrated in the following code:

    fpSpread1.Sheets[0].Cells[3, 4].Value = "Title over three columns";
    fpSpread1.Sheets[0].Cells[3, 4].ColumnSpan = 3;
    fpSpread1.Sheets[0].Cells[3, 4].Border = bord2222;
    fpSpread1.Sheets[0].Cells[3, 5].Border = bord2222;
    fpSpread1.Sheets[0].Cells[3, 6].Border = bord2222;
    

    Kindly refer to the attached sample for full implementation. MergedCellBorderExport.zip

    Thanks & Regards,

    Aastha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels