DsExcel library provides the Quote Prefix feature just like Microsoft Excel. You can add a single quote or an apostrophe as a prefix to handle the cell value as text. The quote prefix remains hidden and only the cell value is visible. The single quote prefix can be seen in the formula bar when the user selects the cell.
Refer to the following example code to see how the quote prefix works in an Excel spreadsheet using DsExcel.
Java |
Copy Code |
---|---|
worksheet.getRange("C4").setValue("00001234"); worksheet.getRange("C5").setValue("Dec-1"); worksheet.getRange("F4").setValue("'006438098"); worksheet.getRange("F5").setValue("'Jan-4"); |
The below image shows the output of a prefixed quote. The quote is displayed in the formula bar whereas the cell hides it.
The below image shows the output of two prefixed quotes where both the quotes are displayed in the formula bar whereas the cell retains only one.