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

xlsx file not able to open when its downloaded

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 FileOutputStream(newFileName);
xlsxWorkbook.write(fileOutStream);
fileOutStream.flush();
fileOutStream.close();
File newFile = new File(newFileName);
jobDetailTO.setData(FileUtils.readFileToByteArray( newFile));
new JobDetailBD().insertJobBlob(jobDetailTO);

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

Download from oracle

outFileName = "FileName.xlsx";
response.setHeader("Content-Disposition", "attachment; filename= "+ outFileName);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8");
JobDetailTO jobTO = jobDetailBD.getJobBlob(jobDetailTO.getJobIdSUID()) ;
byte[] outFileArray = jobTO.getData();
ByteArrayInputStream bis = new ByteArrayInputStream(outFileArray);
out = new BufferedOutputStream(response.getOutputStream());
int byteRead = 0;
while ((byteRead = bis.read()) != -1) {
out.write(byteRead);
}
out.flush();
bis.close();
out.close();
Please help me out to resolve the issue
Jun 6 '12 #1
0 1735

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

Similar topics

0
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...
0
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...
6
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...
1
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. ...
18
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...
4
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...
6
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...
0
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...
6
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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: 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.