![]() ![]() |
||
and
Steps: Call the codes as below: void CExportHtmlView::OnFileExporttohtml() { // TODO: Add your command handler code here COutputDlg dlg; if(dlg.DoModal() == IDOK) { CString strPath = dlg.m_strPath; CString strImage = strPath +"output.bmp"; GetCurrentModel()->ShowMargin(FALSE); GetCurrentModel()->ShowGrid(FALSE); ExportAsBmpfile(strImage); CRect rcForm = GetCurrentModel()->GetPagePosition(); CSize szBitmap(rcForm.Width(), rcForm.Height()); OutputHtml(strPath,szBitmap); } } void CExportHtmlView::OnUpdateFileExporttohtml(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here } void CExportHtmlView::OutputHtml(CString strRootPath,CSize szChart) { CString strPath; strPath = strRootPath; CString strFileName; strFileName = strPath +"output.htm";// File name CFile cfile; if (!cfile.Open(strFileName,CFile::modeCreate|CFile::modeWrite)) return; cfile.Close(); ofstream dc((const char *)strFileName); dc<<"<html>\n"; dc<<"\n"; dc<<"<head>\n"; dc<<"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n"; dc<<"<meta name=\"GENERATOR\" content=\"Microsoft FrontPage 4.0\">\n"; dc<<"<meta name=\"ProgId\" content=\"FrontPage.Editor.Document\">\n"; dc<<"<title>This is just a test!</title>\n"; dc<<"</head>\n"; dc<<"\n"; dc<<"<body>\n"; dc<<"\n"; dc<<"<p><img border=\"0\" src=\"output.bmp\" width=\""<<szChart.cx<<"\" height=\""<<szChart.cy<<"\"></p>\n"; dc<<" \n"; dc<<"</body> \n"; dc<<" \n"; dc<<"</html> \n"; AfxGetApp()->BeginWaitCursor(); Sleep(1000); AfxGetApp()->EndWaitCursor(); ShellExecute(0, "open", strFileName, 0, 0, SW_SHOWNORMAL); }
|
Copyright ?1998-2007 UCanCode.Net Software, all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.
Please direct your questions or comments to webmaster@ucancode.com