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 8780555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:05:02+00:00 2026-06-13T20:05:02+00:00

How can I create a Microsoft.Office.Interop.Word.Document object from byte array, without saving it to

  • 0

How can I create a Microsoft.Office.Interop.Word.Document object from byte array, without saving it to disk using C#?

public static int GetCounterOfCharacter(byte[] wordContent)
{
   Application objWord = new Application();
   Microsoft.Office.Interop.Word.Document objDoc = new Document();
   //objDoc = objWord.Documents.Open(("D:/Test.docx"); i want to create document from byte array "wordContent"
   return  objDoc.Characters.Count;      
}
  • 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-06-13T20:05:04+00:00Added an answer on June 13, 2026 at 8:05 pm

    There is no straight-forward way of doing this as far as I know. The Word interop libs are not able to read from a byte stream. Unless you are working with huge (or a huge amount of) files, I would recommend simply using a tmp file:

    Application app = new Application();
    
    byte[] wordContent = GetBytesInSomeWay();
    
    var tmpFile = Path.GetTempFileName();
    var tmpFileStream = File.OpenWrite(tmpFile);
    tmpFileStream.Write(wordContent, 0, wordContent.Length);
    tmpFileStream.Close();
    
    app.Documents.Open(tmpFile);
    

    I know this isn’t the answer you’re looking for, but in a case like this (where doing what you really want to do requires quite a bit of time and fidgeting) it might be worth considering whether or not development time outweighs runtime performance.

    If you still want to look into a way to solve it the way you intend it to, I’d recommend the answers in this thread.

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

Sidebar

Related Questions

I'm creating a Word 2010 document using C# and Microsoft.Office.Interop.Word . Using the Range.Paste
I have an object created in memory using Microsoft.Office.Interop and Microsoft.Office.Word and with all
I have some C# automation code which does interesting things with Microsoft.Office.Interop.Word.Document objects. The
I have application which can export slides to PowerPoint. I'm using Microsoft.Office.Interop.PowerPoint.dll . This
I'm working with the Microsoft.Office.Interop.Word ( v14.0 ). I have a word document. In
I have the following VB.Net code to create a Microsoft Word document. How can
I have the following VB.Net code to create a Microsoft Word document. How can
I'm using Office Interop with MS Word (Microsoft.Office.Interop.Word) to modify a template, replacing bookmarks
In internet explorer we can create the object of ActiveXObject like follows xmlDoc=new ActiveXObject(Microsoft.XMLDOM);
For creating word documents based on data from an SQL database, I'm using Office

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.