ASP.NET¶ÁÈ¡wordµ½Ò³Ãæ
JavaScriptʵÏÖ£º
<mce:script type ="text/javascript" ><!--
function readWord()
{
var div1=document .getElementById ("div1");
var WordApp,WordDoc,Str;
WordApp =new ActiveXObject ("Word.application");
WordDoc =WordApp.Documents.Open("F:\\¹¤×÷ÈÕÖ¾.doc");
Str =WordDoc .content.text;
WordDoc .close();
WordApp .quit();
div1.innerHTML =Str ;
}
// --></mce:script>
<div id="div1">
</div>
<input id="Button2" type="button" value="button" OnClick ="readWord();"/>
C#ʵÏÖ£º£¨Ìí¼ÓofficeÒýÓã©
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
protected void Page_Load(object sender, EventArgs e)
{
this .Literal1 .Text =GetTest ("F:\\¹¤×÷ÈÕÖ¾.doc");
}
public string GetTest(string FileName)
{
Microsoft.Office.Interop.Word.ApplicationClass WordApi = new Microsoft.Office.Interop.Word.ApplicationClass();
object fileObject = FileName;
object nullobj = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document doc = WordApi.Documents.Open(ref fileObject, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
string StrText = doc.Content.Text;
doc.Close(ref nullobj, ref nullobj, ref nullobj);
WordApi.Quit(ref nullobj, ref nullobj, ref nullobj);
return StrText;
}
Ïà¹ØÎĵµ£º
ÌõÐÎÂëÊÇÆù½ñΪֹ×á¢ÊµÓõÄÒ»ÖÖ×Ô¶¯Ê¶±ð¼¼Êõ¡£ÌõÐÎÂë¼¼Êõ¾ßÓÐÒÔϼ¸¸ö·½ÃæµÄÓŵã
¡¡¡¡A£®ÊäÈëËٶȿ죺Óë¼üÅÌÊäÈëÏà±È£¬ÌõÐÎÂëÊäÈëµÄËÙ¶ÈÊǼüÅÌÊäÈëµÄ5±¶£¬²¢ÇÒÄÜʵÏÖ“¼´Ê±Êý¾ÝÊäÈ딡£
¡¡¡¡B£®¿É¿¿ÐԸߣº¼üÅÌÊäÈëÊý¾Ý³ö´íÂÊΪÈý°Ù·ÖÖ®Ò»£¬ÀûÓùâѧ×Ö·ûʶ±ð¼¼Êõ³ö´íÂÊΪÍò·ÖÖ®Ò»£¬¶ø²ÉÓÃÌõÐÎÂë¼¼ÊõÎóÂëÂʵ ......
·ÖÒ³Õâ¸öÒ²ÊÇ×î¶àÈËÎʵģ¬Ò²ÊǺܻù´¡ºÜʵÓõġ£
ÍøÉÏÓкܶà·ÖÒ³´úÂë,Òª²»ÊÇÓÐǰ̨¾Íûºǫ́,Òª²»ÊÇÓкǫ́ûǰ̨,Òª²»ÊǾÍÊǿؼþ,Òª²»¾ÍÊÇÒ»´ó¶ÑSQL´úÂ룬ÈÃÈ˲»ÖªµÀÔõÑùÓá£
Á¦Çó×î¼òµ¥×îÒ׶®.Èý²ã¼Ü¹¹ÄÇЩ¾Í²»¸ãÁË¡£×Ô¼ºÏÂÔØÒ»¸ö
Èç¹ûÊÇaccess ¾ÍÓÃÕâ¸öSQLHELPER [URL=http://hi.csdn.net/link.php?url=http://blo ......
ÍøÒ³ÖÐÓÃTextBoxÈÃÓû§ÊäÈëÎı¾£¬È»ºó´æÈëÊý¾Ý¿â£¬ÔÙ´ÓÊý¾Ý¿âÖжÁ³öÏÔʾÔÚÒ³ÃæÉÏ¡£³£³£ÕâÑù×ö»áÓöµ½²»ÉÙÎÊÌ⣬ÒòΪTextBoxʵ¼ÊÉÏÊÇÒ»¸öWindows×é¼þ£¬ºÍÍøÒ³ÏÔʾ±ê¼ÇÈ磺<p>,<td>,<div>µÈ£¬¶Ô×Ö·ûµÄ½âÎö·½·¨ÊDz»Í¬µÄ¡£±ÈÈçÇ°ÕߵĻ»Ðбê¼ÇΪ“\r\n”£¬¶øºóÕßΪ“<br>”¡£Õ ......
ASP.NETÒ³Ãæˢз½·¨×ܽá
ÏÈ¿´¿´ASP.NETÒ³ÃæˢеÄʵÏÖ·½·¨£º
µÚÒ»£º
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } µÚ¶þ£º
private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " < script langua ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
/// <summary>
/// һЩ³£ÓõÄJsµ÷ÓÃ
/// Ìí¼Óаæ˵Ã÷£ºÓÉÓھɰæÆÕ±é²ÉÓÃResponse.Write(string msg)µÄ·½Ê½Êä³öjs½Å±¾£¬ÕâÖÖ
/// ·½Ê½Êä³öµÄjs½Å±¾»áÔÚhtmlÔªËصÄ<html>&a ......