?
Solved

How can I get the values displayed in an HTMLTableCell using DOM?

Posted on 2005-03-01
1
Medium Priority
?
501 Views
Last Modified: 2013-11-17
I'm writing an app in C++Builder and I'm trying to read the values located in cells in a table on a web page.  I have the following code:

       TComInterface<IHTMLDocument2> Doc;
        Main->Browser->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&Doc);
        if( Doc )
        {
            TComInterface<IHTMLElementCollection> Forms;
            Doc->get_forms(&Forms);
            if( Forms )
            {
                long count = 0;
                Forms->get_length(&count);

                for(long x = 0; x < count; ++x)
                {
                    TVariant item = x;
                    TVariant index = 0;
                    TComInterface<IDispatch> Disp;

                    Forms->item(item, index, &Disp);
                    if( Disp )
                    {
                        TComInterface<IHTMLTable2> Table;
                        Disp->QueryInterface(IID_IHTMLTable2,(LPVOID*)&Table);
                        if( Table )
                        {
                          TComInterface<IHTMLElementCollection> Cells;
                          Table->get_cells(&Cells);
                          long count_cells=0;
                          Cells->get_length(&count_cells);


                          for(long y=0;y < count_cells;y++)
                          {
                            TVariant cell_item = y;
                            TVariant cell_index = 0;
                            TComInterface<IDispatch> cell_Disp;

                            Cells->item(cell_item,cell_index,&cell_Disp);

                            if(cell_Disp)
                            {
                             TComInterface<IHTMLTableCell> Cell;
                             cell_Disp->QueryInterface(IID_IHTMLTableCell,(LPVOID*)&Cell);

                             if(Cell)
                             {
                              WideString Value;
                              // What to put here to get data?

                              ShowMessage(Value);
                             }
                            }
                          }
                        }
                    }
                }
            }
        }

Am I heading in the wrong direction?  HTMLTableCell doesn't seem to provide any access to the data displayed in it/

Thanks for looking.

Mitch McInelly
0
Comment
Question by:agencysoft
1 Comment
 
LVL 16

Accepted Solution

by:
George Tokas earned 1500 total points
ID: 13463508
Hi there...
Check out:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20744667.html

That is something similar with what you want to do...
If you need any help in translation from Delphi come back...
The link describes what you want (as I understand it anyway ) but using Borland's TWebBrowser which is the same with TCppWebBrowser on BCB..

gtokas.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
Suggested Courses

579 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