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

  • Home
  • SEARCH
  • 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 6551861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:23:22+00:00 2026-05-25T12:23:22+00:00

I have a complex issue at hand. I have developed a program that takes

  • 0

I have a complex issue at hand.

I have developed a program that takes some information from a database and inserts it in a word document. After doing so, it saves the word document on the server and the program user can download the autofilled document.

I use the class Microsoft.Office.Interop.Word to solve this task but it is more than impossible to get this working on a x64 server or a x64 workstation.

Is there ANY other way to accomplish this task? I need the file to be able to be opened in Word. I don’t care if it was generated from say OpenOffice or something like that.

Anyone know a solution for this issue not using the Interop.Word class?

UPDATE (solution):

Here is what I ended up doing:

I saved the wordfile I wanted to use as a template as an XML file.

Then I use this little function:

    public void TestEditContract(string path)
    {
        XmlDocument document = new XmlDocument();
        TextReader reader = File.OpenText(path + "\\wordfile.xml");
        string allxml = reader.ReadToEnd();
        reader.Close();

        allxml = allxml.Replace("placeholder1", "Some content");
        document.LoadXml(allxml);
        document.Save(path + "\\wordfile.doc");
    }

In the end I simply save it as a .doc file and it works like a charm 🙂

This is a little hack’ish but it works very well and is server independent. Thank you cgcarter1 for pointing me in the right direction.

  • 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-25T12:23:23+00:00Added an answer on May 25, 2026 at 12:23 pm

    You kind of have a cadillac going when you need a sportster. Why save the document to the server when you can just hand it to them through the buffer stream? Here is a very good method of delivering an exported Word Doc through the buffer without any dependents:
    http://geekswithblogs.net/vivek/archive/2006/09/26/92316.aspx

    Without dependents, there is no need to worry about the architecture of the server. Also, you are not giving access to your file structure to the asp.net user when you serve the file through the buffer so it is a little more secure.

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

Sidebar

Related Questions

I have some complex stored procedures that may return many thousands of rows, and
I have a bit complex to explain issue that I have ran into: I
I have a complex .NET Remoting server app that provides a couple of services.
I have a complex command that I'd like to make a shell/bash script of.
I have a 'complex item' that is in XML, Then a 'workitem' (in xml)
I have a complex SQL Query, that needs to be filtered further. Part of
I have a strange issue that I'm not too sure on how to fix
I have an AutoMapper issue that has been driving me crazy for way too
I have a complex html-Form and am using jQ for some of the work
I have a fairly complex web app that was built (by a contractor) to

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.