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

Free Support Forum - aspose.com

Difference in Font.getUnderLine() return value ?!

Hi,


I’ve updated version of Aspose.Cells today from 7.1.1 to 7.5.0. After that I’ve get on a problem with return value from method Font.getUnderLine(). In Aspose.Cells 7.1.1 that method returns number 4 but in Aspose.Cells 7.5.0 that method returns 1 for the same text formatting.
Can You please tell me why it’s happening? And if You changed mapping of underline types with numbers can You please send me old map and the new one?

Hopefully You’ll answer soon.
Kind regards,
Zeljko

Hi,


Could you attach the template Excel file with sample code here, we will check your issue soon.

Thank you.

Sure, no problem. Here is the code:


String path = “/home/formatting-test.xls”;
Workbook workbook = new Workbook(path);
WorksheetCollection wc = workbook.getWorksheets();
Worksheet sheet = wc.get(0);
Cells cells = sheet.getCells();
Cell cell = cells.get(“B1”);
FontSetting fs = cell.characters(0, 3);
Font font = fs.getFont();
System.out.println(font.getUnderline());

And the Excel file is attached to the post.
Output of the code given above with Aspose.Cells 7.1.1 is “4”, but with Aspose.Cells 7.5.0 is “1”.

Hi,


Well, I tested your case using your template file with the following sample code with v7.5.0.x, it works fine and accordingly. It should return “Single” underline constant and it is doing the same. Here is my sample code:

Sample code:

String path = “formatting-test.xls”;
Workbook workbook = new Workbook(path);
WorksheetCollection wc = workbook.getWorksheets();
Worksheet sheet = wc.get(0);
Cells cells = sheet.getCells();
Cell cell = cells.get(“B1”);
FontSetting fs = cell.characters(0, 3);
Font font = fs.getFont();
System.out.println(font.getUnderline());

if (font.getUnderline()== FontUnderlineType.SINGLE)
{
System.out.println(“single underline”); //OK
}

I think it is quite possible since we incorporated more Font Underline types and the indexed order (for the constants) is changed a bit too. But, it works fine and accordingly.

Thank you.

Hi,


Yap, mapping has changed.
With Aspose Cells 7.1.1 it was:

ACCOUNTING 0
DOUBLE 1
DOUBLE ACCOUNTING 2
NONE 3
SINGLE 4

But with Aspose Cells 7.5.0 it is:

NONE 0
SINGLE 1
DOUBLE 2
ACCOUNTING 3
DOUBLE ACCOUNTING 4
DASH 5
DASH_DOT_DOT_HEAVY 6
DASH_DOT_HEAVY 7
DASHED_HEAVY 8
DASH_LONG 9
DASH_LONG_HEAVY 10
DOT_DASH 11
DOT_DOT_DASH 12
DOTTED 13
DOTTED_HEAVY 14
HEAVY 15
WAVE 16
WAVY_DOUBLE 17
WAVY_HEAVY 18
WORDS 19

It could be useful for someone.
Thanks,
Kind regards,
Zeljko

Hi,


Thanks for sharing the useful info.

And, good to know that your issue is sorted out now.

Have a good day!

Thanks,