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
CORRECTLY FORMATTED