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

Вниз

Как из TWebBrowser получить содержимое загруженного html   Найти похожие ветки 

 
SkyWalker   (2003-07-10 15:54) [0]

см. сабж


 
Palladin   (2003-07-10 15:59) [1]

см. форум


 
eK   (2003-07-14 22:40) [2]

Так может быть?

Процедура:

Doc: IHTMLDocument2;
ElementCollection: IHTMLElementCollection;
HtmlElement: IHTMLElement;
I: Integer;
AnchorString: string;
begin
lstbxLinks.Clear;
// We will process the document at this time. Trying to do
// so earlier won"t work because it hasn"t fully loaded.
Doc := FInternetExplorer.Document as IHTMLDocument2;
if Doc = nil then
raise Exception.Create("Couldn""t convert the " +
"FInternetExplorer.Document to an IHTMLDocument2");
// First, grab all the elements on the web page
ElementCollection := Doc.all;
for I := 0 to ElementCollection.length - 1 do
begin
// Get the current element
HtmlElement := ElementCollection.item(I, "") as IHTMLElement;
// Next, check to see if it is a link (tagName will be A).
// You could easily find other tags (such as TABLE, FONT, etc.)
if HTMLElement.tagName = "A" then
begin
// Now grab the innerText for this particular link. The innerText is
// all text that is inside of the particular tag. For example,
// this would give us "Go To Borland" from the HTML:
// <a href=" http://www.borland.com"> Go To Borland</a>.
// If you want " Go To Borland" use innerHTML.
AnchorString := HtmlElement.innerText;
if AnchorString = "" then
AnchorString := "(Empty Name)";
// We know that the element is an IHTMLAnchorElement since the tagName
// is "A".
AnchorString := AnchorString + " - " +
(HtmlElement as IHTMLAnchorElement).href;
( AnchorString) Так может быть?

Процедура:

Doc: IHTMLDocument2;
ElementCollection: IHTMLElementCollection;
HtmlElement: IHTMLElement;
I: Integer;
AnchorString: string;
begin
lstbxLinks.Clear;
// We will process the document at this time. Trying to do
// so earlier won"t work because it hasn"t fully loaded.
Doc := FInternetExplorer.Document as IHTMLDocument2;
if Doc = nil then
raise Exception.Create("Couldn""t convert the " +
"FInternetExplorer.Document to an IHTMLDocument2");
// First, grab all the elements on the web page
ElementCollection := Doc.all;
for I := 0 to ElementCollection.length - 1 do
begin
// Get the current element
HtmlElement := ElementCollection.item(I, "") as IHTMLElement;
// Next, check to see if it is a link (tagName will be A).
// You could easily find other tags (such as TABLE, FONT, etc.)
if HTMLElement.tagName = "A" then
begin
// Now grab the innerText for this particular link. The innerText is
// all text that is inside of the particular tag. For example,
// this would give us "Go To Borland" from the HTML:
// <a href=" http://www.borland.com"> Go To Borland</a>.
// If you want " Go To Borland" use innerHTML.
AnchorString := HtmlElement.innerText;
if AnchorString = "" then
AnchorString := "(Empty Name)";
// We know that the element is an IHTMLAnchorElement since the tagName
// is "A".
AnchorString := AnchorString + " - " +
(HtmlElement as IHTMLAnchorElement).href;
lstbxLinks.Items.Add(AnchorString);
end;
end;

И еще - надо импортировать бибилотеку Project>Import...>Microsoft HTML <что-то там> 4.0



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

Форум: "Сети";
Текущий архив: 2003.09.15;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.47 MB
Время: 0.011 c
3-48405
Alek Aaz
2003-08-25 15:35
2003.09.15
MDI и базы


3-48413
eds
2003-08-25 17:40
2003.09.15
Есть ли у кого нибудь демка по работе с TreeView компонентом?


3-48426
koks
2003-08-25 11:11
2003.09.15
ADOTable...


6-48663
Nikma
2003-06-30 03:33
2003.09.15
Как получить данные с web сайта


1-48627
GreatMaster
2003-09-03 09:19
2003.09.15
D6-7 - юникод русских букв в DFM как отключить?





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский