Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Text from the Html Table tag.

Text from the Html Table tag.

Scheduled Pinned Locked Moved C / C++ / MFC
htmlhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NaveenHS
    wrote on last edited by
    #1

    Hello Everyone, i am trying to Extract the Contents of the HTML page from the Table Tag. Till now i have done with identifying the Table tag from the Html Page. but still i am not able to extract the data from the table tag. can anyone please help me with this. I am getting the output as 0.

    MSHTML::IHTMLDocument2Ptr pDoc;
    MSHTML::IHTMLDocument3Ptr pDoc3;
    MSHTML::IHTMLElementCollectionPtr pCollection;
    MSHTML::IHTMLElementPtr pElement;

    HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,IID_IHTMLDocument2, (void**)&pDoc);

    // psa has the html page contents

    hr = pDoc->write(psa);
    hr = pDoc->close();

    pDoc3 = pDoc;

    pDoc->get_all(&pCollection);
    pCollection = pDoc3->getElementsByTagName("table");

    BSTR itxt;

    for(long i=0; ilength; i++){
    pElement = pCollection->item(i, (long)0);
    if(pElement != NULL){
    m_wndLinksList.AddString((LPCTSTR)bstr_t(pEle->get_innerText(&itxt)));
    }
    }

    D 1 Reply Last reply
    0
    • N NaveenHS

      Hello Everyone, i am trying to Extract the Contents of the HTML page from the Table Tag. Till now i have done with identifying the Table tag from the Html Page. but still i am not able to extract the data from the table tag. can anyone please help me with this. I am getting the output as 0.

      MSHTML::IHTMLDocument2Ptr pDoc;
      MSHTML::IHTMLDocument3Ptr pDoc3;
      MSHTML::IHTMLElementCollectionPtr pCollection;
      MSHTML::IHTMLElementPtr pElement;

      HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,IID_IHTMLDocument2, (void**)&pDoc);

      // psa has the html page contents

      hr = pDoc->write(psa);
      hr = pDoc->close();

      pDoc3 = pDoc;

      pDoc->get_all(&pCollection);
      pCollection = pDoc3->getElementsByTagName("table");

      BSTR itxt;

      for(long i=0; ilength; i++){
      pElement = pCollection->item(i, (long)0);
      if(pElement != NULL){
      m_wndLinksList.AddString((LPCTSTR)bstr_t(pEle->get_innerText(&itxt)));
      }
      }

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      NaveenHS wrote:

      pCollection = pDoc3->getElementsByTagName("table");

      Does pCollection have a non-NULL value?

      "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups