title: TStreamReader read by line HTML Code from WebBrowser Delphi
body: <p>I have a problem with using streams. I would like to read my html code line by line. With reading file line by line i have no problems but i need to read actualy opened document with webbrowser so i write this:</p>
  
  <pre><code>procedure TForm2.SpeedButton2Click(Sender: TObject);
  var
      iall : IHTMLElement;
      strumien : TStringStream;
      reader : TStreamReader;
  begin
    if Assigned(WebBrowser1.Document) then
      begin
        iall := (WebBrowser1.Document AS IHTMLDocument2).body;
        while iall.parentElement &lt;&gt; nil do
          begin
            iall := iall.parentElement;
          end;
        Strumien:=Tstringstream.Create(iall.innerHTML);
        Strumien.Position:=0;
        reader:=TStreamReader.Create(Strumien, TEncoding.UTF8);
        reader.OwnStream;
        while not reader.EndOfStream do
          memo1.Lines.Add(reader.ReadLine);
      end;
  end;
  </code></pre>
  
  <p>This code doesnt work. Reads only few lines from center of document and gives "List index out of bounds" Anyone know why? Using Embarcadero XE2 Delphi</p>
  
  <p>Thanks a lot!</p>