Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6664327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:35:53+00:00 2026-05-26T02:35:53+00:00

So for a project I am creating Résumé’s and i need to save them

  • 0

So for a project I am creating Résumé’s and i need to save them into a docx file.
It is a ASP.NET MVC application and for the docx generating I’m using the libray docx to create the document.

I can create the file but the filestream doesn’t add the content i put into it.

Here is a the code i use

public ActionResult CVToWord(int id) 
        {
            var CV = CVDAO.CV.Single(cv => cv.id == id);
            var filename = "CV - " + CV.firstname + " " + CV.name + " - " + CV.creationdate.ToString("dd MM yyyy") + ".docx";
            System.IO.FileStream stream = new System.IO.FileStream(filename, System.IO.FileMode.OpenOrCreate);

            using (DocX doc = DocX.Create(stream)) 
            {
                Paragraph title = doc.InsertParagraph();
                title.Append(CV.firstname + " " + CV.name);
                doc.Save();
            }

            return File(stream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", filename);
        }

Like i said, this creates the file but the file doesn’t have any content. Any one have a idea why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:35:54+00:00Added an answer on May 26, 2026 at 2:35 am
    public ActionResult CVToWord(int id) 
            {
                var CV = CVDAO.CV.Single(cv => cv.id == id);
                var filename = "CV - " + CV.firstname + " " + CV.name + " - " + CV.creationdate.ToString("dd MM yyyy") + ".docx";
    
                using (DocX doc = DocX.Create(filename)) 
                {
                    Paragraph title = doc.InsertParagraph();
                    title.Append(CV.firstname + " " + CV.name);
                    doc.Save();
                }
    
                System.IO.FileStream stream = new System.IO.FileStream(filename, System.IO.FileMode.Open);
                return File(stream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", filename);
            }
    

    This works

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a project from the book Sanderson Pro ASp.net mvc3. But I have
When I am creating one project file by code using the BuidEngine, Does anybody
I am working on a ASP.Net project creating a Outlook like calendar scheduler app.
I'm creating a project in asp.net and I looking for Modal Window (like ajax
I'm releasing an application I wrote as an open-source project by creating a public
in the project I'm creating I need to check if the user is logged
I've converted a Visual Studio 2005 Website Project into a Web Application Project by
Background: I'm testing a function within an ASP.NET 4.0 (Web Forms not MVC) and
I am creating project with different shapes using box2d.. i created a square using
I'm working on a project creating a fairly simple one-to-many host-to-slave network using a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.