Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Office.Interop
- using System.IO
- Microsoft.Office.Interop.Word
- Object objMiss = System.Reflection.Missing.Value;
- Microsoft.Office.Interop.Word.Application ObjWord = new Microsoft.Office.Interop.Word.Application();
- string url = "D:\Desktop\plantilla.docx";//Server.MapPath("D://Documentos/Prueba.docx");//Path.GetFullPath("~/Prueba.docx");
- object url2 = "D:\Desktop\plantilla.docx";
- Label1.Text = url;
- Response.Write(url);
- object nombre = "PRUEBA";
- Microsoft.Office.Interop.Word.Document objDoc = ObjWord.Documents.Open(ref url2, objMiss);
- Microsoft.Office.Interop.Word.Range nom = objDoc.Bookmarks.get_Item(ref nombre).Range;
- nom.Text = "prueba2";
- object obj = nom;
- objDoc.Bookmarks.Add("nombre", ref obj);
- objDoc.Bookmarks.Add("telefono").Range.Text = txt_Nit.Text; // el txt_nit lo toma de la caja de texto
- ObjWord.Visible = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement