[Advanced Excel] How do I set italic and underline in cell?

I'm trying to use Advance Excel but have come across some problems regarding formatting. The Java functions in the module allow you to change: font name, size, bold and colour. I am very much missing the italic and underline settings for my export files. I know that the java functions use Apache POI and I tried to analyse the Advanded Excel code to add this possibility but still without success. The java function "Cell_WriteByIndex" as I understand it sends a CellFormat entity to the java CellFormat function to determine the corresponding values in the cell based on it In the entity that specifies the formatting (CellFormat) I added the "Italic" attribute with a boolean value, I also duplicated the entire function fragment regarding bold in cellformat.java and in the duplicate changed "bold" to "italic" (given how Apache treats this, i.e. setBold and setItalic should work). Unfortunately to no avail and I don't know how to approach this. I have a feeling that either the function just doesn't get the italic information from the entity, or the CellFormat function ignores that part for some reason. I'm not hiding the fact that it would also be great to be able to choose the line height and other parameters. I tried poking around in the "cellformat.java" file but I seem to be misunderstanding something.
1 answers



I could solve eg. Italic the following way:

1. Add new Italic - boolean attribute to AdvancedExcel.CellFormat

2. Modify \javasource\advanced_excel\Utils.java:

Add Italic related row like Bold is already set: 

font.setBold(cellFormat.getBold());                  font.setItalic(cellFormat.getItalic());



All methods can be found here:

HSSFFont (POI API Documentation) (apache.org)