void CReportDlg::ReportExcel(LPCTSTR strPath)
{
std::map<INT64, ReportClientInfo>::iterator it;
TRY
{
CString cs;
CStdioFile file(strPath, CFile::shareExclusive | CFile::modeWrite | CFile::modeCreate);
setlocale(LC_CTYPE, ("chs")); //设置中文输出
file.WriteString(_T("序号\t读卡器ID\t读卡器IP\t端口号\t连接状态\t连接上时刻\t断开连接时刻\n"));
int row = 0;
ReportClientInfo temp;
for (it = m_reportMap.begin(); it != m_reportMap.end(); ++it)
{
temp = it->second;
cs.Format(_T("%d\t`%s\t%s\t%s\t%s\t%s\t%s\n"),
++row,
temp.ReaderID,
temp.ReaderIP,
temp.ReaderPort,
temp.ConnectStutes,
temp.ConnectTime,
temp.DisConnectTime);
file.WriteString(cs);
}
file.Close();
AfxMessageBox(_T("导出成功"));
}
CATCH_ALL(e)
{
e->ReportError();
return;
}
END_CATCH_ALL
}