How to put quote(' ) values in cell?

Hi,

This doesn’t seems like working

Workbook workbook = new Workbook();
WorksheetCollection sheets = workbook.getWorksheets();
Worksheet sheet = sheets.get(0);
Cells cells = sheet.getCells();
Cell cell = cells.get(“A1”);
cell.putValue("’");
System.out.println(cell.getValue());

Output:
(blank)

getValue() method wont return the quote. How to set the quote in cell?

Hi Azhar,

Thanks for your posting and using Aspose.Cells.

The first single quote that precedes everything has a special meaning in MS-Excel, so it will not be visible. You can try adding a single quote in MS-Excel and see the results, it will not be visible.

If you want to make Excel show your single quote, then your will have to use two single quotes like this ‘’. Now Excel will show it as '.

For example, if you will add a value ‘test’ then excel will show it as test’

But if you will add a value ‘‘test’ then excel will show it as ‘test’

Therefore you should change your code like this. Changes are highlighted in red.

Java
Workbook workbook = new Workbook();
WorksheetCollection sheets = workbook.getWorksheets();
Worksheet sheet = sheets.get(0);
Cells cells = sheet.getCells();
Cell cell = cells.get(“A1”);
cell.putValue("’’");
System.out.println(cell.getValue());