利用IE浏览本地HTML,WORD, pdf格式文件
1. bstrCurPath为文件的目录, bstrFileName为文件名;代码如下:
//利用IE控件,浏览WORD,pdf等文件。
void putLocalUrl(CComBSTR bstrCurPath, CComBSTR bstrFileName)
{
//获取IE控件指针
HWND hWnd = GetDlgItem(IDC_EXPLORER);
CComPtr<IUnknown> spUnk;
HRESULT hr = AtlAxGetControl(hWnd,&spUnk);
if (SUCCEEDED(hr))
{
hr = spUnk ->QueryInterface(IID_IWebBrowser2, (void **)&m_spWebBrowser2 );
//GetDlgControl(IDC_EXPLORER,IID_IWebBrowser2,(void **)&m_spWebBrowser2);
if (SUCCEEDED(hr))
{
CComBSTR bstrURL(bstrCurPath);
bstrURL += bstrFileName;
PTCHAR lpPath = _com_util::ConvertBSTRToString(bstrURL);
if (_taccess(lpPath,0) == 0)
{
hr = m_spWebBrowser2->put_Visible(TRUE);
VARIANT vInfo;
vInfo.vt=VT_EMPTY;
hr = m_spWebBrowser2 ->Navigate( bstrURL, &vInfo, &vInfo, &vInfo, &vInfo );
}
else
{
MessageBox("无法加载!找不到路径!","IEContainer",MB_OK);
}
}
}
}
相关文档:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<title>CSS</title>
<style type="text/css">
<!--
*{margin:0;padding:0;}
body {
fo ......
这里说的其它标签,主要是要配合后面讲的CSS样式表来使用的,如果没有样式表,则这些标签显示效果不明显。
这里我们先把这些标签记住。
------------
组合标签
span标签是一个组合标签,作用是将连续的元素(如一段文本类型元素)通过该标签分成若干个子元素。
和p标签不同,默认情况下span标签内的文本不会附加任何特 ......
I always consider the coolitm control only can use its control tag in its body.
But I found that it can use html tag ,this very good.
so I show the sample to other:
<ext:Window
ID="Window1"
runat="server"
Width="500"
Height="485"
......
1.wkhtmltopdf http://code.google.com/p/wkhtmltopdf/downloads/list
如linu下载wkhtmltopdf-0.9.6-static-i386.tar.bz2
2. tar -jxvf wkhtmltopdf-0.9.6-static-i386.tar.bz2
3。重命名 mv wkhtmltopdf-i386 wkhtmltopdf
4.测试生成pdf ./wkhtm ......
<html>
<head>
<mce:style type = "text/css"><!--
div
{
overflow-y:scroll;
height:200;
overflow-x:scroll;
width:200;
}
--></mce:style><style type = "text/css" mce_bogus="1"> div
{
ove ......