CSV Reports
InsertHeaderSpaces Property
Example 



KellermanSoftware.CsvReports Namespace > CsvWriter Class : InsertHeaderSpaces Property
If true, Pascal Cased Header Names will be split into words. Default is true
Syntax
Public Property InsertHeaderSpaces As Boolean
Dim instance As CsvWriter
Dim value As Boolean
 
instance.InsertHeaderSpaces = value
 
value = instance.InsertHeaderSpaces
public bool InsertHeaderSpaces {get; set;}
public:
property bool InsertHeaderSpaces {
   bool get();
   void set (    bool value);
}
Example
FirstName will become First Name
//Example Class
public class Person
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public DateTime BirthDate { get; set; }
}
    
CsvWriter csvWriter = new CsvWriter(); //Trial Mode
//CsvWriter csvWriter = new CsvWriter("place user name here", "place license key here"); //License Mode
 
//This will insert spaces into the FirstName field as First Name, LastName as Last Name, BirthDate as Birth Date  
csvWriter.InsertHeaderSpaces = true;
 
List<Person> persons = new List<Person>();
Person person1 = new Person();
person1.FirstName = "John";
person1.LastName = "Smith";
person1.BirthDate = DateTime.Now.AddDays(-1);
persons.Add(person1);
 
Console.WriteLine("With InsertHeaderSpaces = true");
string result = csvWriter.ClassListToCsvString(persons);
Console.WriteLine(result);
 
csvWriter.InsertHeaderSpaces = false;
Console.WriteLine();
Console.WriteLine("With InsertHeaderSpaces = false");
result = csvWriter.ClassListToCsvString(persons);
Console.WriteLine(result);
'Example Class
Public Class Person
    Public Property FirstName() As String
    Public Property LastName() As String
    Public Property BirthDate() As Date
End Class
 
Dim csvWriter As New CsvWriter() 'Trial Mode
'Dim csvWriter As New CsvWriter("place user name here", "place license key here") 'License Mode
 
'This will insert spaces into the FirstName field as First Name, LastName as Last Name, BirthDate as Birth Date  
csvWriter.InsertHeaderSpaces = True
 
Dim persons As New List(Of Person)()
Dim person1 As New Person()
person1.FirstName = "John"
person1.LastName = "Smith"
person1.BirthDate = Date.Now.AddDays(-1)
persons.Add(person1)
 
Console.WriteLine("With InsertHeaderSpaces = true")
Dim result As String = csvWriter.ClassListToCsvString(persons)
Console.WriteLine(result)
 
csvWriter.InsertHeaderSpaces = False
Console.WriteLine()
Console.WriteLine("With InsertHeaderSpaces = false")
result = csvWriter.ClassListToCsvString(persons)
Console.WriteLine(result)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CsvWriter Class
CsvWriter Members