Can you plz help me to find docx.dll file for creating word document in asp.net MVC.
Loading
Can you plz help me to find docx.dll file for creating word document in asp.net MVC.
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
Sachin SinghRank #66 · 26.2K reputationPosted Oct 4, 2021, 7:09 AM EDT
There are multiple ways
step 1.
PM> Install-Package DocX
step 2.
public class Document
{
public string txtContent { get; set; }
}
step 3.
public class docController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(Documentdocument)
{
string fileName = Server.MapPath(@"~\DocXExample.docx");
// Create a document in memory:
var doc = DocX.Create(fileName);
// Insert a paragrpah:
doc.InsertParagraph(document.txtContent);
// Save to the output directory:
doc.Save();
TempData["Message"] = "document created successfully.";
return View();
}
}
step 4.
model MVC_tutorials.Models.Document
@{
ViewBag.Title = "create document in asp.net MVC";
}
create document in asp.net MVC
@using (@Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
if (TempData["Message"] != null)
{
@TempData["Message"]
}
@Html.TextAreaFor(model => model.txtContent, new { Class = "mytextstyle", rows = 5, Style = "width:450px", placeholder = "type your content and save it in adocument." })
}
Srinivasan RamamoorthiRank #877 · 2.5K reputationPosted Oct 4, 2021, 12:15 PM EDT
Leon DRank #851 · 2.6K reputationPosted Oct 7, 2021, 9:06 PM EDT
Kip HackmanRank #2,595 · 536 reputationPosted Oct 14, 2021, 10:23 AM EDT
DISCLOSURE: I am an employee of the company offering this toolkit.
Here is a step by step HTML5/JS Document Editor tutorial:
Rijwan AnsariRank #82 · 24.2K reputationPosted Oct 16, 2021, 4:09 AM EDT
Satya KarkiRank #78 · 24.6K reputationPosted Oct 16, 2021, 4:15 AM EDT