473,546 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xlsx file not able to open when its downloaded

1 New Member
Hi
I have load the xlsx file in blob using POI
when i tried to download the xlsx file from blob the xlsx file got saved but its not openening. when i tried to open the file its giving following error
The conerter failed to open the file.

Please help me Did i mistake anything in my code.

upload the file:
fileOutStream = new FileOutputStrea m(newFileName);
xlsxWorkbook.wr ite(fileOutStre am);
fileOutStream.f lush();
fileOutStream.c lose();
File newFile = new File(newFileNam e);
jobDetailTO.set Data(FileUtils. readFileToByteA rray(newFile));
new JobDetailBD().i nsertJobBlob(jo bDetailTO);

This is the query load in oracle DB
INSERT INTO USER_TOOL_SPREA DSHEET(JOB_ID,
SPREADSHEET) values (#jobIdSUID#, #data#)

Download from oracle

outFileName = "FileName.xlsx" ;
response.setHea der("Content-Disposition", "attachment ; filename= "+ outFileName);
response.setCon tentType("appli cation/vnd.openxmlform ats-officedocument. spreadsheetml.s heet; charset=UTF-8");
JobDetailTO jobTO = jobDetailBD.get JobBlob(jobDeta ilTO.getJobIdSU ID());
byte[] outFileArray = jobTO.getData() ;
ByteArrayInputS tream bis = new ByteArrayInputS tream(outFileAr ray);
out = new BufferedOutputS tream(response. getOutputStream ());
int byteRead = 0;
while ((byteRead = bis.read()) != -1) {
out.write(byteR ead);
}
out.flush();
bis.close();
out.close();
Please help me out to resolve the issue
Jun 6 '12 #1
0 1740

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

Similar topics

0
1906
by: Mark Phillips | last post by:
Hello, I am having a problem in which a file can get stuck open when a thread that is attempting to write to it gets aborted (ThreadAbortedException occurs). The log file gets stuck open until the process is shut down (cannot delete file from Windows Explorer, for example). My test application stops execution with: An unhandled exception...
0
2545
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a datalist. When the next user selects trys to run the page, the page fails and I get a generic error message from the stack trace. I am assuming...
6
55959
by: Dino Buljubasic | last post by:
My application creates some temporary files that are deleted when my application terminates. However, if a temp file is open, it will not be deleted and application will crash. How can I check if a file is open before deleting it Something like this
1
1143
by: vinesh | last post by:
HI I have problem in uploading a file to server through dotnet when the file is open on the machine. It gets uploaded properly,but there seems some problem in the extension of uploaded file. Regards vinesh
18
7662
by: shilpa.saraogi | last post by:
Heya all, How do I tell, prgrammatically, if a file is opened for read/write by some other process? In unix .. of course. My program needs to open files and work on it, and I want it to make sure that the file is not being written to (e.g. by scp, cp, mv etc) before I attampt to open it. Is there any function to see the status of the...
4
2902
by: rdemyan | last post by:
I'm using code from the following web page to open the API Browse Folder dialog http://www.mvps.org/access/api/api0002.htm It all works fine. But if the dialog box is open and the user closes Access, the system just hangs and Access apparantly cannot close. I have to open the Windows Task Manager and force the closing (and even that...
6
34621
by: Ros | last post by:
There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case I would ignore processing that particular file and move to next file. How can I check whether the file is open or not? I tried os.stat and...
0
1099
by: deerchao | last post by:
I'm using FileSystemWatcher to watch the new file creation. When there is one, I want to open it and read it's content. But, by the time when I got the message from FileSystemWatcher the file may be still hold by the process who just created it, writing data. So is there any way I can detect if a file is open or not? Or can I wait untill the...
6
34390
by: Studlyami | last post by:
Hey all, I'm trying to create a simple (I think it should be simple) batch file. I want this file to open Internet Explorer 6 go to the webpage SIRIUS Satellite Radio - The Best Radio On Radio and run the javascript: launchPlayer(",",","); Is this possible? I don't know anything about batch files and i only got to the point where i can open the...
0
2047
by: user1980 | last post by:
hello.. i am developing a page in asp to open an .xlsx file and display its contents.. i have used this connection string sConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=""Modified.xlsx"";Extended Properties=""Excel 12.0;HDR=NO;IMEX=1""". i get an error...ADODB.Connection error '800a0e7a' Provider cannot be found. It may not be...
0
7504
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...
0
7435
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
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...
1
7461
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...
0
7792
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6026
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...
1
1921
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
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.