473,395 Members | 1,574 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,395 software developers and data experts.

Returning Word doc in Stream Object

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), which another application picks up and throws an
exception. If it is open, and another user is trying to save or
overwrite this file, but no one has it open, it is not overwriting. I
realized that what is happening is if the file is created the first
time, I do a saveToFile, which works fine, and if the file is opened
and the Error 3002 is trapped, it does a loadFromFile and behaves
correctly as well. However, what is happening is if the file exists
but is not open, it is still doing a loadFromFile, and the bytearray I
am returning from the BinaryStream is only returning the file name,
corrupting the word document. So, I tried creating a separate
BinaryStream and did a copyTo a fresh BinaryStream - didn't work, then
just a separate BinaryStream which almost works - I am getting the
file to be saved and overwritten, but when I open the file it is rtf
code. I tried several methods to encode it properly, but nothing I try
seems to work. If I could figure out how to convert this second
BinaryStream to a Word doc my problem would be solved. Is there any
way to force a conversion of a bytearray returned from a Binary Stream
to a Word doc? I tried doing a "Write" and "WriteToText" and that
doesn't seem to work, and tried it with these constants: adTypeBinary
1, adTypeText 2. If I can just get the file to convert to a Word.doc
I'd have it. Any help would be appreciated.

Thanks in advance,
BZ

Jul 19 '05 #1
0 1532

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

Similar topics

7
by: Pablo J Royo | last post by:
Hello: i have a function that reads a file as an argument and returns a reference to an object that contains some information obtained from the file: FData &ReadFile(string FilePath); But ,...
1
by: Jim P. | last post by:
I'm having trouble returning an object from an AsyncCallback called inside a threaded infinite loop. I'm working on a Peer2Peer app that uses an AsyncCallback to rerieve the data from the remote...
2
by: Claus - Arcolutions | last post by:
I got a word document as a stream, and I want to get the text from the word document. But I cant seem to find anything to use for that purpose. The "Microsoft office ?.object" com reference, only...
1
by: J. Askey | last post by:
I am implementing a web service and thought it may be a good idea to return a more complex class (which I have called 'ServiceResponse') in order to wrap the original return value along with two...
0
by: Federico | last post by:
Hi I want to create a Web Services where I receive a Template DOT word a file XML and with these I create a Document that a I'll Send as Dime Attachment. <WebMethod()> _ Public Function...
0
by: Federico | last post by:
Hi I want to create a Web Services where I receive a Template DOT word a file XML and with these I create a Document that a I'll Send as Dime Attachment. <WebMethod()> _ Public Function...
1
by: khoy | last post by:
Hello. I am writing a web service and I need to use a Soap Extension to add a custom header that is expected at the destination. I can use the Soap Extension successfully for adding the header...
23
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
5
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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.