Free Support Forum - aspose.com

NullPointerException when adding HTML to a cell

Hi,
I’m having a NullPointerException when I do the following:

String html = "<font color=\"#FF0000\"><u><b>Segue uma sequencia de imagens:</b></u></font><br/>GIF<br/>          <br/>JPG<br/>     <br/>PNG<br/>                    <br/>JPEG<br/>       <br/>&nbsp;<br/>Todas as imagens em minha posso foram <u><b>carregadas</b></u>!!!! <b><u>Excepto as seguinte</u></b>:<br/>         <br/>&nbsp; !!.PNG|thumbnail!<br/>";
        Workbook wb = new Workbook();
        Worksheet sheet = wb.getWorksheets().get(0);
        Cell cell = sheet.getCells().get(0, 0);
        Style style = cell.getStyle();
        style.setTextWrapped(true);
        cell.setStyle(style);
        cell.setHtmlString(html);
        sheet.autoFitRow(0);
        sheet.autoFitColumn(0);
        wb.save("C:\\Users\\Hugo Freixo\\Desktop\\tests\\teste.xlsx");

The exception happens on cell.setHtmlString(html);. I’m using Aspose Cells 18.3 Java.

Kind regards,
Hugo Freixo

@Hugo_Freixo,

Thanks for the sample code.

After an initial test, I am able to observe the issue as you mentioned by using your sample code. I found an exception “java.lang.NullPointerException” when adding the HTML string to the cell. I have logged a ticket with an id “CELLSJAVA-42589” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@Hugo_Freixo

Thanks for using Aspose APIs.

This is to inform you that we have fixed your issue CELLSJAVA-42589 now. We will soon provide the fix after performing QA and including other enhancements and fixes.

The issues you have found earlier (filed as CELLSJAVA-42589) have been fixed in Aspose.Cells for Java 18.5. Please also see the document for your reference: https://docs.aspose.com/display/cellsjava/Installation

Hi,
We ran some test and seems like the problem is fixed now.
Thank you very much.

Kind regards,
Hugo Freixo

@Hugo_Freixo,

Good to know that the latest version fixes your issue now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan