Enum in CsvHelper
CsvInjection
Added in v34.0.0
What CsvWriter does with a text field that starts with one of CsvWriterOptions.InjectionCharacters, which a spreadsheet such as Excel would run as a formula when it opens the file (CSV injection).
public enum CsvInjection- Namespace
CsvHelper- Assembly
CsvHelper.dll- Builds
- net10.0 netstandard2.1 netstandard2.0 net47
- Source
- CsvWriterOptions.cs
Values
| Name | Value | Description |
|---|---|---|
None | 0 | Write the field as it is (the default). |
Escape | 1 | Put CsvWriterOptions.InjectionEscape in front of the field, so a spreadsheet shows it as text. In CsvMode.Rfc4180 mode the field is also quoted. |
Strip | 2 | Remove the injection characters from the start of the field. |
Throw | 3 | Throw an InvalidOperationException; the record is discarded. |