I have a double value stored in a cell: 9.99
Hi,
That doesnt prevent the inaccuracies - I want the value as entered by the user, not the double value that Aspose converts the cell value in to.
Hi,
Open up a new Excel workbook.
Hi Nick,
Thank you for further elaboration.
We have evaluated your presented scenario on our end with latest version of Aspose.Cells for Java 7.7.2.3. Cell.getStringValue() method returns the original string inserted as the cell value. In our tests, we have manually created an Excel spreadsheet with the values provided by you, and read them using the Cell.getStringValue() method. Please note, in this case we have set the format of the cell as text. In second test, we input the values dynamically using Aspose.Cells for Java API and read them correctly with the same. Please check the below provided code snippet and attached input spreadsheet.
Java
Workbook book = new Workbook(myDir + “book1.xlsx”);
Worksheet sheet = book.getWorksheets().get(0);
Cells cells = sheet.getCells();
System.out.println(cells.get(“A1”).getStringValue());
System.out.println(cells.get(“A2”).getStringValue());
System.out.println(cells.get(“A3”).getStringValue());
System.out.println(cells.get(“A4”).getStringValue());
System.out.println(cells.get(“A5”).getStringValue());
System.out.println(cells.get(“A6”).getStringValue());
cells.get(“B1”).putValue(“1”, false);
cells.get(“B2”).putValue(“1.0”, false);
cells.get(“B3”).putValue(“0.1”, false);
cells.get(“B4”).putValue(“0.01”, false);
cells.get(“B5”).putValue(“0.001”, false);
cells.get(“B6”).putValue(“0.0001”, false);
System.out.println(cells.get(“B1”).getStringValue());
System.out.println(cells.get(“B2”).getStringValue());
System.out.println(cells.get(“B3”).getStringValue());
System.out.println(cells.get(“B4”).getStringValue());
System.out.println(cells.get(“B5”).getStringValue());
System.out.println(cells.get(“B6”).getStringValue());
In case you still have any questions, please feel free to write back any time.