如题!不是导出哦!
解决方案 »
- 通过鼠标点击,获取文件夹/文件的绝对路径
- ===求助:点击treeview后如何在控制属性页的显示?===
- 在fromwork 2.0 下 c# 发邮件 的几种方法怎么都出错啊
- 新手有问题请教。。。
- 一个关于TCPC通讯的问题
- 如何获取在folderbrowserdialog选中的文件夹中的文件列表?
- 不想做复合控件,想在文本框里加个按钮(请saucer(思归)、Eddie005(暴走005)以及各位老大帮助)
- 为什么窗口不能显示在最上层?
- 谁有水晶报表教程?欢迎提供一二
- 如何将一个文件转换成二进制文件
- C#中Panel中画图像问题,个位帮忙看看!!!
- 求助 关于C++ 的 IDCARD_ALL & card 参数如何在C#中调用
string file = this.File1.PostedFile.FileName;//EXCEL的连接地址
string conn = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source ="+file+";Extended Properties=Excel 8.0";
//OleDbConnection MyConn = new OleDbConnection(conn);
////取出数据
DataSet ds = new DataSet();
string Sql = "select * from [Sheet1$]";
MyConn.Open();
OleDbDataAdapter MyDataAdapter = new OleDbDataAdapter(Sql, MyConn);
////把取出的数据放入DATASET中,以防有多个表 MyDataAdapter.Fill(ds,"table1");
GridView1.DataSource = ds.Tables["table1"];
GridView1.DataBind();
MyConn.Close();WORD没有处理过
{//保存为WORD文件
if(this.richTextBox1.Text=="")
return;
if(this.saveFileDialog1.ShowDialog()==DialogResult.Cancel)
return;
string FileName=this.saveFileDialog1.FileName;
if(FileName.Length<1)
return;
FileName+=".doc";
try
{
Word.ApplicationClass MyWord=new Word.ApplicationClass();
Word.Document MyDoc;
Object Nothing=System.Reflection.Missing.Value;
MyDoc=MyWord.Documents.Add(ref Nothing,ref Nothing,ref Nothing,ref Nothing);
MyDoc.Paragraphs.Last.Range.Text=this.richTextBox1.Text;
object MyFileName=FileName;
//将WordDoc文档对象的内容保存为DOC文档
MyDoc.SaveAs(ref MyFileName,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing,ref Nothing);
//关闭WordDoc文档对象
MyDoc.Close(ref Nothing, ref Nothing, ref Nothing);
//关闭WordApp组件对象
MyWord.Quit(ref Nothing, ref Nothing, ref Nothing);
MessageBox.Show("WORD文件保存成功","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
catch(Exception Err)
{
MessageBox.Show("WORD文件保存操作失败!"+Err.Message,"信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
用ADO访问