Using SuperCSV to Change Header Values

拟墨画扇 提交于 2019-12-04 12:12:58

I'm not sure if this answers your question, but you can put whatever you like in the header - it doesn't have to be identical to the mapping array passed to beanWriter.write()

For example, the following will give the output you desire:

final String[] header = new String[] { "First Name", "Last Name", "Birthday"};
final String[] fieldMapping = new String[] { "firstName", "lastName", "birthDate"};

// write the header
beanWriter.writeHeader(header);

// write the beans
for( final CustomerBean customer : customers ) {
   beanWriter.write(customer, fieldMapping , processors);
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!