将值从C#Windows窗体中的文本框传递到MS字表 [英] Passing values to MS word table from Textbox in C# Windows Forms

查看:109
本文介绍了将值从C#Windows窗体中的文本框传递到MS字表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨代码项目,



我需要一些C#的帮助。实际上我的要求就像基于计数文本框中的值,我将在Windows窗体中生成文本框。我将所有这些文本框值存储在List中,在点击提交按钮时,这些List值需要在我已经在word文档中创建的MS word表中更新。



现在的问题是如何将List值传递给表格中特定单元格中的word文档。



基于计数文本框中的值MS字表也需要动态增长。





请帮我解决这个问题......

解决方案

您需要使用MS Office Interop。 Microsoft.Office.Interop.Word.dll

通过以下链接,您将获得清晰的图片。

MSDN 1

MSDN 2

MSDN 3

最好的运气!


我不同意Office COM是要走的路。 Microsoft不建议使用它,如果可能,您应该避免使用它。我可以直接告诉你,在一个严肃的项目中使用它(甚至是Windows应用程序)从长远来看也不会有回报。仅当少数用户不时使用您的应用程序时,才使用Office COM。如果您需要创建一个位于业务应用程序核心的自动化文档解决方案,那么您将需要使用不基于Office COM的内容。此时你有两个选择:第一个是使用Microsft的免费版本打开XML SDK ,第二个使用的商业图书馆主要要求的工作量最少。

Hi Code project,

I need some help in C#. Actually my requirement is like based on the value in count textbox i will be generating textboxes in windows forms. I will store all these textbox values in a List and on hitting the submit button these List values need to be updated in an MS word table that i have already created in an word document.

Now the question is how to pass the List values to the word document in a particular cell in the table.

Based on the value in count textbox the table in MS word also need to grow dynamically.


Please help me in solving this...

解决方案

You need to use MS Office Interop. Microsoft.Office.Interop.Word.dll
Go through the below links, you'll get a clear picture.
MSDN 1
MSDN 2
MSDN 3
Best of Luck!


I disagree that Office COM is the way to go. Microsoft doesn't recommend using it and you should avoid it if possible. I can tell you first hand that using it in a serious project (even windows app) will not be rewarding in the long run. Use Office COM only if your application will be used from time to time by a small number of users. If you need to create an automated document solution solution that will be in the heart of a business application then you will need to use something that is not based on Office COM. At this point you have two options: The first one is a free one using Microsft's Open XML SDK and the second one is using a commercial library that mostly demands the least amount of work.


这篇关于将值从C#Windows窗体中的文本框传递到MS字表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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