Hai,
i have displayed the Excel Content in webbrowser Control using the convert function as like below.
Aplicationclass ac = new ApplicationClass();
Workbook doc = ac.Workbooks.Open(fileName, m, readOnly,
m, m, m, m, m, m, m,
m, m, m, m, m);
string tempFileName = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) + g.ToString() + ".html";
object newFileName = (object)tempFileName;
object fileType = (object)Microsoft.Office.Interop.Excel.XlFileFormat.xlHtml;
doc.SaveAs( newFileName, fileType,
m, m, m, m,XlSaveAsAccessMode.xlExclusive , m, m, m,
m, m);
it's loading correctly. but i need to implement the search functionality in webbrowser Control to find the text for that i have used the following method as like below
public bool FindNext(string text, WebBrowser webBrowser1)
{
IHTMLDocument2 doc = webBrowser1.Document.DomDocument as IHTMLDocument2;
IHTMLSelectionObject sel =doc.selection;
IHTMLTxtRange rng = sel.createRange() as IHTMLTxtRange;
rng.collapse(false);
if (rng.findText(text, 100000, 0))
{ rng.select();
return true;
}
else
FindFirst(text, webBrowser1);
return false;
}
it find's the first matched letter in the Excel document but it didn't iterate and not navigating to another matched text.
I worked with the same logic in word Document loading in Webbrowser Control. it's working fine.
But it didn't worked in Excel document why ?
IHTMLSelectionObject sel =doc.selection;
here sel object giving the type as "None" for excel documents but for word documents it's giving the type as "text".
What to do to implement the search functionality for excel docuemnts in Webbrowser Control.
Thank you