Microsoft Office ¹®¼¸¦ Microsoft Visual C# .NET Æû¿¡ Á÷Á¢ Ç¥½ÃÇϰųª Æ÷ÇÔ½ÃŰ·Á°í ÇÒ ¼ö ÀÖ½À´Ï´Ù. Visual C# .NET¿¡¼´Â Æû¿¡ Office ¹®¼¸¦ Æ÷ÇÔ½Ãų ¼ö ÀÖ´Â OLE ÄÁÆ®·ÑÀ» Á¦°øÇÏÁö ¾Ê½À´Ï´Ù. Visual C# .NET Æû¿¡ ±âÁ¸ ¹®¼¸¦ Æ÷ÇÔ½ÃÄѼ À̸¦ ÇöÀç À§Ä¡ÀÇ ActiveX ¹®¼ °³Ã¼·Î¼ ¿·Á´Â °æ¿ì Microsoft
WebBrowser ÄÁÆ®·ÑÀ» »ç¿ëÇÏ´Â °Íµµ ÇÑ °¡Áö °¡´ÉÇÑ ¹æ¹ýÀÔ´Ï´Ù.
ÀÌ ¹®¼¿¡¼´Â
WebBrowser ÄÁÆ®·ÑÀ» »ç¿ëÇÏ¿© Visual C# .NET Æû ³»¿¡¼ ±âÁ¸ÀÇ Office ¹®¼¸¦ Ž»öÇϰí Ç¥½ÃÇÏ´Â ¹æ¹ýÀ» ¼³¸íÇÕ´Ï´Ù.
ActiveX ¹®¼´Â »ðÀÔ °¡´ÉÇÑ OLE °³Ã¼·Î¼, ±âÁ¸ OLE °³Ã¼º¸´Ù´Â ActiveX ÄÁÆ®·Ñ°ú ºñ½ÁÇÏ°Ô µ¿ÀÛÇÕ´Ï´Ù. ±âÁ¸ÀÇ Æ÷ÇÔ °³Ã¼¿Í ´Þ¸® ActiveX ¹®¼´Â ´õ Å« ¹®¼¿¡ Æ÷ÇԵǵµ·Ï ¼³°èµÇÁö ¾Ê¾Ò½À´Ï´Ù. ´ë½Å, ActiveX ¹®¼´Â ÀÚüÀûÀ¸·Î ¿ÏÀüÇÑ ¹®¼·Î °£ÁֵǾî Microsoft Internet Explorer°ú °°Àº ÀÀ¿ë ÇÁ·Î±×·¥À» »ç¿ëÇÏ¿© Ç¥½ÃµÇ°Å³ª Microsoft Office Binder ÆÄÀÏ °°Àº ´Ù¸¥ ¹®¼¿Í ÇÔ²² ´ÜÀÏ ¸®¼Ò½º·Î ¼öÁýµË´Ï´Ù.
WebBrowser ÄÁÆ®·Ñ¿¡¼ È£½ºÆ®µÇ´Â ActiveX ¹®¼´Â Ç×»ó Ȱ¼ºÈµÇ¾î ÀÖÀ¸¹Ç·Î ±âÁ¸ÀÇ OLE Æ÷ÇÔ °³Ã¼¿Í ´Þ¸® ÇöÀç À§Ä¡ Ȱ¼ºÈ¶ó´Â Àǹ̰¡ ¾ø½À´Ï´Ù.
ÇöÀç Microsoft Visual C# .NET¿¡¼´Â ActiveX ¹®¼¸¦ Á÷Á¢ È£½ºÆ®ÇÒ ¼ö ¾øÁö¸¸ ÀÌ·¯ÇÑ ¸ñÀûÀ¸·Î
WebBrowser ÄÁÆ®·ÑÀ» »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
WebBrowser ÄÁÆ®·Ñ(Shdocvw.dll)Àº Internet ExplorerÀÇ ÀϺκÐÀ¸·Î Internet Explorer¸¦ ¼³Ä¡ÇÑ ½Ã½ºÅÛ¿¡¼¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
Office ¹®¼¸¦ ¿©´Â Visual C# .NET ÀÀ¿ë ÇÁ·Î±×·¥ ¸¸µé±â
Office ¹®¼¸¦ ¿©´Â Visual C# .NET ÀÀ¿ë ÇÁ·Î±×·¥À» ¸¸µå´Â ¹æ¹ýÀº ´ÙÀ½°ú °°½À´Ï´Ù.
- Visual C# .NET¿¡¼ »õ Windows ÀÀ¿ë ÇÁ·Î±×·¥ ÇÁ·ÎÁ§Æ®¸¦ ¸¸µì´Ï´Ù. ±âº»ÀûÀ¸·Î Form1ÀÌ ¸¸µé¾îÁý´Ï´Ù.
- µµ±¸ ¸Þ´º¿¡¼ µµ±¸ »óÀÚ »ç¿ëÀÚ ÁöÁ¤À» ´·¯ µµ±¸ »óÀÚ »ç¿ëÀÚ ÁöÁ¤ ´ëÈ »óÀÚ¸¦ ¿±´Ï´Ù. COM ±¸¼º ¿ä¼Ò ÅÇ¿¡¼ Microsoft WebBrowser¿¡ ´ëÇÑ ÂüÁ¶¸¦ Ãß°¡ÇÕ´Ï´Ù. È®ÀÎÀ» ´·¯ Windows Form µµ±¸ »óÀÚ¿¡ WebBrowser ÄÁÆ®·ÑÀ» Ãß°¡ÇÕ´Ï´Ù. µµ±¸ »óÀÚ¿¡ Explorer¶ó´Â ÅØ½ºÆ®¸¦ °¡Áø WebBrowser ÄÁÆ®·ÑÀÌ ³ªÅ¸³³´Ï´Ù.
- ÀÌ µµ±¸ »óÀÚ¸¦ »ç¿ëÇÏ¿© WebBrowser ÄÁÆ®·Ñ, OpenFileDialog ÄÁÆ®·Ñ ¹× CommandButton ÄÁÆ®·ÑÀ» Form1¿¡ Ãß°¡ÇÕ´Ï´Ù. ±×·¯¸é Form1 Ŭ·¡½º¿¡ AxWebBrowser1, OpenFileDialog1 ¹× Button1 ±¸¼º¿øÀÌ Ãß°¡µË´Ï´Ù.
- Form1¿¡¼ Button1À» µÎ ¹ø ´©¸¨´Ï´Ù. ÀÌ·¸°Ô Çϸé Form1¿¡ Button1_Click À̺¥Æ®°¡ Ãß°¡µË´Ï´Ù.
- Form1ÀÇ ÄÚµå â¿¡¼ ´ÙÀ½ ³×ÀÓ½ºÆäÀ̽º¸¦ ¸ñ·Ï¿¡ Ãß°¡ÇÕ´Ï´Ù.
- Form1 Ŭ·¡½ºÀÇ private ¸â¹ö¸¦ ¾Æ·¡¿Í °°ÀÌ Á¤ÀÇÇÕ´Ï´Ù.
private Object oDocument;
- Form1 Ŭ·¡½ºÀÇ InitializeComponent ¸Þ¼µå ³¡¿¡ Form1_Load, Form1_Closed ¹× axWebBrowser1_NavigateComplete2 À̺¥Æ®¸¦ ó¸®ÇÏ´Â ´ÙÀ½ Äڵ带 Ãß°¡ÇÕ´Ï´Ù.
this.axWebBrowser1.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axWebBrowser1_NavigateComplete2);
this.Load += new System.EventHandler(this.Form1_Load);
this.Closed += new System.EventHandler(this.Form1_Closed);
- ´ÙÀ½ Äڵ带
private void button1_Click(object sender, System.EventArgs e)
{
}
¾Æ·¡ÀÇ ÄÚµå·Î ´ëüÇÕ´Ï´Ù.
private void button1_Click(object sender, System.EventArgs e)
{
String strFileName;
//Find the Office document.
openFileDialog1.FileName = "";
openFileDialog1.ShowDialog();
strFileName = openFileDialog1.FileName;
//If the user does not cancel, open the document.
if(strFileName.Length != 0)
{
Object refmissing = System.Reflection.Missing.Value;
oDocument = null;
axWebBrowser1.Navigate(strFileName, ref refmissing , ref refmissing , ref refmissing , ref refmissing);
}
}
public void Form1_Load(object sender, System.EventArgs e)
{
button1.Text = "Browse";
openFileDialog1.Filter = "Office Documents(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt" ;
openFileDialog1.FilterIndex = 1;
}
public void Form1_Closed(object sender, System.EventArgs e)
{
oDocument = null;
}
public void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
{
//Note: You can use the reference to the document object to
// automate the document server.
Object o = e.pDisp;
oDocument = o.GetType().InvokeMember("Document",BindingFlags.GetProperty,null,o,null);
Object oApplication = o.GetType().InvokeMember("Application",BindingFlags.GetProperty,null,oDocument,null);
Object oName = o.GetType().InvokeMember("Name",BindingFlags.GetProperty ,null,oApplication,null);
MessageBox.Show("File opened by: " + oName.ToString() );
}
- F5 ۸¦ ´·¯ ÇÁ·ÎÁ§Æ®¸¦ ½ÇÇàÇÕ´Ï´Ù. Browse¸¦ ´©¸£¸é ¿±â ´ëÈ »óÀÚ°¡ ³ªÅ¸³ª¸ç ÀÌ ´ëÈ »óÀÚ¸¦ ÅëÇØ Word ¹®¼, Excel ¿öÅ©½ÃÆ® ¶Ç´Â PowerPoint ÇÁ·¹Á¨Å×À̼ÇÀ» Ž»öÇÒ ¼ö ÀÖ½À´Ï´Ù. ÆÄÀÏÀ» ¼±ÅÃÇÑ ´ÙÀ½ ¿±â¸¦ ´©¸¨´Ï´Ù. WebBrowser ÄÁÆ®·Ñ ³»¿¡¼ ¹®¼°¡ ¿¸®°í ÇØ´ç Office ¹®¼ ¼¹öÀÇ À̸§À» Ç¥½ÃÇÏ´Â ¸Þ½ÃÁö »óÀÚ°¡ ³ªÅ¸³³´Ï´Ù.
WebBrowser ÄÁÆ®·Ñ »ç¿ë ½Ã °í·Á »çÇ×
WebBrowser ÄÁÆ®·ÑÀ» »ç¿ëÇÒ ¶§ ´ÙÀ½ »çÇ×À» °í·ÁÇØ¾ß ÇÕ´Ï´Ù.
- WebBrowser ÄÁÆ®·ÑÀº ¹®¼¸¦ ºñµ¿±âÀûÀ¸·Î Ž»öÇÕ´Ï´Ù. WebBrowser1.Navigate¸¦ È£ÃâÇÏ¸é ¹®¼¸¦ ¿ÏÀüÈ÷ ·ÎµåÇϱâ Àü¿¡ ÇØ´ç Visual C# ÀÀ¿ë ÇÁ·Î±×·¥¿¡ Á¦¾î°¡ ¹ÝȯµË´Ï´Ù. Æ÷ÇÔµÈ ¹®¼¸¦ ÀÚµ¿ÈÇÒ °èȹÀ̶ó¸é ÇØ´ç ¹®¼°¡ ¿ÏÀüÈ÷ ·ÎµåµÈ ½Ã±â¸¦ ¾Ë¸®µµ·Ï NavigateComplete2 À̺¥Æ®¸¦ »ç¿ëÇØ¾ß ÇÕ´Ï´Ù. Office ¹®¼ °³Ã¼¿¡ ´ëÇÑ ÂüÁ¶¸¦ °¡Á®¿À±â À§ÇØ Àü´ÞµÇ´Â WebBrowser °³Ã¼ÀÇ Document ¼Ó¼º(ÀÌÀü Äڵ忡¼ oDocument·Î ¼³Á¤µÊ)À» »ç¿ëÇÕ´Ï´Ù.
- WebBrowser ÄÁÆ®·ÑÀº ¸Þ´º º´ÇÕÀ» Áö¿øÇÏÁö ¾Ê½À´Ï´Ù.
- Internet Explorer ¹öÀü 5.0 À̻󿡼´Â ´ÙÀ½ Äڵ带 »ç¿ëÇÏ¿© µµÅ·µÈ µµ±¸ ¸ðÀ½À» Ç¥½ÃÇÒ ¼ö ÀÖ½À´Ï´Ù.
// This is a toggle option, so call it once to show the
// toolbars and once to hide them. This works with Internet Explorer 5
// but often fails to work properly with earlier versions.
Object refmissing = System.Reflection.Missing.Value;
axWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_HIDETOOLBARS, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER,ref refmissing , ref refmissing);
- ÇϳªÀÇ ÇÁ·ÎÁ§Æ®¿¡¼ µÑ ÀÌ»óÀÇ WebBrowser ÄÁÆ®·ÑÀ» »ç¿ëÇÏ¿© µ¿ÀÏÇÑ Á¾·ùÀÇ Office ¹®¼¸¦ ·ÎµåÇÏ¸é ¹®Á¦°¡ ¹ß»ýÇÏ´Â °ÍÀ¸·Î ¾Ë·ÁÁ® ÀÖ½À´Ï´Ù. Áï, ÄÁÆ®·Ñ ¸ðµÎ Word ¹®¼¸¸ ·ÎµåÇϰųª Excel ½ºÇÁ·¹µå½ÃÆ®¸¸ ·ÎµåÇÏ´Â °æ¿ì ¹®Á¦°¡ ¹ß»ýÇÕ´Ï´Ù. ÇÁ·ÎÁ§Æ®´ç ÄÁÆ®·ÑÀ» Çϳª¸¸ »ç¿ëÇϰí ÇÑ ¹ø¿¡ ÇϳªÀÇ ¹®¼¸¸ Ž»öÇÏ´Â °ÍÀÌ ÁÁ½À´Ï´Ù.
°¡Àå ÀϹÝÀûÀÎ ¹®Á¦´Â Microsoft Office ¸í·É ¸ðÀ½ÀÌ »ç¿ëÇÒ ¼ö ¾ø´Â °Íó·³ ³ªÅ¸³ª´Â °ÍÀÔ´Ï´Ù. °°Àº Æû¿¡ WebBrowser ÄÁÆ®·ÑÀÌ µÎ °³ ÀÖ°í, µÎ ÄÁÆ®·Ñ ¸ðµÎ Word ¹®¼¸¦ ·ÎµåÇϸç, ¾ÕÀÇ ¿¹Á¦ Äڵ带 »ç¿ëÇÏ¿© µµ±¸ ¸ðÀ½À» Ç¥½ÃÇÑ °æ¿ì ÇϳªÀÇ µµ±¸ ¸ðÀ½¸¸ Ȱ¼ºÈµÇ¾î Á¦´ë·Î ÀÛµ¿ÇÕ´Ï´Ù. ´Ù¸¥ µµ±¸ ¸ðÀ½Àº »ç¿ë ÇÒ ¼ö ¾ø´Â »óŰ¡ µÉ ¼ö ÀÖ½À´Ï´Ù. - ´Ù¸¥ ¸í·É ´ÜÃßÀÇ Click À̺¥Æ®(¶Ç´Â ÀûÀýÇÑ ÄÚµå ºÎºÐ)¿¡¼ WebBrowserÀÇ ÇöÀç ³»¿ëÀ» Áö¿ì·Á¸é ¾Æ·¡ÀÇ Äڵ带 »ç¿ëÇÏ¿© ±âº» ºó ÆäÀÌÁö·Î À̵¿Çϵµ·Ï ÇÕ´Ï´Ù.
AxWebBrowser1.Navigate("about:blank");
WebBrowser ÄÁÆ®·ÑÀ» »ç¿ëÇÏ´Â µ¥ ´ëÇÑ ÀÚ¼¼ÇÑ ³»¿ëÀº Microsoft ±â¼ú ÀÚ·áÀÇ ´ÙÀ½ ¹®¼¸¦ ÂüÁ¶ÇϽʽÿÀ.
304562
(http://support.microsoft.com/kb/304562/
)
INFO: Visual Studio .NET¿¡¼´Â Win Forms¿ë OLE ÄÁÅ×ÀÌ³Ê ÄÁÆ®·ÑÀ» Á¦°øÇÏÁö ¾Ê´Â´Ù
243058
(http://support.microsoft.com/kb/243058/
)
WebBrowser ÄÁÆ®·ÑÀ» »ç¿ëÇÏ¿© Office ¹®¼¸¦ ¿©´Â ¹æ¹ý
162719
(http://support.microsoft.com/kb/162719/
)
Visual Basic 5.0¿¡¼ WebBrowser ÄÁÆ®·ÑÀ» »ç¿ëÇÏ´Â ¹æ¹ý
202476
(http://support.microsoft.com/kb/202476/
)
BUG: OLE ¶Ç´Â WebBrowser ÄÁÆ®·Ñ¿¡¼ Word ¹®¼¸¦ ÆíÁýÇÒ ¼ö ¾ø´Ù
188271
(http://support.microsoft.com/kb/188271/
)
VB¿¡¼ Web Browser ÄÁÆ®·ÑÀÇ ³»¿ëÀ» ÀμâÇÏ´Â ¹æ¹ý
191692
(http://support.microsoft.com/kb/191692/
)
PRB: Shdocvw.dllÀÌ PDW ¼³Ä¡ ÆÐŰÁö¿¡ Æ÷ÇÔµÇÁö ¾Ê´Â´Ù
238313
(http://support.microsoft.com/kb/238313/
)
PRB: Visual Basic¿¡¼ Internet Explorer ¹®¼ °³Ã¼ ¸ðµ¨ ¾×¼¼½º
Microsoft Á¦Ç° °ü·Ã ±â¼ú Àü¹®°¡µé°ú ¿Â¶óÀÎÀ¸·Î Á¤º¸¸¦ ±³È¯ÇϽ÷Á¸é Microsoft ´º½º ±×·ì
(http://support.microsoft.com/newsgroups/default.aspx)
¿¡ Âü¿©ÇϽñ⠹ٶø´Ï´Ù.±â¼ú ÀÚ·á: 304662 - ¸¶Áö¸· °ËÅä: 2005³â 9¿ù 16ÀÏ ±Ý¿äÀÏ - ¼öÁ¤: 6.3
º» ¹®¼ÀÇ Á¤º¸´Â ´ÙÀ½ÀÇ Á¦Ç°¿¡ Àû¿ëµË´Ï´Ù.
- Microsoft Visual C# .NET 2002 Standard Edition
- Microsoft Office Excel 2003
- Microsoft Excel 2002 Standard Edition
- Microsoft Excel 2000 Standard Edition
- Microsoft Office PowerPoint 2003
- Microsoft PowerPoint 2002 Standard Edition
- Microsoft PowerPoint 2000 Standard Edition
- Microsoft Office Word 2003
- Microsoft Word 2002 Standard Edition
- Microsoft Word 2000 Standard Edition
| kbhowto kbactivedocs kbwebbrowser kbautomation KB304662 |