将文本框的文本替换为c#中word文档中文本框的相同位置

问题描述:





我想删除形状并将形状上的内容替换为相同的位置。例如 - 在doc文件中,我有一个包含一些内容的文本框。我只是想删除文本框,并希望将文本框的内容放在文本框所在的同一位置。



操作你明白我的问题。请指导我。





我成功地从每个文本框中读取文本,在零文档中插入word文档中的值( ie - Word.Range rng = document.Range(ref start1,ref end1);其中 start1 = 0和end1 = 0 ),确定形状是否为文本框或不删除文本框。我要搜索的主要是确定每个文本框的位置(坐标/开始,结束值),这样就可以删除文本框并将文本框中的文本插入文本框所在的位置。我需要代码 C#我正在使用 microsoft word 2010



如果您需要代码段,请与我们联系。

欢迎任何新方法。

提前谢谢。

Hi,

I want to delete shapes and replace the content on the shape at the same postion as it is. For example - in a doc file , i have a textbox with some content. I just want to remove the textbox and want to put/insert content of textbox on the same position where the textbox was.

ope u understood my question. Please guide me for the same.


I am successful in reading the text from each textboxs, insert value in word document at zero position(ie - Word.Range rng = document.Range(ref start1, ref end1); where start1 = 0 and end1 = 0), determine if the shape is a textbox or not and delete the textbox. The main thing i am searching for is, determining the position(Coordinate/start,end value) of each textbox so that is can delete the textbox and insert the text inside that textbox on a position where the textbox was.I need the code in C# and i am using microsoft word 2010.

Please let me know if you need code snippet.
any new approach is most welcome.
Thanks in advance.

你为什么不用Word中提供的内容控件。

查看以下链接。



http://blogs.msdn.com/b/mvpawardprogram/archive/2014/06/09/referring-to- content-control-using-c.aspx [ ^ ]
Why don't you use Content controls which are available in Word.
Have a look at the below link.

http://blogs.msdn.com/b/mvpawardprogram/archive/2014/06/09/referring-to-content-control-using-c.aspx[^]