本文整理汇总了C#中IHTMLDocument2.write方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLDocument2.write方法的具体用法?C# IHTMLDocument2.write怎么用?C# IHTMLDocument2.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHTMLDocument2
的用法示例。
在下文中一共展示了IHTMLDocument2.write方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HTMLToDom
private IHTMLDocument2 HTMLToDom(string html)
{
doc = new HTMLDocumentClass();
doc.write(new object[] { html });
doc.close();
return doc;
}
示例2: setBoard
private void setBoard(int sPage = 1, int ePage = 3)
{
for (int i = 0; i < 3 * 10; i++)
{
boards[i] = new DormBoard();
}
for (int pageNum = sPage; pageNum <= ePage; pageNum++)
{
// http://dorm.unist.ac.kr/admin/board/view.asp?intNowPage=1&board_nm=dorm_notice&idx=2885
string url = "http://dorm.unist.ac.kr/admin/board/list.asp?board_nm=dorm_notice&intNowPage=" + pageNum;
if (!getResponse(url))
return;
doc = (IHTMLDocument2)new HTMLDocument();
doc.clear();
doc.write(resResult);
doc.close();
IEnumerable<IHTMLElement> tags = ElementsByTagName(doc, "tr");
string[] rows = new string[5];
for (int i = 1; i < tags.Count(); i++)
{
string html=tags.ElementAt(i).innerHTML;
boards[i].link = html.Split('\'')[0];
}
}
}
示例3: LoadDocumentInMtaThread
// Load the document in a worker thread
private void LoadDocumentInMtaThread(Object state)
{
try
{
// Create a new IHTMLDocument2 object
_parsedHtml = (IHTMLDocument2)new HTMLDocument();
// Attach the event handler
var events = (HTMLDocumentEvents2_Event)_parsedHtml;
events.onreadystatechange += _onreadystatechangeEventHandler;
// Write the content and close the document
_parsedHtml.write(Content);
_parsedHtml.close();
// Wait for the onReadyStateChange event to be fired. On IE9, this never happens
// so we check the readyState directly as well.
bool wait = true;
while (wait && !_stopWorkerThread)
{
if (String.Equals("complete", _parsedHtml.readyState, StringComparison.OrdinalIgnoreCase))
{
break;
}
wait = !_stateChangeResetEvent.Wait(100);
}
// Detach the event handler
events.onreadystatechange -= _onreadystatechangeEventHandler;
}
catch (Exception e)
{
_parsingException = e;
}
finally
{
_loadDocumentResetEvent.Set();
}
}
示例4: setLastestBoard
private void setLastestBoard(int sPage, int ePage)
{
for (int pageNum = sPage; pageNum <= ePage; pageNum++)
{
MainForm.gridView.Columns[4].HeaderText = "게시판";
string url = "http://portal.unist.ac.kr/EP/web/collaboration/bbs/jsp/BB_MyBoardLst.jsp?nfirst=" + pageNum;
if (!getResponse(url))
return;
doc = (IHTMLDocument2)new HTMLDocument();
doc.clear();
doc.write(resResult);
doc.close();
IEnumerable<IHTMLElement> titles = ElementsByClass(doc, "ltb_left");
IEnumerable<IHTMLElement> elements = ElementsByClass(doc, "ltb_center");
int docNum = elements.Count();
int index;
for (int i = 0; i < docNum / 11; i++)
{
string[] rows = new string[5];
IHTMLElement title = titles.ElementAt(i);
int titleLen = 30;
if (title.innerText.Count() > titleLen)
{
rows[1] += title.innerText.Substring(0, titleLen);
rows[1] += "\r\n";
rows[1] += title.innerText.Substring(titleLen);
}
else
{
rows[1] = title.innerText;
}
rows[2] = elements.ElementAt(i * 11 + 5).innerText;
rows[3] = elements.ElementAt(i * 11 + 7).innerText;
rows[4] = elements.ElementAt(i * 11 + 3).innerText;
index = (pageNum - 1) * 10 + i;
if (title.innerHTML.IndexOf("red") != -1)
{
board4[index].color = Color.Red;
}
if (elements.ElementAt(i * 11 + 0).innerText.Trim() == "")
{
rows[0] = "공지";
board4[index].anouncement = true;
}
board4[index].rows = rows;
//board4[index].title = rows[1];
//board4[index].writer = rows[2];
//board4[index].date = rows[3];
board4[index].boardName = rows[4];
//board[index].viewCount = Convert.ToInt32(rows[3]);
board4[index].page = pageNum;
board4[index].boardId = title.innerHTML.Substring(title.innerHTML.IndexOf("boardid=")).Substring(8);
board4[index].boardId = board4[index].boardId.Substring(0, board4[index].boardId.IndexOf("&"));
board4[index].bullId = title.innerHTML.Substring(title.innerHTML.IndexOf("bullid=")).Substring(7);
board4[index].bullId = board4[index].bullId.Substring(0, board4[index].bullId.IndexOf("&"));
}
if (docNum / 11 != 10)
{
return;
}
}
}
示例5: setNewLastestBoard
private int setNewLastestBoard()
{
int diffCount = 0;
for (int i = 0; i < PAGENUM * 10; i++)
new_board4[i] = new PortalBoard();
for (int pageNum = 0; pageNum <= PAGENUM; pageNum++)
{
string url = "http://portal.unist.ac.kr/EP/web/collaboration/bbs/jsp/BB_MyBoardLst.jsp?nfirst=" + pageNum;
if (!getResponse(url))
return 0;
doc = (IHTMLDocument2)new HTMLDocument();
doc.clear();
doc.write(resResult);
doc.close();
IEnumerable<IHTMLElement> titles = ElementsByClass(doc, "ltb_left");
IEnumerable<IHTMLElement> elements = ElementsByClass(doc, "ltb_center");
int docNum = elements.Count();
int index;
for (int i = 0; i < docNum / 11; i++)
{
string[] rows = new string[5];
IHTMLElement title = titles.ElementAt(i);
int titleLen = 30;
if (title.innerText.Count() > titleLen)
{
rows[1] += title.innerText.Substring(0, titleLen);
rows[1] += "\r\n";
rows[1] += title.innerText.Substring(titleLen);
}
else
{
rows[1] = title.innerText;
}
if (rows[1] == board4[0].rows[1 + diffCount])
{
return diffCount;
}
else
{
diffCount++;
}
rows[2] = elements.ElementAt(i * 11 + 5).innerText;
rows[3] = elements.ElementAt(i * 11 + 7).innerText;
rows[4] = elements.ElementAt(i * 11 + 3).innerText;
index = (pageNum - 1) * 10 + i;
new_board4[index].rows = rows;
new_board4[index].boardName = rows[4];
new_board4[index].page = pageNum;
new_board4[index].boardId = title.innerHTML.Substring(title.innerHTML.IndexOf("boardid=")).Substring(8);
new_board4[index].bullId = title.innerHTML.Substring(title.innerHTML.IndexOf("bullid=")).Substring(7);
}
}
return diffCount;
}
示例6: setBoard
private void setBoard(PortalBoard[] board, string boardId, int sPage, int ePage)
{
MainForm.gridView.Columns[4].HeaderText = "조회수";
for (int i = 0; i < 10 * 10; i++)
{
board[i] = new PortalBoard();
}
for (int pageNum = sPage; pageNum <= ePage; pageNum++)
{
string url = "http://portal.unist.ac.kr/EP/web/collaboration/bbs/jsp/BB_BoardLst.jsp?boardid=" + boardId + "&nfirst=" + pageNum;
if (!getResponse(url))
return;
doc = (IHTMLDocument2)new HTMLDocument();
doc.clear();
doc.write(resResult);
doc.close();
IEnumerable<IHTMLElement> titles = ElementsByClass(doc, "ltb_left");
IEnumerable<IHTMLElement> elements = ElementsByClass(doc, "ltb_center");
int docNum = elements.Count();
int index;
for (int i = 0; i < docNum / BOARDTAGNUM; i++)
{
string[] rows = new string[5];
IHTMLElement title = titles.ElementAt(i);
rows[0] = "";
rows[1] = title.innerText;
rows[2] = elements.ElementAt(i * BOARDTAGNUM + 5).innerText;
rows[3] = elements.ElementAt(i * BOARDTAGNUM + 7).innerText;
rows[4] = elements.ElementAt(i * BOARDTAGNUM + 9).innerText;
index = (pageNum - 1) * 10 + i;
// new 체크
if (((IHTMLElement2)title).getElementsByTagName("img").length > 0)
{
board[index].newPost = true;
rows[0] = "new";
}
// 공지 체크
if (((IHTMLElement2)elements.ElementAt(i * BOARDTAGNUM + 1)).getElementsByTagName("img").length > 0)
{
board[index].anouncement = true;
rows[0] = "공지";
}
board[index].rows = rows;
//board[index].title = rows[1];
//board[index].writer = rows[2];
//board[index].date = rows[3];
//board[index].viewCount = Convert.ToInt32(rows[4]);
board[index].page = pageNum;
board[index].boardId = boardId;
// javascript:clickBulletin("BB201302011329070365135","BB201302011329070365135","BB201302011329070365135","0","N");
string javaUrl = title.innerHTML.Substring(title.innerHTML.IndexOf("javascript:"));
board[index].bullId = javaUrl.Split('\"')[1];
IHTMLElement font = (IHTMLElement)((IHTMLElement2)title).getElementsByTagName("font").item(0, 0);
if (font.getAttribute("color") != null)
{
board[index].color = ConvertColor_PhotoShopStyle_toRGB((string)font.getAttribute("color"));
}
if (title.outerHTML.IndexOf("FONT-WEIGHT: bold") != -1)
{
board[index].bold = true;
}
}
}
}
示例7: searchBoard
/**********************************************************
*
* 포탈 검색, EUC-KR 인코딩
*
**********************************************************/
private void searchBoard(PortalBoard[] board, string boardId, int sPage, int ePage, string query)
{
// http://portal.unist.ac.kr/EP/web/collaboration/bbs/jsp/BB_BoardLst.jsp?searchcondition=BULLTITLE&searchname=%B0%F8%C1%F6&boardid=B200902281833482321051&nfirst=1
MainForm.gridView.Columns[4].HeaderText = "조회수";
for (int i = 0; i < 10 * 10; i++)
{
board[i] = new PortalBoard();
}
for (int pageNum = sPage; pageNum <= ePage; pageNum++)
{
byte[] b = System.Text.Encoding.GetEncoding(51949).GetBytes(query);
string result = "";
foreach (byte ch in b)
{
result += ("%" + string.Format("{0:x2} ", ch)); // 2자리의 16진수로 출력, [참고] 링크 읽어볼 것
}
string url = "http://portal.unist.ac.kr/EP/web/collaboration/bbs/jsp/BB_BoardLst.jsp?boardid=" + boardId + "&nfirst=" + pageNum
+ "&searchcondition=BULLTITLE&searchname=" + result.Replace(" ","");
if (!getResponse(url))
return;
doc = (IHTMLDocument2)new HTMLDocument();
doc.clear();
doc.write(resResult);
doc.close();
IEnumerable<IHTMLElement> titles = ElementsByClass(doc, "ltb_left");
IEnumerable<IHTMLElement> elements = ElementsByClass(doc, "ltb_center");
int docNum = elements.Count();
int index;
if (docNum == 0)
return;
for (int i = 0; i < docNum / BOARDTAGNUM; i++)
{
string[] rows = new string[5];
IHTMLElement title = titles.ElementAt(i);
rows[0] = "";
rows[1] = title.innerText;
rows[2] = elements.ElementAt(i * BOARDTAGNUM + 5).innerText;
rows[3] = elements.ElementAt(i * BOARDTAGNUM + 7).innerText;
rows[4] = elements.ElementAt(i * BOARDTAGNUM + 9).innerText;
index = (pageNum - 1) * 10 + i;
// new 체크
if (((IHTMLElement2)title).getElementsByTagName("img").length > 0)
{
board[index].newPost = true;
rows[0] = "new";
}
// 공지 체크
if (((IHTMLElement2)elements.ElementAt(i * BOARDTAGNUM + 1)).getElementsByTagName("img").length > 0)
{
board[index].anouncement = true;
rows[0] = "공지";
}
board[index].rows = rows;
//board[index].title = rows[1];
//board[index].writer = rows[2];
//board[index].date = rows[3];
//board[index].viewCount = Convert.ToInt32(rows[4]);
board[index].page = pageNum;
board[index].boardId = boardId;
// javascript:clickBulletin("BB201302011329070365135","BB201302011329070365135","BB201302011329070365135","0","N");
string javaUrl = title.innerHTML.Substring(title.innerHTML.IndexOf("javascript:"));
board[index].bullId = javaUrl.Split('\"')[1];
IHTMLElement font = (IHTMLElement)((IHTMLElement2)title).getElementsByTagName("font").item(0, 0);
if (font.getAttribute("color") != null)
{
board[index].color = ConvertColor_PhotoShopStyle_toRGB((string)font.getAttribute("color"));
}
if (title.outerHTML.IndexOf("FONT-WEIGHT: bold") != -1)
{
board[index].bold = true;
}
}
}
}
示例8: bookSearch
public void bookSearch(string bq1, string bq2, string bo1, string bo2, string bo)
{
this.bookQuery1 = bq1;
this.bookQuery2 = bq2;
this.bookOption1 = bo1;
this.bookOption2 = bo2;
this.bookOperator = bo;
bookQuery = queryMake();
// new : http://114.70.3.72/DLiWeb25Fr/comp/search/Results.aspx?
// old : http://library.unist.ac.kr/DLiWeb25Eng/comp/search/Results.aspx?
string url = "http://114.70.3.72/DLiWeb25Fr/comp/search/Results.aspx?" + bookQuery;
if (!getResponse(url))
{
return;
}
doc = (IHTMLDocument2)new HTMLDocument();
doc.clear();
doc.write(resResult);
doc.close();
IEnumerable<IHTMLElement> elements = ElementsByClass(doc, "item");
IEnumerable<IHTMLElement> authors = ElementsByClass(doc, "author");
IEnumerable<IHTMLElement> publishers = ElementsByClass(doc, "publisher");
IEnumerable<IHTMLElement> publishyears = ElementsByClass(doc, "publishyear");
IEnumerable<IHTMLElement> cclasses = ElementsByClass(doc, "cclass");
books = new Book[elements.Count()];
for (int i = 0; i < elements.Count(); i++)
{
string[] rows = new string[5];
books[i] = new Book();
string html = elements.ElementAt(i).innerHTML;
if (html.IndexOf("no thumbnail") != -1)
{
books[i].thumbnail = "";
}
else
{
books[i].thumbnail = html.Substring(html.IndexOf("thumb.axd?url=")).Split('\"')[0];
}
IHTMLElement element = (IHTMLElement)((IHTMLElement2)elements.ElementAt(i)).getElementsByTagName("label").item(0, 0);
rows[0] = books[i].title = element.getAttribute("title").ToString().Split('/')[0].Replace("선택하기", "");
if (((IHTMLElement)(authors.ElementAt(i))).innerText != null)
rows[1] = books[i].author = ((IHTMLElement)(authors.ElementAt(i))).innerText.Replace("/ ", "");
else
rows[1] = books[i].author = "";
if (((IHTMLElement)(publishers.ElementAt(i))).innerText != null)
rows[2] = books[i].publisher = ((IHTMLElement)(publishers.ElementAt(i))).innerText.Replace("/ ", "");
else
rows[2] = books[i].publisher = "";
if (((IHTMLElement)(publishyears.ElementAt(i))).innerText != null)
rows[3] = books[i].publishYear = ((IHTMLElement)(publishyears.ElementAt(i))).innerText.Replace("/ ", "");
else
rows[3] = books[i].publishYear = "";
if (((IHTMLElement)(cclasses.ElementAt(i))).innerText != null)
rows[4] = books[i].kind = ((IHTMLElement)(cclasses.ElementAt(i))).innerText.Replace("/ ", "");
else
rows[3] = books[i].publishYear = "";
books[i].isbn = html.Substring(html.IndexOf("isbn\">")).Split('>')[1].Split('<')[0];
IHTMLElement cid = (IHTMLElement)(((IHTMLElement2)elements.ElementAt(i)).getElementsByTagName("input").item(0, 0));
// 도서 상태를 위한 cid
books[i].cid = cid.getAttribute("value").ToString();
if (html.IndexOf("Domestic Books") != -1)
{
books[i].kind = "국내 서적";
}
books[i].rows = rows;
}
// http://114.70.3.72/DLiWeb25Fr/comp/search/Results.aspx?m_var=421&querytype=2&srv=31&method=2&field=TITL&keyword=%EC%95%84&operator=0&branch=01&classid=24,27,1,60,32,65,21,23,25,39,75,2,22,41,38,74,88,52,33,6,19,80,29,59,85,89,5,28,16,77,30,73,53,34,79,64,26,90,35,3,4,15,20,42,76,86,91&max=300&cntperpage=20&viewoption=1&sort=DEFAULT
// new : http://library.unist.ac.kr/DLiWeb25Fr/comp/search/Results.aspx?method=2&field=TITL&keyword=%EC%95%84&operator=0&branch=01&classid=24,27,1,60,32,65,21,23,25,39,75,2,22,41,38,74,88,52,33,6,19,80,29,59,85,89,5,28,16,77,30,73,53,34,79,64,26,90,35,3,4,15,20,42,76,86,91&max=300&cntperpage=20&viewoption=1&sort=DEFAULT
// old : http://library.unist.ac.kr/DLiWeb25Eng/comp/search/Results.aspx?method=2&field=TITL,AUTH,PUBN&keyword=%ED%95%B4%ED%82%B9,%ED%95%B4%ED%82%B9,%ED%95%B4%ED%82%B9&operator=0,1,3&branch=01&classid=24,27,1,60,32,65,21,23,25,39,75,2,22,41,38,74,88,52,33,6,19,80,29,59,85,89,63,5,28,16,77,30,73,53,34,64,79,26,90,35,3,4,15,20,42,76,86,91&max=300&classifyname=KDC&classify=&cntperpage=20&viewoption=1&sort=DEFAULT
}
示例9: loadStudyroomStatus
//date : 201302
public void loadStudyroomStatus(int roomNum, string date)
{
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
{
MainForm.isError = true;
Application.Exit();
MessageBox.Show("인터넷 연결에 문제가 있습니다.\r\n 프로그램을 종료합니다. :^(", "Robot의 경고");
System.Diagnostics.Process[] mProcess = System.Diagnostics.Process.GetProcessesByName(Application.ProductName);
foreach (System.Diagnostics.Process p in mProcess)
p.Kill();
}
// new : http://114.70.3.72/dliweb25fr/studyroom/detail.aspx?m_var=112&roomid=1
// old : http://library.unist.ac.kr/dliweb25eng/studyroom/detail.aspx?m_var=112&roomid=1
string url = "http://114.70.3.72/dliweb25fr/studyroom/detail.aspx?m_var=112&roomid=" + roomNum.ToString() + "&yearmonth=" + date;
if (!getResponse(url))
{
return;
}
doc = (IHTMLDocument2)new HTMLDocument();
doc.clear();
doc.write(resResult);
doc.close();
IEnumerable<IHTMLElement> e = getTd(doc);
IEnumerator<IHTMLElement> enumerator = e.GetEnumerator();
dayCount = e.Count();
roomStat = new string[dayCount][];
for (int i = 0; i < roomStat.Length; i++)
{
roomStat[i] = new string[25];
}
int count = 0;
while (enumerator.MoveNext())
{
IHTMLElement2 e2 = (IHTMLElement2)enumerator.Current;
roomStat[count][0] = ((IHTMLElement)(e2.getElementsByTagName("td").item(0, 0))).innerText;
for (int i = 1; i < 25; i++)
{
IHTMLElement elem = ((IHTMLElement)(e2.getElementsByTagName("td").item(i, 0)));
roomStat[count][i] = elem.innerText;
if (roomStat[count][i] == null)
{
IHTMLElement img = (IHTMLElement)(((IHTMLElement2)elem).getElementsByTagName("img").item(0));
if (img.getAttribute("src").ToString().IndexOf("icoA.gif") != -1)
{
roomStat[count][i] = "E";
}
else if (img.getAttribute("src").ToString().IndexOf("icoN.gif") != -1)
{
roomStat[count][i] = "R";
}
}
}
count++;
}
}
示例10: loadBookStat
public string[] loadBookStat(string cid)
{
// new : http://114.70.3.72/DLiWeb25Fr/comp/search/SearchHandler.aspx?action=stock&cid=357465
// old : http://library.unist.ac.kr/DLiWeb25Eng/comp/search/SearchHandler.aspx?action=stock&cid=357465
// | 번호 | 등록 번호 | 소장 위치 | 도서 상태 | 청구 기호 | 출력 |
string url = "http://114.70.3.72/DLiWeb25Fr/comp/search/SearchHandler.aspx?action=stock&cid=" + cid;
if (!getResponse(url))
{
return null;
}
doc = (IHTMLDocument2)new HTMLDocument();
doc.clear();
doc.write(resResult);
doc.close();
//IEnumerable<HtmlElement> elements = ElementsByClass(doc, "stock_callnumber");
IEnumerable<IHTMLElement> e = getTableRow(doc);
IEnumerator<IHTMLElement> enumerator = e.GetEnumerator();
string[] rows = new string[(e.Count() - 1) * 4];
int count = 0;
enumerator.MoveNext();
while (enumerator.MoveNext())
{
IHTMLElement2 e2 = (IHTMLElement2)enumerator.Current;
rows[count++] = ((IHTMLElement)(e2.getElementsByTagName("td").item(3, 0))).innerText;
rows[count++] = ((IHTMLElement)(e2.getElementsByTagName("td").item(2, 0))).innerText;
rows[count++] = ((IHTMLElement)(e2.getElementsByTagName("td").item(4, 0))).innerText;
rows[count++] = ((IHTMLElement)(e2.getElementsByTagName("td").item(1, 0))).innerText;
}
return rows;
}