Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.08.08;
Скачать: [xml.tar.bz2];

Вниз

Печать вебстраниц в 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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.056 c
14-1089639086
Piter
2004-07-12 17:31
2004.08.08
Создание форм в MDI приложении


1-1090998978
tria
2004-07-28 11:16
2004.08.08
Добавляю много строк в грид.


1-1090677466
V l a d i m i r
2004-07-24 17:57
2004.08.08
TEdit: разрешить ввод только чисел.


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


3-1089961713
Wolfram
2004-07-16 11:08
2004.08.08
Выборка первых строк из групп.





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский