.net - How to add URL comment to word document using c#? -


this code. can put comment want put url in comment. how can this?

  using microsoft.office.interop.word;   using microsoft.office.core;    private void button3_click(object sender, eventargs e)     {         // open doc file.         microsoft.office.interop.word.application application = new microsoft.office.interop.word.application();         microsoft.office.interop.word.document document = application.documents.open(@"e:\temp3.docx");         object comment = "www.google.com" + environment.newline;         object missing = system.reflection.missing.value;         microsoft.office.interop.word.comment var = document.comments.add(document.words[1], comment);         try {             document.hyperlinks.add(var.range,ref missing,ref missing,ref missing,ref missing,ref missing);         }         catch (exception ex)         { messagebox.show(ex.tostring()); }         document.close();         application.quit();     } 

but result this

my objective

and bad parameter exception in hyperlink.add

// insert hyperlink web page. object oaddress = "http://www.microsoft.com"; object orange = wrdselection.range; document.hyperlinks.add(orange, ref oaddress, ref omissing, ref omissing, ref omissing, ref omissing); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -