C#如何读取word指定行数数据 C#如何读取word指定行数一行的数据呢?我正在使用《Csdn收音机》第一时间获取最新动态! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自己顶一个!我正在使用《Csdn收音机》第一时间获取最新动态! http://winsystem.ctocio.com.cn/392/9325892.shtmlhttp://www.cnblogs.com/waynewjp/archive/2009/07/08/1518844.html 通过书签获取特定数据读取内容分割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(); 本人通过字符流转换的 算是解决了//写入文件 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收音机》第一时间获取最新动态! Word设置了不同页面格式,行数是不同的,因此,我估计没法读取指定行数。 关于C#调用系统中的WinRAR软件,来解压带密码压缩文件的问题 求助(急) 需要Html Dom Parser 用c# 实现winform 下的多行文字输出,以及图片输出,用那些控件? 在AD中,如何设置用户的过期时间 枚举做参数的问题 谢谢啊 v c# 中怎么在Form2中引用Form1中textBox中的数值进行计算?急急急!!!谢谢大家了!!! javascript怎么获得地址拦中的参数 windows服务中如何启动一个有界面的进程? c#每日一题(十二) C#代码和界面放在一页里了,怎样使用using 访问数据库的SQLHelper.cs如何写才是最优的?
读取内容分割
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();
{
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收音机》第一时间获取最新动态!