[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.CsvParseContext.Column

Column Property

Column

Gets the column index of the current cell.

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

class LeadingZeroParser : ICsvParser
{
    public void Parse(CsvParseResult result, CsvParseContext context)
    {
        int column = context.Column;
        if (column == 0 && context.Text.StartsWith("00"))
        {
            result.Value = context.Text;
        }
    }
}