易截截图软件、单文件、免安装、纯绿色、仅160KB

C# word转换成HTML

C# word转换成HTML
添加com引用Microsoft word 11.0 Object Library
添加using System.Threading;using System.IO;
       //实例化一个Word
        Microsoft.Office.Interop.Word.ApplicationClass appclass = new Microsoft.Office.Interop.Word.ApplicationClass();
       Type wordtype = appclass.GetType();
       
        Microsoft.Office.Interop.Word.Documents docs = appclass.Documents;//获取Document
        Type docstype = docs.GetType();
        object filename = @"E:\AA.doc";//Word文件的路径
        Microsoft.Office.Interop.Word.Document doc = (Microsoft.Office.Interop.Word.Document)docstype.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, docs, new object[] { filename, true, true });//打开文件
        Type doctype = doc.GetType();
        object savefilename = @"E:\bb.html";//生成HTML的路径和名子
        doctype.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod, null, doc, new object[] { savefilename, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML });//另存为Html格式
       
wordtype.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, appclass, null);//退出
       
        Thread.Sleep(3000);//为了使退出完全,这里阻塞3秒
        StreamReader objreader = new StreamReader(savefilename.ToString(), System.Text.Encoding.GetEncoding("GB2312")); 
       //以下内容是为了在Html中加入对本身Word文件的下载      
  


相关文档:

C# 与flasH 开发 碰到问题随便写写

额 这两天继续写那个 抽奖程序。。
先是 写好了 按几等奖 几个人的 界面可以抽出来了号码于是在找了winform的皮肤界面。还不错。。
给 assistant杨看然后又给我说 没滚动的效果 看起来不好 没抽奖的刺激感。
然后再到网上找了个 滚动效果的 FLASH。。
接着找了一天终于知道了 FLASH 的编程语言 如何简单修改。。。 ......

Javascript函数中调用C#方法

一、后台(.cs文件)方法:
       public string GetString(string name)
        {
            return ("Hello " + name);
        }
&n ......

C#中用XmlDocument对象获取XML文件中的节点值

 xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<bookstore>
  <book>
    <title lang="eng">Harry Potter</title>
    <price>29.99</price>
  </book>
  <book>
......

在C#里创建和使用C风格数据结构

在C#里创建和使用C风格数据结构,即非托管的数据结构,可以提高性能。
1 数据结构的定义
看下面例子:
    unsafe struct A {
        public int x;
    }
    unsafe struct B {
        pu ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号