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;
}
相关文档:
状态管理是你对同一页或不同页的多个请求维护状态和页信息的过程。与所有基于 HTTP 的技术一样,Web 窗体页是无状态的,这意味着它们不自动指示序列中的请求是否全部来自相同的客户端,或者单个浏览器实例是否一直在查看页或站点。此外,到服务器的每一往返过程都将销毁并重新创建页;因此,如果超出了单个页的生命周期,页 ......
为什么要去了解ASP.NET运行时模型(HTTPRuntime)
在学习ASP.NET之前,最好先学习一下ASP.NET的运行时模型,其实ASP.NET的编程模型分为ASP.NET的运行时模型和页面变成模型。许多的参考书只是直接的介绍ASP.NET的页面编程模型,而忽略了运行时模型,页面编程模型是ASP.NET程序员主要做的事情,但在做这些工作之前,充分的 ......
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 ......
转载于:http://hi.baidu.com/juzi119/blog/item/d4bf9a4b7cea7df583025c9e.html
C 货币 2.5.ToString("C") ¥2.50
D 十进制数 25.ToString("D5") 00025
E 科学型 25000.ToString("E") 2.500000E+005
F 固定点 25.ToString("F2") 25.00
G 常规 2.5.ToString("G") 2.5
N 数字 2500000. ......
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 ......