C#如何读取word指定行数一行的数据呢?我正在使用《Csdn收音机》第一时间获取最新动态!

解决方案 »

  1.   

    自己顶一个!我正在使用《Csdn收音机》第一时间获取最新动态!
      

  2.   

    http://winsystem.ctocio.com.cn/392/9325892.shtmlhttp://www.cnblogs.com/waynewjp/archive/2009/07/08/1518844.html
      

  3.   

    通过书签获取特定数据
    读取内容分割
    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();
      

  4.   

    本人通过字符流转换的 算是解决了//写入文件  private void button5_Click(object sender, EventArgs e)
            {
                try
                {
                    FileStream fs = new FileStream("c.txt", FileMode.Create);
                    StreamWriter sw = new StreamWriter(fs);
                    sw.WriteLine(this.textBox5.Text);
                    sw.Close();
                    fs.Close();            }
                catch (IOException ec)
                { MessageBox.Show(ec.Message ); }
            }
    //一行行读出文件
     try
                {
                    FileStream fs = new FileStream("c.txt", FileMode.Open);
                    StreamReader sr = new StreamReader(fs);
                    string line = "";
                    string s="";
                    while ((line = sr.ReadLine()) != null)
                    {
                        s += line;
                    }
                    this.textBox6.Text = s;
                    sr.Close();
                    fs.Close();            }
                catch (IOException ec)
                { MessageBox.Show(ec.Message ); }我正在使用《Csdn收音机》第一时间获取最新动态!
      

  5.   

    Word设置了不同页面格式,行数是不同的,因此,我估计没法读取指定行数。