qt csv文件写操作

实例1:

QStringList header;

header << "1" << "2";

QStringList footer;

footer << "Here is a footer";

QStringList strList;

strList << "one" << "two" << "three";

QtCSV::StringData strData;

strData.addRow(strList);

bool writeResult = QtCSV::Writer::write("E:\\qt\\Demo\\Demo\\dd\\test.csv",

strData,

",",

QString(),

QtCSV::Writer::REWRITE,

header,

footer);

实例2:

{

QStringList strList;

strList << "one" << "two" << "three";

QtCSV::StringData strData;

strData.addRow(strList);

bool writeResult = QtCSV::Writer::write("E:\\qt\\Demo\\Demo\\dd\\test.csv", strData);

}

{

QStringList strList;

strList << "one1" << "two2" << "three3";

QtCSV::StringData strData;

strData.addRow(strList);

bool writeResult = QtCSV::Writer::write("E:\\qt\\Demo\\Demo\\dd\\test.csv", strData, ",", "\"", QtCSV::Writer::WriteMode::APPEND);

}

相关推荐
xcyxiner15 小时前
DicomViewer (dcmtk读取dcm文件)5
qt
xcyxiner1 天前
DicomViewer (后台线程处理文件)4
qt
xcyxiner2 天前
DicomViewer (添加模型类)3
qt
xcyxiner2 天前
DicomViewer (目录调整) 2
qt
xcyxiner2 天前
dcmtk vtk vtk-dicom(gdcm) 编译(debug) v2
qt
桥田智能4 天前
桥田智能 QT-650S:面向白车身焊装的 800kg 重载快换解决方案
开发语言·qt·系统架构
森G4 天前
75、服务器源码解析---------云视频服务项目
linux·服务器·网络·c++·qt
森G4 天前
77、线程池原理和实现------服务器源码解析----云视频服务项目
服务器·c++·qt
森G5 天前
71、打包发布---------打包发布
c++·qt
初圣魔门首席弟子5 天前
Node.js 详细介绍(知识库版)
windows·qt·node.js·知识库