private void cmdOK_Click(object sender, System.EventArgs e) { if (tabControl1.SelectedTab == tabBrowser) { IHTMLDocument2 doc2 = browser.Document.DomDocument as IHTMLDocument2; IHTMLTxtRange range = doc2.selection.createRange() as IHTMLTxtRange; plainTextSelection = range.text; fullHtmlText = browser.DocumentText; HTMLInputFinder helper = new HTMLInputFinder(); helper.SearchTargetHTML = fullHtmlText; helper.SearchFor = range.htmlText; if (helper.Find()) { htmlTextSelection = helper.FoundHTML; fullHtmlText = browser.DocumentText; } else { DialogResult userAction = MessageBox.Show("Note: HTML imported may be different from original HTML on the actual web page", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (userAction == DialogResult.OK) { plainTextSelection = string.Empty; htmlTextSelection = range.htmlText; fullHtmlText = browser.DocumentText; Close(); } } } else { plainTextSelection = string.Empty; htmlTextSelection = txtHtmlView.SelectedText; fullHtmlText = browser.DocumentText; } Close(); }
public void Setup() { finder = new HTMLInputFinder(); }