[C++] Qt 数据写入excel →→→→→进入此内容的聊天室

来自 , 2020-12-12, 写在 C++, 查看 112 次.
URL http://www.code666.cn/view/dea9ddb2
  1. QString fileName = QFileDialog::getSaveFileName ( this, tr ( "Save File" ),
  2.                    "",
  3.                    tr ( "file ( *.CSV)" ) );
  4. if ( fileName == "" )
  5.         return;
  6.  
  7. QTextCodec *code;
  8. code = QTextCodec::codecForName ( "gb18030" );
  9.  
  10. std::string strbuffer = code->fromUnicode ( fileName ).data();
  11. FILE *fileWrite = fopen ( strbuffer.c_str(),"w" );
  12. QString strFemale = "Female Count";
  13. QString strMale = "Male Count";
  14. QString strPatientCount = "Patient Count";
  15. QString str ="\n";
  16. std::string strCountbuffer = code->fromUnicode ( strFemale+","+
  17.                              strMale+","+strPatientCount+str+QString().setNum ( femaleCount ) +","+
  18.                              QString().setNum ( maleCount ) +","+QString().setNum ( patientCount ) ).data();
  19. QFile file;
  20. file.open ( fileWrite, QIODevice::WriteOnly );
  21. file.write ( strCountbuffer.c_str(), qstrlen ( strCountbuffer.c_str() ) );
  22. file.close();

回复 "Qt 数据写入excel"

这儿你可以回复上面这条便签

captcha