Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Asp.NetÖÐWord,ExcelµÈoffice com×é¼þ²Ù×÷ȨÏÞµÄÎÊÌâ

½üÈÕÔÚ´ò¿ªÔ­À´Ð´µÄÒ»¸öÍøÒ³³ÌÐòÔËÐÐʱ£¬³öÏÖÁËExcel²Ù×÷ȨÏÞµÄÎÊÌ⣬¾ßÌåµÄ˵¾ÍÊÇÔÚ´úÂëÖе÷ÓÃÏÂÃæÕâ¶ÎÓëExcel²Ù×÷ÓйصÄÓï¾äʱ£¬
¡¡¡¡Application curExcelApp = new ApplicationClass();
¡¡¡¡ÌáʾȨÏÞ²»×㣬¾ßÌåµÄÌáʾÄÚÈÝÈçÏ£º
¡¡¡¡¼ìË÷ COM À๤³§ÖÐ CLSID Ϊ {00024500-0000-0000-C000-000000000046} µÄ×é¼þʱʧ°Ü£¬Ô­ÒòÊdzöÏÖÒÔÏ´íÎó: 80070005¡£
¡¡¡¡¡¡¡¡ËµÃ÷: Ö´Ðе±Ç° Web ÇëÇóÆڼ䣬³öÏÖδ´¦ÀíµÄÒì³£¡£Çë¼ì²é¶ÑÕ»¸ú×ÙÐÅÏ¢£¬ÒÔÁ˽âÓйظôíÎóÒÔ¼°´úÂëÖе¼Ö´íÎóµÄ³ö´¦µÄÏêϸÐÅÏ¢¡£ Òì³£ÏêϸÐÅÏ¢: system.UnauthorizedAccessException: ¼ìË÷ COM À๤³§ÖÐ CLSID Ϊ {00024500-0000-0000-C000-000000000046} µÄ×é¼þʱʧ°Ü£¬Ô­ÒòÊdzöÏÖÒÔÏ´íÎó: 80070005¡£ ASP.NET δ±»ÊÚȨ·ÃÎÊËùÇëÇóµÄ×ÊÔ´¡£Ç뿼ÂÇÊÚÓè ASP.NET ÇëÇó±êʶ·ÃÎÊ´Ë×ÊÔ´µÄȨÏÞ¡£ASP.NET ÓÐÒ»¸öÔÚÓ¦ÓóÌÐòûÓÐÄ£ÄâʱʹÓõĻù½ø³Ì±êʶ(ͨ³££¬ÔÚ IIS 5 ÉÏΪ {MACHINE}ASPNET£¬ÔÚ IIS 6 ÉÏΪÍøÂç·þÎñ)¡£Èç¹ûÓ¦ÓóÌÐòÕýÔÚͨ¹ý <identity impersonate="true"/> Ä£Ä⣬Ôò±êʶ½«ÎªÄäÃûÓû§(ͨ³£Îª IUSR_MACHINENAME)»ò¾­¹ýÉí·ÝÑéÖ¤µÄÇëÇóÓû§¡£ Òª½« ASP.NET ·ÃÎÊȨÏÞÊÚÓèij¸öÎļþ£¬ÇëÔÚ×ÊÔ´¹ÜÀíÆ÷ÖÐÓÒ»÷¸ÃÎļþ£¬Ñ¡Ôñ“ÊôÐÔ”£¬È»ºóÑ¡Ôñ“°²È«”Ñ¡Ï¡£µ¥»÷“Ìí¼Ó”Ìí¼ÓÊʵ±µÄÓû§»ò×顣ͻ³öÏÔʾ ASP.NET ÕÊ»§£¬Ñ¡ÖÐËùÐè·ÃÎÊȨÏÞ¶ÔÓ¦µÄ¿ò¡£ Ô´´íÎó: ¡¡¡¡¡¡¡¡ ÐÐ 533:¡¡¡¡¡¡¡¡//´´½¨ExcelÐÅÏ¢¡¡¡¡¡¡¡¡
ÐÐ 534:¡¡¡¡¡¡¡¡object missing = system.Reflection.Missing.Value;¡¡¡¡¡¡¡¡
ÐÐ 535:¡¡¡¡¡¡¡¡Application curExcelApp = new ApplicationClass();¡¡¡¡¡¡¡¡
ÐÐ 536:¡¡¡¡¡¡¡¡curExcelApp.Application.DisplayAlerts = false;¡¡¡¡¡¡¡¡
ÐÐ 537:¡¡¡¡¡¡¡¡Workbook curWorkBook = curExcelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
¡¡¡¡Ô­À´Åöµ½¹ýÕâÖÖÇé¿ö£¬ÖªµÀÊÇÓÉÓÚExcelµÄDCom×é¼þȨÏÞ²»×ãËùÒýÆðµÄ£¬ËùÒÔ°´ÕÕÔ­À´µÄ²½Öè½øÐÐÉèÖã¬ÈçÏÂËùʾ£º
¡¡¡¡1:ÔÚ·þÎñÆ÷ÉÏ°²×°officeµÄExcelÈí¼þ;
¡¡¡¡2:ÔÚ"¿ªÊ¼"->"ÔËÐÐ"ÖÐÊäÈëdcomcnfg.exeÆô¶¯"×é¼þ·þÎñ";
¡¡¡¡3:ÒÀ´ÎË«»÷"×é¼þ·þÎñ"->"¼ÆËã»ú"->"ÎҵĵçÄÔ"->"DCOMÅäÖÃ";
¡¡¡¡4:ÔÚ"DCOMÅäÖÃ"ÖÐÕÒµ½"Microsoft Excel Ó¦ÓóÌÐò",ÔÚËüÉÏÃæµã»÷ÓÒ¼ü,È»ºóµã»÷"ÊôÐÔ",µ¯³ö"Microsoft Excel Ó¦ÓóÌÐòÊôÐÔ"¶Ô»°¿ò;
¡¡¡¡5:µã»÷"±êʶ"±êÇ©,Ñ¡Ôñ"½»»¥Ê½Óû§";
¡¡¡¡6:µ


Ïà¹ØÎĵµ£º

·µ»Ø°´Å¥µÄʵÏÖ·½·¨£¨asp.net ÖУ©


·µ»Ø°´Å¥µÄʵÏÖ·½·¨£¨asp.net ÖУ©
Òý×Ô:http://blog.sina.com.cn/s/blog_49df2d0b0100aqoy.html
·µ»ØÉÏÒ»Ò³µÄÕâ¸ö¶«¶«ÔÚÎÒÃÇ×öÏîÄ¿µÄʱºòÒ»°ãÊÇÓÃÓÚÌîдÍê±íµ¥ºóÈ·ÈϵÄʱºò£¬ÓжÔÔ­À´ÊäÈëµÄÊý¾Ý½øÐÐÐÞ¸ÄʱÓõģ¬»òÕßÊÇÒòΪÍøվΪÁË·½±ãä¯ÀÀÕ߶øÓÐÐÄÌí¼Ó µÄÒ»¸ö¶«¶«£¬Ò»°ãÕâÖÖ¹¦ÄܵÄʵÏÖÔÚASP.netÖж¼ÊÇÓÃÒ»¸öbuttonµÄ¿ ......

ÔÚASP.NETÖÐʹÓÃË®¾§±¨±í

      Ê×ÏÈÃèÊöÒ»ÏÂÎÊÌâ:ÒòΪ¿Í»§µÄÐèÒª,°ÑËùÓжÔÓÚÊý¾Ý¿âµÄ²Ù×÷×ö³ÉÁË´æ´¢¹ý³Ì,ͬʱҲ´æÔÚ´øÓÐÊäÈë²ÎÊýµÄ´æ´¢¹ý³Ì.¿Í»§ÒªÇó½«ËùÓеÄÐÅÏ¢¶¼¿ÉÒÔÓÃË®¾§±¨±íÏÔʾ.ÎÒÃǶ¼ÖªµÀ,ҪʹÓÃË®¾§±¨±íÎÒÃǾÍҪʹÓÃÊý¾ÝÔ´µÄ.ÔÚÕâÀï,ÎÒÃÇʹÓõÄÊý¾ÝÔ´×ÔÈ»¶øȻҲ¾ÍÊÇ´æ´¢¹ý³ÌÁË.µ±È»,ÎÒÃÇÒ²ÊÇÖªµÀµÄ,ÔÚADO.NETµÄÁ ......

asp.netºǫ́Ïòǰ̨ע²ájsº¯ÊýºÍÊý×é

1. ×¢²ájsº¯Êý
String scriptString = "<script language=JavaScript>function doClick(){";
scriptString += "for(var index=0;index<myArray.length;index++)";
scriptString += "alert(myArray[index]);}<";
scriptString += "/" + "script>";
ClientScript.RegisterStartupScript(typeof(WebForm2) ......

ASP.NET µÄһЩ³£Óü¼Çɱ¸Íü1

1 »ñÈ¡´íÎóÐÅÏ¢²¢µ½Ö¸¶¨Ò³Ã治ҪʹÓÃResponse.Redirect,¶øÓ¦¸ÃʹÓÃServer.Transfer
e.g
// in global.asax
protected void Application_Error(Object sender, EventArgs e) {
if (Server.GetLastError() is HttpUnhandledException)
Server.Transfer("MyErrorPage.aspx");
//ÆäÓàµÄ·ÇHttpUnhandledExceptio ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ