473,775 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MS Word to ByteArray

10 New Member
Hi all,

I am using a WebService in ASP.Net 2.0 to retrieve Data in XTHML format. I want to put this data in a Word Document and send this document to the client. Till now, I just used Response.AddHea der and set the type to "Applicatio n/MSWord". It was a plain text file, but because of the extension .doc, the user coult opened the document in word. And Word is able to show HTML Documents, so everything worked fine.

But now, I have to put images in that document. So I can't use the HTML File approach anymore. So I have used the Word Interop to create a word document. Afterwards I put the XHTML Resopnse into the word document via the Selection.Inser tXML method. Now it is time to send this word document to the client, without saving it to disk. What I need is to convert the word document to a byte array or a memory stream, but I couldn't find out how.

So can you tell me how I can convert a Word Document in memory to a byte array or to a memroyStream?

Thanks for help
Nov 5 '07 #1
2 2045
JamieHowarth0
533 Recognized Expert Contributor
Hi there,

I moved your thread to the .NET Forum as it seemed more appropriate, dealing with ByteArrays in .NET is very different to handling any binary files in ASP.

Can you simply not add the <img> tag for the images you need to include? The user's Word program should parse these images from the Net into the program nicely without any hassle.

Best regards,

medicineworker
Nov 5 '07 #2
koraykazgan
10 New Member
Hi again,

I have to include the images in the word document, because the images are not public in the internet. They have to be included in the word document.

I am getting the xhtml response from a web service. When I create a word document, append the xhtml to the document and save the document, I can create a file stream from the saved document and everything works.

But there will be a lot of users, and I want to avoid the overhead of saving a document, everytime a document is requested. So I just want to get a stream, maybe a memoryStream, from the word document instance in memory.
Nov 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2058
by: Kristina Engdahl | last post by:
Hello, I'm working with dynamic classloading and have encountered a problem when it comes to defining an URL for a file that is available through a bytearray representing a jar-file. The file in this case is a gif-file. I've implemented my own class loader which extends the java ClassLoader and overrides some methods for deriving classes from the jar-bytearray. Is there anyone who have any suggestion on how to create an URL-object from...
0
1554
by: Bruce Zigenfous | last post by:
Hello, I am using an ASP that uses a third party active-x control to upload a file to a file server using the ADO Stream Object. It uses the FileSystemObject to create folders and files, which works fine. If the file does not exist, it saves the file (Word.doc), if it does exists, it checks to see if the file is open. If it is open, and another user is trying to save or overwrite the same file, I trap an Error 3002 (document open),...
0
2703
by: Bruce Zigenfous | last post by:
Hello, Here is the code. followed by an explanation for what I am trying to do. In particular, this line: BinaryStream.Write byteArray 'Need to format <%Response.Buffer=0 %> <!--#include file="global.asp" -->
4
3748
by: WJ | last post by:
I have documents written in MS/Word (Doc), Ascii Text, and Adobe Acrobat (PDF) formats. They are of type "Image" stored in SQL server. How do I display these documents to the Asp.Net page ? I retrieve the documents in byte array using c# via Sql Procedure. Thanks, John Webbs
3
4660
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. Is it possible to go straight from a byte array to document in word instead of a temp file? Also is there a way to change the save behaviour to notify my app to pickup a binary copy of the file or stream to save back to the sql db. Thanks in...
1
2207
by: gijamie911 | last post by:
int nBytes = 256; byte ByteArray = new byte; int nBytesRead = inputStream.Read(ByteArray, 0 , nBytes); recorderID = ""; for (int i = 0; i <= 14; i++) { recorderID += char.ToString((char )ByteArray);
11
4053
by: Icemokka | last post by:
Hi, I'm need to upload a big file ( 600Mb+ ) to a BLOB field in MSSQL 2005. My code looks like this : fs = New FileStream(sFilePath, FileMode.Open) Dim ByteArray(fs.Length) As Byte fs.Read(ByteArray, 0, fs.Length)
5
6869
by: Nitin Mahajan | last post by:
Guys Is there a way in C# to create a word object directly from a memory stream without passing that to hard disk (file stream). I think it doesn't makes sense to create a file just to read it again in to word object. If some one has some brilliant idea please share. In a nutshell this is what I'm currently doing ByteArray --File Stream --Word Object and this I want to do
4
1679
by: ton | last post by:
Hi, I'm creating an application and I want to give users access to saved Word documents on the server. How can I establish this. I prefer to open specific Word documents directly into word on the client but if it is in a (different) browser it is ok. I've tried: <A HREF="Websitefolder/systeemAT.doc">systeemAT.doc</A>
0
9622
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10051
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8940
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7464
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6718
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5361
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5486
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4018
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.