Actually, if you use withHeader(), no args, you _cannot_ get back the first record, so that makes skipHeader=false not possible without making the parser track the first record separately.
In the interest of simplicity, I am going to make it simple: if you use withHeader of any kind, then the first record is read. Gary On Tue, Jul 30, 2013 at 4:15 PM, Gary Gregory <garydgreg...@gmail.com>wrote: > Hi All: > > I see now, the behavior is different depending on what you pass to > withHeader()! Confusing indeed. > > If you call withHeader with Strings, the first line is not read and it is > returned as a record. > > If you call withHeader with no arguments, the first line _is_ read and it > is NOT returned as a record. > > I think I'll change it so that withHeader causes the first line to be > skipped, always, and add an option skipHeaders with a default of true. So > if you really want to set the headers AND see what they are, you can do > that. > > Gary > > > On Tue, Jul 30, 2013 at 3:44 PM, Gary Gregory <garydgreg...@gmail.com>wrote: > >> Hi All: >> >> I have Excel files with headers. So I use withHeaders() of course to map >> the headers. >> >> When I call parser.iterator().next(), the first record is the header >> record, not data. >> >> I always have to skip this first line since it is not data. >> >> I wonder if: >> >> 1) We should automatically skip the header line for next() and >> parser.getRecords(), or >> 2) Add a skipHeader boolean setting to control the above behavior, where >> the default is...? >> >> (2) is the most flexible. >> >> Thoughts? >> >> Gary >> -- >> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >> Java Persistence with Hibernate, Second >> Edition<http://www.manning.com/bauer3/> >> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> >> Spring Batch in Action <http://www.manning.com/templier/> >> Blog: http://garygregory.wordpress.com >> Home: http://garygregory.com/ >> Tweet! http://twitter.com/GaryGregory >> > > > > -- > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org > Java Persistence with Hibernate, Second > Edition<http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory