如何生成doc文件并在wpf中传递数据? [英] How to genrate doc file and pass data in wpf ?

查看:49
本文介绍了如何生成doc文件并在wpf中传递数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试打印帐单,因此我想创建一个word doc或excel,并将文本框值和datagrid值以定义的格式(如帐单格式)传递到文件中

然后单击打印按钮将打印。

解决方案

如果要创建Word文档,一种方法是使用Interop。一篇可能非常接近您的需求的文章:通过.NET实现Word文档自动化 [ ^ ]。



填写完字段后,你可以打印文件(再次通过Interop),就是这样。



有关Interop参考,请参阅: Microsoft.Office.Interop.Word命名空间 [ ^ ]

I am try to print a bill,so me want to create a word doc or excel and pass the textbox value and datagrid value into the file in a defined formatted (like bill format)
then on click print button that will be printed.

解决方案

If you want to create a Word document, one way is to use Interop. An article that could be quite close to your needs: Word document automation through .NET[^].

After filling the fields, you could just print the document (again via Interop) and that''s it.

For Interop reference, see: Microsoft.Office.Interop.Word Namespace[^]


这篇关于如何生成doc文件并在wpf中传递数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆