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

Free Support Forum - aspose.com

SetHtmlString throws Nullpointer Exception

Hi Team,

This post is regarding the setHtmlString throwing nullpointer Exception. Since the below thread was closed, I thought of creating a new post for this:


When passing empty tags to aspose cells, the library throws exception:

import java.io.FileInputStream;

import com.aspose.cells.Cell;
import com.aspose.cells.Cells;
import com.aspose.cells.Style;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
import com.aspose.cells.WorksheetCollection;

public class AsposeCellValueException {

public static void main(String[] args) throws Exception{
FileInputStream fis = new FileInputStream(“HelloWorld.xls”);
Workbook workbook = new Workbook(fis);
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet worksheet = worksheets.get(0);

Cells cells = worksheet.getCells();
Cell cell;
cell = cells.get(“A1”);
cell.putValue(“Cell Value”);
cell = cells.get(“A2”);
cell.putValue(“Hello World”);

Style style = new Style();

cell = cells.get(“A3”);
cell.setHtmlString("< >");


I understand that the library expects < and > instead of < or >. But we have a scenario where the data comes from different source. The previous version of aspose cells that we were using use to handle this scenario with out throwing an exception.

Please share me your thoughts

Best Regards


I can find the issue as you have mentioned by using your code with my simplest template XLS file. I have logged a ticket for it with an id: CELLSJAVA-40121. We will look into your issue soon.

Thank you.


Please download and try the latest version: Aspose.Cells for Java v7.1.0.3

We have catched the exception when user gives invalid html string.


Please download and try this fix:
for .NET v7.1.0.4

The issues you have found earlier (filed as CELLSJAVA-40121) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.