100分求如何使用C#读取word文档第一页并给页面截图 请问如何使用C#读取word文档第一页并给页面截图? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 或则说如何使用C#对word文档第一页,第二页截图,有没有办法用C#只读取word文档的第一页的内容。 屏幕截图Word.ApplicationClass wordApp=new ApplicationClass();object file=path;object nullobj=System.Reflection.Missing.Value; Word.Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);doc.ActiveWindow.Selection.WholeStory();doc.ActiveWindow.Selection.Copy();IDataObject data=Clipboard.GetDataObject();string str=data.GetData(DataFormats.Text).ToString();doc.Close(); Word.ApplicationClass app = null; Word.Document doc = null; object missing = System.Reflection.Missing.Value; object FileName = Server.MapPath("123.doc");\ReadFromWordDoc\test.doc"; object readOnly = true; object isVisible = false; try { app = new Word.ApplicationClass(); doc = app.Documents.Open(ref FileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); string textString = doc.Content.Text; Response.Write(textString); }catch(Exception) { throw; } http://www.cnblogs.com/sunshine-anycall/archive/2009/08/22/1551974.html http://www.cnblogs.com/sunshine-anycall/archive/2009/08/25/1553273.html http://blog.felipel.com/post/Upload-and-Crop-Images-with-ASPNET-and-jCrop-Revisited!.aspx http://hi.baidu.com/%B4%F3%CE%B0/blog/item/4b40ba99b7c929036f068c5c.html http://kb.cnblogs.com/page/47074/这都是一些很好的程序截图例子。我就是按这个做的。 http://www.cnblogs.com/sunshine-anycall/archive/2009/08/22/1551974.html http://www.cnblogs.com/sunshine-anycall/archive/2009/08/25/1553273.html http://blog.felipel.com/post/Upload-and-Crop-Images-with-ASPNET-and-jCrop-Revisited!.aspx http://hi.baidu.com/%B4%F3%CE%B0/blog/item/4b40ba99b7c929036f068c5c.html http://kb.cnblogs.com/page/47074/这都是一些很好的程序截图例子。我就是按这个做的。 菜鸟学jquery求救 求一WAP浏览器下载地址,装在PC机上用于调试WAP网页 字符串的截取 获得URL地址 不支持服务器控件怎么办? asp.net下拉菜单问题 请问如何将FreeTextBox上显示的默认字体修改为 14px 呢? 请教绑定Repeater控件问题,急,谢谢~ 急啊!帮帮忙 请教一个比较菜的问题! 个人注册TQ号 asp.net 读取下载的文件
Word.ApplicationClass wordApp=new ApplicationClass();
object file=path;
object nullobj=System.Reflection.Missing.Value;
Word.Document doc = wordApp.Documents.Open(
ref file, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj);doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
IDataObject data=Clipboard.GetDataObject();
string str=data.GetData(DataFormats.Text).ToString();
doc.Close();
Word.Document doc = null;
object missing = System.Reflection.Missing.Value;
object FileName = Server.MapPath("123.doc");
\ReadFromWordDoc\test.doc";
object readOnly = true;
object isVisible = false;
try
{
app = new Word.ApplicationClass();
doc = app.Documents.Open(ref FileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
string textString = doc.Content.Text;
Response.Write(textString);
}catch(Exception)
{
throw;
}