Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Jun 28, 2023 5:36 pm

Hello! I am a C# developer running into a bug. When applying a NumberFormat on a range, cell borders both appear and disappear in unusual locations. Attached below is the expected output (with no number formatting applied), and the incorrect output (borders adjusted). Also of note, this bug is NOT present in version 12.3.2, but downgrading is not an option.

LANGUAGE: .NET Framework 4.8
VERSION: SPIRE.XLS 13.3.2

This is a self contained C# program that will trigger the bug when the for loop is set to TRUE (generated top image). The bug will not be triggered when set to FALSE (generated bottom image).

Code: Select all
using Spire.Xls;

namespace SPIRE_BOX_TEST {
    internal class Program {

        static void Main(string[] args) {
         Workbook workbook = new Workbook();
         workbook.Version = ExcelVersion.Version2016;

         CreateBox(workbook, 0, 1, 13, "A", "A");
         CreateBox(workbook, 0, 1, 13, "B", "B");
         CreateBox(workbook, 0, 17, 25, "A", "A");
         CreateBox(workbook, 0, 17, 25, "B", "C");
         CreateBox(workbook, 0, 17, 17, "B", "C");
         CreateBox(workbook, 0, 29, 37, "A", "A");
         CreateBox(workbook, 0, 29, 37, "B", "B");
         CreateBox(workbook, 0, 29, 29, "B", "B");
         CreateBox(workbook, 0, 41, 46, "A", "B");
         CreateBox(workbook, 0, 41, 46, "C", "C");

         // Setting this to TRUE will trigger the bug.
         if (true) {
            CurrencyRow(workbook, 0, "B7:E37");
            CurrencyRow(workbook, 0, "C41:C46");
         }

         workbook.SaveToFile("OUTPUTFILE.XLSX", FileFormat.Version2016);
         return;
      }

      public static void CreateBox(Workbook workbook, int worksheet, int sIndex, int eIndex, string sLetter, string eLetter) {
         // Set top boarder for box.
         workbook.Worksheets[worksheet].Range[sLetter + sIndex.ToString() + ":" + eLetter + eIndex.ToString()].BorderAround();
      }

      public static void CurrencyRow(Workbook workbook, int worksheet, string command) {
         workbook.Worksheets[worksheet].Range[command].NumberFormat = "\"$\"#,##0.00_);[Red]\\(\"$\"#,##0.00\\)";
      }
   }
}


INCORRECTLY FORMATTED

Image

CORRECTLY FORMATTED

Image

SZMYD.TRIMBLE
 
Posts: 1
Joined: Wed Jun 28, 2023 5:23 pm

Thu Jun 29, 2023 2:57 am

Hello,

Thanks for your inquiry.
I tested your code and did reproduce the issue you mentioned. I have logged the issue into our bug tracking system with the ticket number SPIREXLS-4773. Our development team will investigate and fix it. Once it is resolved, I will inform you in time. Sorry for the inconvenience caused.

Sincerely
Wenly
E-iceblue support team
User avatar

Wenly.Zhang
 
Posts: 149
Joined: Tue May 16, 2023 2:19 am

Thu Aug 03, 2023 1:39 am

Hello,

Thank you for your patience!
Glad to inform you that we just released spire.xls_13.8.0 hotfix, which fixed your issue SPIREXLS-4773. Please use this version to test.
Website link: https://www.e-iceblue.com/Download/download-excel-for-net-now.html
Nuget link:https://www.nuget.org/packages/Spire.XLS/#versions-body-tab

Sincerely
Wenly
E-iceblue support team
User avatar

Wenly.Zhang
 
Posts: 149
Joined: Tue May 16, 2023 2:19 am

Return to Spire.XLS