wpfandExcel将窗体的数据导出到Excel表并进行打印.rar

上传者: lvxiong15 | 上传时间: 2021-06-23 12:13:37 | 文件大小: 59KB | 文件类型: RAR
namespace wpfandExcel { /// /// Window1.xaml 的交互逻辑 /// public partial class Window1 : Window { public Window1() { InitializeComponent(); } //声明变量 Excel.Application objApp; Excel._Workbook objBook; //定义路径 // //wpf中路径的设定 public string Excelpath = AppDomain.CurrentDomain.BaseDirectory + "info.xls"; /// /// 执行将数值输入到excel表并进行打印 /// public void OpenExcel() { //创建Excel控件对象 Excel.Workbooks objBooks; Excel.Sheets objSheets; Excel._Worksheet objSheet; Excel.Range range; try { // Instantiate Excel and start a new workbook. objApp = new Excel.Application();//启动程序 objBooks = objApp.Workbooks; //启动工作模板 objBook = objBooks.Add(Excelpath); objSheets = objBook.Worksheets; objSheet = (Excel._Worksheet)objSheets.get_Item(1); #region 将数值导出Excel表 // //姓名 range = objSheet.get_Range("A2", "A2"); range.Value2 = this.textBox1.Text; //+ " 号"; // //年龄 range = objSheet.get_Range("B2", "B2"); range.Value2 = this.textBox2.Text; // # endregion // //将excel显示出来 objApp.Visible = true; objApp.UserControl = true; //打印预览 objSheet.PrintPreview(true); //objSheet. //隐藏Excel窗口 //objApp.Visible = false; } catch (Exception theException) { String errorMessage; errorMessage = "Error: "; errorMess

文件下载

资源详情

[{"title":"( 29 个子文件 59KB ) wpfandExcel将窗体的数据导出到Excel表并进行打印.rar","children":[{"title":"wpfandExcel","children":[{"title":"wpfandExcel.sln <span style='color:#111;'> 923B </span>","children":null,"spread":false},{"title":"wpfandExcel.suo <span style='color:#111;'> 18.50KB </span>","children":null,"spread":false},{"title":"wpfandExcel","children":[{"title":"wpfandExcel.csproj.user <span style='color:#111;'> 547B </span>","children":null,"spread":false},{"title":"bin","children":[{"title":"Debug","children":[{"title":"wpfandExcel.pdb <span style='color:#111;'> 23.50KB </span>","children":null,"spread":false},{"title":"wpfandExcel.vshost.exe <span style='color:#111;'> 13.99KB </span>","children":null,"spread":false},{"title":"wpfandExcel.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"wpfandExcel.exe <span style='color:#111;'> 30.50KB </span>","children":null,"spread":false},{"title":"info.xls <span style='color:#111;'> 10.40KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"whstart.ico <span style='color:#111;'> 9.90KB </span>","children":null,"spread":false},{"title":"obj","children":[{"title":"Debug","children":[{"title":"wpfandExcel.g.resources <span style='color:#111;'> 11.51KB </span>","children":null,"spread":false},{"title":"Window1.g.cs <span style='color:#111;'> 4.44KB </span>","children":null,"spread":false},{"title":"wpfandExcel_MarkupCompile.cache <span style='color:#111;'> 287B </span>","children":null,"spread":false},{"title":"Window1.baml <span style='color:#111;'> 1.36KB </span>","children":null,"spread":false},{"title":"App.g.cs <span style='color:#111;'> 2.04KB </span>","children":null,"spread":false},{"title":"wpfandExcel.pdb <span style='color:#111;'> 23.50KB </span>","children":null,"spread":false},{"title":"wpfandExcel.csproj.FileListAbsolute.txt <span style='color:#111;'> 1.16KB </span>","children":null,"spread":false},{"title":"wpfandExcel.exe <span style='color:#111;'> 30.50KB </span>","children":null,"spread":false},{"title":"Refactor","children":null,"spread":false},{"title":"TempPE","children":null,"spread":false},{"title":"wpfandExcel.Properties.Resources.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"wpfandExcel.csproj.GenerateResource.Cache <span style='color:#111;'> 789B </span>","children":null,"spread":false}],"spread":false}],"spread":true},{"title":"Window1.xaml <span style='color:#111;'> 991B </span>","children":null,"spread":false},{"title":"Properties","children":[{"title":"Resources.Designer.cs <span style='color:#111;'> 2.80KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 201B </span>","children":null,"spread":false},{"title":"Resources.resx <span style='color:#111;'> 5.48KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.07KB </span>","children":null,"spread":false},{"title":"AssemblyInfo.cs <span style='color:#111;'> 2.15KB </span>","children":null,"spread":false}],"spread":true},{"title":"wpfandExcel.csproj <span style='color:#111;'> 5.92KB </span>","children":null,"spread":false},{"title":"App.xaml <span style='color:#111;'> 292B </span>","children":null,"spread":false},{"title":"App.xaml.cs <span style='color:#111;'> 307B </span>","children":null,"spread":false},{"title":"Window1.xaml.cs <span style='color:#111;'> 4.04KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}]

评论信息

  • zmq5411 :
    可以学习一下 但是不是我要的效果!wpfandExcel将窗体的数据导出到Excel表并进行打印.rar
    2019-10-11
  • t86911384 :
    是我要的效果,不过语言不一样...
    2013-09-23
  • hhl6123zy :
    可以学习一下 但是不是我要的效果!
    2013-04-06

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明