0

I am trying to copy the data from a table inside a TWebBrowser into excel but with no success. With the first command I am getting everywhere inside the excel the word "object" & with the second command I am getting the same value everywhere inside the excel.

var
  Table: OleVariant;
Begin
  Table := WebBrowser1.OleObject.Document.all.tags( 'TABLE' ).item( strtoint( edit3.Text ) );
  WS.range[ws.cells[1, 1], ws.cells[Table.Rows.Length, Table.Rows.Item(1).Cells.Length]].value:=Table; ?1?
  WS.range[ws.cells[1, 1], ws.cells[Table.Rows.Length, Table.Rows.Item(1).Cells.Length]].value:=Table.innertext; ?2?

Does anybody know the sollution?


All I want to do is to implement "Export to excel" option of a webbrowser into Delphi2007...... When I am using this option to export this 12000 rows table it takes less than a minute to export the table from any web browser from windows. Trying to implement this in Delphi using 2D Array it takes 10 minutes... Trying to implement the export with parsing technique (Stringlists, Pos(tr), pos (td) & some other string functions) it takes a long... Hence, what are the commands of a webbrowser to export an html table to excel that I have to convert them to Delphi? Should I use javascript inside Delphi? Should I use pointers?...Any idea? Thank you in advance.

Taryn
  • 242,637
  • 56
  • 362
  • 405
VaVel
  • 69
  • 3
  • 13
  • the solution is copying values of cells row by row column by column – Arioch 'The Jan 09 '14 at 22:11
  • I have done this already and it is time consuming. It must be another way, maybe something like the command of a clasical webbrowser "export to excel" Or getting data of the table directly through HTML... – VaVel Jan 10 '14 at 06:32
  • you may split the task into two: creating variant of 2D array type and reading HTML into it, and then copying that array into Excel Range in one operation – Arioch 'The Jan 10 '14 at 06:53
  • I tried it also. Time consuming..the table has 12000 rows...I am sure that it must exist one command that I can copy table/data from TWebBrowser... – VaVel Jan 10 '14 at 09:27
  • maybe using clipboard - but that is destroying user data in it and is a terrible solution. And what exactly is slow? reading from MSIE or writing into Excel ? can you copy the innerHTML of table and parse with any html parser ? – Arioch 'The Jan 10 '14 at 09:31
  • How can I implement this sollution copying InnerHTML of table and parsing them into excel? Thank you – VaVel Jan 10 '14 at 17:28

0 Answers0