Click here to Skip to main content
14,738,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I create a word file and design it’s bookmarks.
Then in application, user enter personal code, and program search in DB for name and family. Then send them to word.
Now I wants to put it in a ring. And send group of records for all personal of company. (no individual).
How should I do this?
Thanks

object Name = "Name";  // bookmark 
object family = "family";  // bookmark 
            
string maghsad_file = System.Windows.Forms.Application.StartupPath + "\\main_template.docx";
            if (File.Exists(maghsad_file))
            {
                object file = maghsad_file;
                object nullobj = System.Reflection.Missing.Value;

                Microsoft.Office.Interop.Word.Application wd;
                Microsoft.Office.Interop.Word.Document wdDoc;
                
                wd = new Microsoft.Office.Interop.Word.Application();
                wdDoc = new Microsoft.Office.Interop.Word.Document();
                
                wdDoc = wd.Documents.Open(ref file, ref nullobj, ref nullobj,
                ref nullobj, ref nullobj, ref nullobj, ref nullobj,
                ref nullobj, ref nullobj, ref nullobj, ref nullobj,
                ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
                
                wdDoc.Bookmarks.get_Item(ref Name).Range.Text = name.Text;
                wdDoc.Bookmarks.get_Item(ref family).Range.Text = family_2.Text;
                  
                wd.Visible = true;  

            }


What I have tried:

i don't kwnow what should i do.
........................
thanks
Posted
Updated 28-Feb-20 7:48am
v2

1 solution

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