.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
// 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
Post a Comment