TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pankaj Saha
NA
8
0
Ungroup shape in word file in c#
Nov 23 2009 9:04 AM
Hi, I have a word file which contains numbers of shapes. Each shape contain some textboxes. I am copying that file to another location and assigning some values to those textboxes of those shapes. Now I have to assign the values to those textboxes then I have to ungroup those shape first then only I can assign values those text boxes. Now the problem is that when I ungroup those shapes, they change their locations in the document. I do not understand what is the problem. Here is the code //copy the sourc file to another location System.IO.File.Copy(Convert.ToString(source), Convert.ToString(destination)); Microsoft.Office.Interop.Word.Document obDoc = new Microsoft.Office.Interop.Word.Document(); object unknown = Type.Missing; object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocumentDefault; obDoc = varWord.Documents.Add(ref source, ref unknown, ref unknown, ref visible); obDoc.Activate(); //hiding a shape--working fine obj = "shape1"; varWord.ActiveDocument.Shapes.get_Item(ref obj).Select(ref unknown); varWord.ActiveDocument.Shapes.get_Item(ref obj).Visible = MsoTriState.msoFalse; //ungroup the shape obj = "Shape2"; varWord.ActiveDocument.Shapes.get_Item(ref obj).Select(ref unknown); varWord.ActiveDocument.Shapes.get_Item(ref obj).Ungroup(); obj = "txtbox1"; varWord.ActiveDocument.Shapes.get_Item(ref obj).Select(ref unknown); varWord.Selection.TypeText(txtbox1value); //show the word file varWord.Visible = true; varWord = null; :(
Reply
Answers (
1
)
implementing Search Functionality
How to fill webpage forms with c#