Click here to Skip to main content
14,971,029 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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.
Posted
Updated 29-Jun-15 3:18am
v4

1 solution

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[^]
   
Comments
Vandana87 30-Jun-15 3:42am
   
Hi praveen,
i jst saw the aove link. Thankyou for the same, but i looking for a c# code as i want make an application that does the above work. i have many document where this need to be done dynamically. I am new to this so please guide me for the same.
Thankyou..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900