Document Solutions for Excel, .NET Edition | Document Solutions
Features / Worksheet / Quote Prefix
In This Topic
    Quote Prefix
    In This Topic

    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.

    C#
    Copy Code
    workbook.Worksheets[0].Range["C4"].Value = "'00001234";
    workbook.Worksheets[0].Range["C5"].Value = "'Dec-1";
    
    workbook.Worksheets[0].Range["F4"].Value = "''006438098";
    workbook.Worksheets[0].Range["F5"].Value = "''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.

    Prefixed quote

    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.

    Two prefixed quotes