473,378 Members | 1,138 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Loading a byte array into a word document

Hi,

Is there anyway to programmatically load a byte array into a word
document in c#?

We have an application that streams a byte array of a previously saved
word document into a c# client. I can file the stream away to the
local disk, then open with document.open, but there is a system
requirement to bypass saving to local disk on security grounds.

Thank you for any guidance,

Pete
Nov 16 '05 #1
2 10943
LP
Look into MemoryStream Class.

"Pete Mann" <pd****@gmail.com> wrote in message
news:56**************************@posting.google.c om...
Hi,

Is there anyway to programmatically load a byte array into a word
document in c#?

We have an application that streams a byte array of a previously saved
word document into a c# client. I can file the stream away to the
local disk, then open with document.open, but there is a system
requirement to bypass saving to local disk on security grounds.

Thank you for any guidance,

Pete

Nov 16 '05 #2
"LP" <lp@a.com> wrote in message news:<uB*************@TK2MSFTNGP15.phx.gbl>...
Look into MemoryStream Class.

......

Thank you for your reply. I've looked (and googled) on memorystream,
but I'm still not getting anywhere. I can now have the document
sitting in memory, but can't get it to load in word. Word has a
app.documents.open() method (requires file so no good).

I've been stabbing around with the following, with no result..

(if you assume fileBytes is a word document in a byte array)

MemoryStream mm = new MemoryStream(fileBytes);
mm.Seek(0x0,SeekOrigin.Begin);

//this doesn't work
wordDoc=(Word.Document)mm.CreateObjRef(wordDoc.Get Type());

//this doesn't work
wordDoc =(Word.Document)mm;

I'm sorry to be a pain, but could you give a little more insight? I'm
fairly new to c# and I'm no doubt missing a huge chunk of
understanding. To be clear again – I have a Microsoft Word Document in
a byte array, I need it to be loaded into Microsoft word without
filing it away and reading it back in again.

Thanks again for your patience,

Pete
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steve Holland | last post by:
Hi, We have a web app which reads in a Word 2000 template (.dot), replaces some fields, then saves it off to the filesystem. This all works fine. What we would now like to do is to save the...
235
by: napi | last post by:
I think you would agree with me that a C compiler that directly produces Java Byte Code to be run on any JVM is something that is missing to software programmers so far. With such a tool one could...
13
by: Bryan Parkoff | last post by:
I have two variables: "char A" and "short B". I can be able to convert from A to B using explicit case conversion with no problem like "B = short (A);". Right now, I have two variables: "char T"...
3
by: tigrrgrr42 | last post by:
I am working(vb.net03and05) with word documents stored in a sql db and I am currently bringing them from a byte array into a temp file to pop into word and make word do its thing as a com object. ...
1
by: kmercer46 | last post by:
I have the byte array generated and I also have the web service generated what i need to know is how to pass a byte array to the web service itself any help would be appreciated.
3
by: =?Utf-8?B?U1MgbWFkaHU=?= | last post by:
Hi, I have two word files. listprice.doc,product.doc I converted each of the documents into bytes byte bytedata - lisprice.doc byte bytedata1-product.doc I create a new array and copy both...
5
by: cgd | last post by:
hi, i want to save the MS Word data (not the Word file) to a database, so i copy the Word data to clipboard first,and then get the data to a DataObject object, and then try the code below, ...
20
by: Nickolai Leschov | last post by:
Hello all, I am programming an embedded controller that has a 'C' library for using its system functions (I/O, timers, all the specific devices). The supplied library has .LIB and .H files. ...
1
by: bharath652 | last post by:
Hi, I need to know how to get the Mime type of a Document from the Byte array. I'm not having file name of file extension. I have only Byte array of a document. To be more specific, Using the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.