Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.08.08;
Скачать: CL | DM;

Вниз

Печать вебстраниц в TWebBrowser   Найти похожие ветки 

 
Bohdan   (2004-07-21 20:50) [0]

Уважаемые мастера! Помогите кто знает, как распечатать документ, загруженный в компонент TWebBrowser!


 
Bohdan   (2004-07-22 18:04) [1]

Господа, неужели никто не сталкивался с такой (достойной ламера) задачей. Вот выкладываю всю докуменацию, исходники от МicroSoft на C++, только не знаю как перевести под Delphi

---------------------------------------------
Printing Pages with the WebBrowser Control

Although the WebBrowser control does not support a print method, you can print its contents using one of the following methods:

Set the focus to the WebBrowser control and send a key combination of CTRL+P.
Call the IWebBrowser2::get_Document method, which returns an IDispatch pointer. Using this IDispatch pointer, call QueryInterface on IID_IOleCommandTarget. With the object pointer returned, call IOleCommandTarget::Exec (NULL, OLECMDID_PRINT, 0, NULL, NULL).
LPDISPATCH lpDispatch = NULL;
LPOLECOMMANDTARGET lpOleCommandTarget = NULL;

lpDispatch = m_pBrowser.get_Document();
ASSERT(lpDispatch);

lpDispatch->QueryInterface(IID_IOleCommandTarget, (void**)&lpOleCommandTarget);
ASSERT(lpOleCommandTarget);

lpDispatch->Release();

// Print contents of WebBrowser control.
lpOleCommandTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL,NULL);
lpOleCommandTarget->Release();
----------------------------------------------------------------------------------------------------------------
Changing Fonts with the WebBrowser Control
The WebBrowser automation model does not support a method that allows you to change the font of the text of the currently displayed page. However, the WebBrowser control exposes this functionality through the IOleCommandTarget interface. Call the IWebBrowser2::get_Document method, which returns an IDispatch pointer. Using this IDispatch pointer, call QueryInterface on IID_IOleCommandTarget. With this IOleCommandTarget interface pointer, call IOleCommandTarget::Exec with OLECMDID_ZOOM and use the pvaIn input argument to pass a value in the range of 0 to 5 (where 0 is smallest), indicating the desired scale of the font. This, in effect, mimics the functionality available through the Internet Explorer Fonts command on the View menu.

Hide Example

LPDISPATCH pDisp = NULL;
LPOLECOMMANDTARGET pCmdTarg = NULL;

pDisp = m_pBrowser.get_Document();
ASSERT(pDisp);

pDisp->QueryInterface(IID_IOleCommandTarget, (LPVOID*)&pCmdTarg);
ASSERT(pCmdTarg);

VARIANT vaZoomFactor;   // input arguments
VariantInit(&vaZoomFactor);
V_VT(&vaZoomFactor) = VT_I4;
V_I4(&vaZoomFactor) = fontSize;

pCmdTarg->Exec(NULL,
 OLECMDID_ZOOM,
 OLECMDEXECOPT_DONTPROMPTUSER,
 &vaZoomFactor,
 NULL);
VariantClear(&vaZoomFactor);

if (pCmdTarg)
  pCmdTarg->Release(); // release document"s command target
if (pDisp)
  pDisp->Release();    // release document"s dispatch interface
--------------------------------------


 
Bohdan   (2004-07-23 14:50) [2]

Уважаемые программеры! Так неужели ни у кого нет никаких мыслей по этому поводу???


 
Rouse_ ©   (2004-07-23 14:54) [3]

http://www.swissdelphicenter.ch/en/showcode.php?id=478


 
Romkin ©   (2004-07-23 14:57) [4]

Rouse_ ©  (23.07.04 14:54) [3] Ну что тебя все на немецкий тянет?
http://members.shaw.ca/iedelphi/webbrowser.htm#advanced1


 
Bohdan   (2004-07-23 15:07) [5]

Огромное СПАСИБО Вам, друзья!!!


 
Vitaly ©   (2004-07-23 15:11) [6]

А по-русски слабо?
http://www.compress.ru/Temp/1127/index.htm


 
Rouse_ ©   (2004-07-23 15:20) [7]

ОФФ:
> [4] Romkin ©   (23.07.04 14:57)
А чем тебе "хендехох" не нравится?
Тем более там комментарий как на немецком так и по русски на английстком написано :)

> [6] Vitaly ©   (23.07.04 15:11)
Ссылки приводятся на код а не на описание кода...



Страницы: 1 вся ветка

Текущий архив: 2004.08.08;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.043 c
4-1088103041
miwa
2004-06-24 22:50
2004.08.08
Как "успокоить" SHFileOperation?


14-1090219157
Nous Mellon
2004-07-19 10:39
2004.08.08
Осваиваем интернетъ


3-1089778360
User_OKA
2004-07-14 08:12
2004.08.08
DBGrid


3-1089624467
Koala
2004-07-12 13:27
2004.08.08
Помогите с запросом


1-1090614361
Duk
2004-07-24 00:26
2004.08.08
Как сделать так чтоб прогу нельзя было закрыть