FormatConditionType.DATABAR not working on Windows

I have the following code a project where a databar is placed on a cell. This worked well until version 22.3.

int index = m_Worksheet.getConditionalFormattings().add();
FormatConditionCollection fcc = m_Worksheet.getConditionalFormattings().get(index);
 
CellArea ca = new CellArea();
ca.StartRow = 4;
ca.EndRow = 4;
ca.StartColumn = 2;
ca.EndColumn = 2;
 
fcc.addArea(ca);
int idx = fcc.addCondition(FormatConditionType.DATA_BAR);
FormatCondition cond = fcc.get(idx);
DataBar dataBar = cond.getDataBar();
dataBar.getMaxCfvo().setType(FormatConditionValueType.NUMBER);
dataBar.getMaxCfvo().setValue(20);
dataBar.setMaxLength(100);
dataBar.setColor(Color.fromArgb(180, 0, 0));

A few days ago I had to replace the license and wanted to evaluate the latest version 25.9.
The xslx generation worked well on Mac devices but did NOT on Windows devices.

Windows always shows the follows stacktrace when the closeWorkbook() method is executed:

Caused by: com.aspose.cells.CellsException: Invalid FormatConditionType val
	at com.aspose.cells.p7t.B(Unknown Source)
	at com.aspose.cells.h2n.a(Unknown Source)
	at com.aspose.cells.h2n.a(Unknown Source)
	at com.aspose.cells.h2n.x(Unknown Source)
	at com.aspose.cells.h2n.a(Unknown Source)
	at com.aspose.cells.e70.a(Unknown Source)
	at com.aspose.cells.g_0.a(Unknown Source)
	at com.aspose.cells.g_0.d(Unknown Source)
	at com.aspose.cells.g_0.a(Unknown Source)
	at com.aspose.cells.m19.a_(Unknown Source)
	at com.aspose.cells.Workbook.a(Unknown Source)
	at com.aspose.cells.Workbook.save(Unknown Source)
	at com.aspose.cells.Workbook.save(Unknown Source)
	at de.mytestproject.AsposeCellsReport.closeWorkbook(AsposeCellsReport.java:195)

I’ve also tried to add getMinCfvo().setType() and getMinCfvo.setValue() but this did not change anything.

The java version I’m using is Zulu 17.

Is this a known issue or is there any workaround?

Best,
Oliver

@obohnes

Hi Oliver,

Thank you for reaching out! For paid support with Aspose.Slides, here’s what you need to know:

  1. Paid Support Plans:

    • Priority Support: Fast response times for urgent issues.
    • Enterprise Support: Comprehensive support with dedicated resources.
  2. Information Needed:

    • Company name
    • Use case for Aspose.Slides
    • Number of users/seats
    • Desired SLA urgency (e.g., standard, priority)
    • Region (for support availability)
    • Preferred payment method
    • Contact email and phone number
  3. Next Steps:

    • Please provide the above information, and we can connect you with our sales team during business hours.

Looking forward to assisting you further!

Best regards,
[Your Name]
Aspose Sales Engineer

@obohnes
By using the following sample code for testing on the latest version v25.9, the program can run normally and obtain correct results without any exceptions. Please refer to the attachment. out_java.zip (7.0 KB)

Workbook workbook = new Workbook();
Worksheet m_Worksheet = workbook.getWorksheets().get(0);
Cells cells = m_Worksheet.getCells();
cells.get(4,  2).putValue(50);


int index = m_Worksheet.getConditionalFormattings().add();
FormatConditionCollection fcc = m_Worksheet.getConditionalFormattings().get(index);
 
CellArea ca = new CellArea();
ca.StartRow = 4;
ca.EndRow = 4;
ca.StartColumn = 2;
ca.EndColumn = 2;
 
fcc.addArea(ca);
int idx = fcc.addCondition(FormatConditionType.DATA_BAR);
FormatCondition cond = fcc.get(idx);
DataBar dataBar = cond.getDataBar();
dataBar.getMaxCfvo().setType(FormatConditionValueType.NUMBER);
dataBar.getMaxCfvo().setValue(20);
dataBar.setMaxLength(100);
dataBar.setColor(Color.fromArgb(180, 0, 0));

workbook.save(filePath + "out_java.xlsx");

If you still have questions, please provide sample files and complete runnable test code, and we will check it soon.