how to export a word document in asp.net using c#.,
admin form
empid : 14
sysno : 7
task : design
these are inserted by admin
in employee form it should b open in a word document ., how
selvi.s
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nitesh KejriwalRank #253 · 9.9K reputationPosted May 8, 2012, 10:08 PM EDT
selvi subramanianRank #2,007 · 723 reputationPosted May 8, 2012, 10:55 PM EDT
Jignesh TrivediRank #16 · 50.3K reputationPosted May 8, 2012, 11:29 PM EDT
you can with Introp dll which are inbuild in vs2010.
use Microsoft.Office.Interop.Word;
try below code.
Application WordApp = new Application();
Document document = WordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
Range rng = document.Range(ref start1, ref missing);
rng.Font.Name = "Arial";
hope this help.rng.InsertAfter("Hi, this is Jignesh Trivedi.");
object filename = @"D:\MyTestDoc.doc";
document.SaveAs(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
WordApp.Visible = true;
Kyle Story24 reputationPosted Nov 30, 2014, 11:38 PM EST
If you do not have MS Office on server, where your ASP.NET application is hosted, you will not be able to use Word Interop in .NET.
In that case there are few options you can try, for example you can use this .NET component for word files together with a template file.
That would be one of the simplest ways and additionally you could import that admins data via mail merge process in C#, something like this:
And last you can simply export your DOCX file in ASP.NET to the employee like the following: