[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.CsvOpenOptions.Parser

Parser Property

Parser

Gets or sets a custom parser used when opening CSV content.

The parser is called for each parsed CSV cell and can inspect the original text or modify the imported value and number format.

Declaration
public ICsvParser Parser { get; set; }
Public Property Parser As ICsvParser
Examples
class LeadingZeroParser : ICsvParser
{
    public void Parse(CsvParseResult result, CsvParseContext context)
    {
        if (context.Text.StartsWith("00"))
        {
            result.Value = context.Text;
        }
    }
}

CsvOpenOptions options = new CsvOpenOptions();
options.Parser = new LeadingZeroParser();
ICsvParser customParser = options.Parser;