k john

k john

  • NA
  • 15
  • 0

Please see this

Feb 16 2006 6:46 AM

please enhance the project to read ALL text in an html file. That is read the text between <HTML>tags. Only text must be read and output. and also  have an option in a combobox control - "Read All Text". If user chooses this instead of specifying tags then all text must be read and displayed in richTextBox.
 Iam sending required code...iam not getting about Read All Text option....can any one help please...

 we have to displayed only the contents between any tags(<html> ,....or anything)

private void cboxSelectTag_SelectedIndexChanged(object sender, System.EventArgs e)

{

if(txtSelectedFile.Text!="")

{

int startIndex,endIndex;

rtbDisplayTagContents.Clear();

rtbDisplayTagContents.Visible=true;

Cursor=Cursors.WaitCursor;

switch(cboxSelectTag.SelectedItem.ToString())

{

case "Read All Text":

while(intStart<rtbGetHtmlFile.Text.Length && intStart!= -1)

{

startIndex=0;

endIndex=0;

intStart=0 ;

intParenthesisCount=0;

intStart=startIndex=rtbGetHtmlFile.Find(charStartSearchCharecter,endIndex,rtbGetHtmlFile.Text.Length);

if(intStart!=-1)

{

intStart++;

endIndex=rtbGetHtmlFile.Find(charEndSearchCharecter,intStart,rtbGetHtmlFile.Text.Length);

for(int i=startIndex;i<endIndex;i++)

{

if(rtbGetHtmlFile.Text[i]=='>')

{

intParenthesisCount++;

for(int j=i+1 ;endIndex<=0;j++,i++)

{

rtbDisplayTagContents.AppendText(rtbGetHtmlFile.Text[j].ToString());

}

}

}

}

}

Cursor=Cursors.Default;

if(rtbDisplayTagContents.Text=="")

{

rtbDisplayTagContents.Text="No Content";

}

rtbDisplayTagContents.Visible=true;

break;

case "HTML":

startIndex=rtbGetHtmlFile.Find("<html");

endIndex=rtbGetHtmlFile.Find("</html>");

for(int i=startIndex;i<endIndex;i++)

{

if(rtbGetHtmlFile.Text[i]=='>')

{

for(int j=i+1;rtbGetHtmlFile.Text[j]!='<';j++)

{

rtbDisplayTagContents.AppendText(rtbGetHtmlFile.Text[j].ToString());

}

}

}

Cursor=Cursors.Default;

if(rtbDisplayTagContents.Text=="")

{

rtbDisplayTagContents.Text="No Content";

}

rtbDisplayTagContents.Visible=true;

break;