[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.CsvParseContext.Text

Text Property

Text

Gets the original text of the current cell before parsing.

Declaration
public string Text { get; }
Public ReadOnly Property Text As String
Examples
CsvOpenOptions options = new CsvOpenOptions();
options.Parser = new LeadingZeroTextParser();
string filePath = Path.Combine(Path.GetTempPath(), "data.csv");
File.WriteAllText(filePath, "Code\n0012");
workbook.Open(filePath, options);
IWorksheet activeSheet = workbook.ActiveSheet;

class LeadingZeroTextParser : ICsvParser
{
    public void Parse(CsvParseResult result, CsvParseContext context)
    {
        string text = context.Text;
        if (text.StartsWith("00"))
        {
            result.Value = text;
        }
    }
}