?
Solved

Delphi WebBrowser need true source

Posted on 2012-08-20
4
Medium Priority
?
1,575 Views
Last Modified: 2012-11-04
Delphi WebBrowser view is  eat spaces.
I use the webbrowser element all the time.
But I am doing an app and there is a consern it is
removing spaces (not Carrage Returns) from the text.

It is a very standard call,
I tested all Inner, outer, text and html
all return the same line of text , with only single spaces,
between works,  the provider says the string should have
spaces to I can wrap at 76 Chars.  
The Line I get back has 'no' Carrage returns in it , by design

HOW DO I KNOW IT IS EATING SPACES, not returning them to me.
if I I right click the window and view source you see the spaces in Notepad.
But the iall.outerHTML; innerHTML ect does not return
what I see in Notepad when I view source


HELP  How do I fix this. ??




procedure TForm1.GetCompleteHTMLSource(wb: TWebBrowser);
var
  iDoc: IHTMLDocument2;
  iall : IHTMLElement;
begin
  if Assigned(wb.Document) then begin

    iDoc := wb.Document as IHTMLDocument2;
    iall := iDoc.body;

    while iall.parentElement <> nil do begin
      iall := iall.parentElement;
    end;

    Memo1.Clear;
    Memo1.Text := iall.outerHTML;
  end;

end;
0
Comment
Question by:yahoolane
  • 2
4 Comments
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 38315099
if the webbrowser being used follows the W3C standards (w3c.org) then you can use the "no breaking space" &nbsp; instead of a space to align data

if you want to align characters you should use a single width character type (like Courier new)

however all this *behaviour* can be overridden by a style sheet

there is no sure way for you to control the visual output at the other end
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 38315106
next to that... the web pages can be created dynamically by sources you can't access
you can even write a delphi program which throws you random pages with random content

what are you trying to accomplish ?
0
 
LVL 28

Accepted Solution

by:
Sinisa Vuk earned 2000 total points
ID: 38315881
Take a note - outerHTML is what you see and innerHTML is html source of that. If you assign
outerHTML to memo you surely lost something. Try to save raw data to file and look with hex view editor. If you want all of html source, try to iterate all frames first or look
something like this:

http://stackoverflow.com/questions/10091666/how-can-i-get-html-source-code-from-twebbrowser
http://stackoverflow.com/questions/3666392/how-to-get-the-text-of-a-html-page-webbrowser-delphi
0
 
LVL 1

Author Closing Comment

by:yahoolane
ID: 38565596
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question