Opening an Excel file already created - using ADF faces
I have an action that exports a bunch of data to an excel file using jXLS, which seems to work nicely. However, the file is exported outside of my application context. I would like to open the file right into the file stream so that when they click on the link, it just opens the file directly in the browser or prompts for download.
Here's my action code. Any suggestions would greatly appreciated.
public String selectForExcel() throws IOException {
final String templateFileName = "../server/default/tmp/stats_template.xls";
final String destFileName = "../server/default/tmp/chart_output.xls";
Map beans = new HashMap();
beans.put("platformStats", deviceStats);
XLSTransformer transformer = new XLSTransformer();
transformer.transformXLS(templateFileName, beans, destFileName);
return "success";
}
Add the following code to an action that returns null. The action will return the user to the current page and will be presented with a download prompt. This code should work well for your case.
Regards.
public static synchronized void downloadFile(String filename, String fileLocation, String mimeType,
FacesContext facesContext) {
ExternalContext context = facesContext.getExternalContext();
String path = context.getInitParameter("externalFiles") + fileLocation;
String fullFileName = path + filename;
File file = new File(fullFileName);
HttpServletResponse response = (HttpServletResponse) context.getResponse();
response.setHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
response.setContentLength((int) file.length());
response.setContentType(mimeType);
try {
FileInputStream in = new FileInputStream(file);
OutputStream out = response.getOutputStream();
// Copy the contents of the file to the output stream
byte[] buf = new byte[1024];
int count;
while ((count = in.read(buf)) >= 0) {
out.write(buf, 0, count);
in.close();
out.flush();
out.close();
facesContext.responseComplete();
} catch (IOException ex) {
System.out.println("Error in downloadFile: " + ex.getMessage());
ex.printStackTrace();
}
Similar Messages
-
How to use a excel file to create a service component?
Dear all,
I want to use a excel file to create a service to be my data source. I used the wizard to do that but i always got a message. "The data format is not valid, fields in each record must be delimited by tab charactors, and each record seperated by new line charactors". How should I reformat my excel file to fit the requirements? I have already chang the field`s format into 'text' type. Thx ^^Hi Louis,
[Here|http://img125.imageshack.us/my.php?image=exceltestlo7.jpg] is the result of your data. I downloaded your excel sheet and created a simulated service in 7.1.1 and it works fine.
Below are the steps:
1. Go to Tools -> service component wizard
2. The popup opens : Step1 : Enter the name of your service component
3. Go to Excel spreadsheet Copy the data for which the service needs to be created.
4. Step 2 : Paste the copied Excel data in the popup
5. Step 3 : Define Input -> just click next
6. Step 4: Define Conditions -> just click finish.
Let me know if it helps.
Good Luck,
Dharmi -
I´m trying to open an excel file in numbers not being successful. The error msg is unexpectedly error using plugin SFCompatibility can you help me? Already changed the extension of the excel document to xlsx an now gives an unknown import error.
In Excel have you tried saving directly to xls (not xlsx) and opening the xls in Numbers?
If you have a complicated workbook in Excel that uses lots of Excel's advanced features, Numbers may not be able to handle the import. It does pretty well on basic things, though.
If you're just trying to get data into Numbers, then often copy-paste from Excel is easier than trying to open xls files.
SG -
Form open error, File already in use
Hello,
if i wish to open a FMB file just by click on the file name inside the explorer (NT4.0)
i got the message, 'file already in use'
and then i can open the file. But the message is wrong, because i have not opened the file befor.
Any help<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Nandlal Govan ([email protected]):
Delete the existing association with fmb .
Create a new one. This solves this problem.<HR></BLOCKQUOTE>
Hello,
you mean the association withhin the NT environment ? Will do so and test it.
Thank's for your help
Wolfgang
null -
Hi, i'm new using numbers, and when I try to open a excel file don't let me do it, instead appears a box whit a error and close app, any help?
What does the error say?
A couple of thoughts: the file is corrupted or is password-protected. Corruption is more likely to cause Numbers to crash & Numbers cannot open password-protected Excel files. Try using one of the free Office clones & see what happens. -
Opening an excel file on server side using servlets
hi, am having a small problem for launching an excel file. Standalone,
i use
Desktop.getDesktop().open( new File("C:/test.xls") );
and it works fine but when using servlets via tomcat, it does not launch. Any idea?
actually am using ajax to allow a user to remotely launch an excel
file (the excel file contains a macro which will generate and save a
chart as image) on the server.Do you realize that this will only open that Excel file at the Server machine, not at the Client machine? If you're testing (read: acting as Client) at the same machine as where the Server runs, then you will see the result of Desktop#open(). But if you're testing at a different machine (read: as in the real world) than where the Server runs, then you won't see the result of Desktop#open(), because this is executed at the Server machine itself, not at the Client machine.
-
I've been using IMac for 3 years with Microsoft office. Today, I could not open any excel files? Any Ideas?
If you upgraded to Lion or Mountain Lion, and did not upgrade to Office 2008 or later, that may be part of the problem. Try LibreOffice, OpenOffice, NeoOffice, Google Docs, or Zoho Docs. See my FAQ* for link: http://www.macmaps.com/crossplatform.html
-
Microsoft Forms and Microsoft Visual Basic while opening the Excel file
Hello,
I have issues with 2010 64 bit Office Pro Plus Excel. Whenever I open an Excel file (97-2003 worksheet) which has macros then I get below 2 errors in sequence.
Please note that all macro settings are enabled and below are my system configs.
Win 7 Ultimate 64 bit,
MS Office Pro Plus 2010 64 bit with SP2.
Googled all and tried but in vein and also note that I dont have any .exd files under ../forms to delete. Please help.
Please note that for others with same system config/office versions and same 97-2003 worksheet it works so issues is only in my system.
First Error
Microsoft Forms
Could not load an object because it is not available on this machine.
Second Error
Microsoft Visual Basic for Applications
Compile error in hidden module: MainUtilities2.
This error commonly occurs when code is incompatible with the version, platform, or architecture of this application. Click "Help" for information on how to correct this error.
Thanks.Your macro's will not run in a Office 64 environment only in a 32bit environment. The 64bit environment has a whole different setup and macro's created in an earlier 32 bit environment will stop working.
So if you want to use them in a 64 Office environment you have to rewrite the macro's.
have a look here:
http://msdn.microsoft.com/en-us/library/gg264421.aspx
Maurice -
After upgrade to 10.9.1 office for mac 2011 will not open most excel files.
After upgrade to 10.9.1 office for mac will not open most excel files. The files will open in open office. I have tried re-saving as excel file, no joy.
I have repaired permissions, no joy.
below are the results of EtreCheck scan.
Hardware Information:
MacBook Pro (13-inch, Early 2011)
MacBook Pro - model: MacBookPro8,1
1 2.3 GHz Intel Core i5 CPU: 2 cores
8 GB RAM
Video Information:
Intel HD Graphics 3000 - VRAM: 512 MB
System Software:
OS X 10.9.1 (13B42) - Uptime: 5 days 3:45:14
Disk Information:
Hitachi HTS545032B9A302 disk0 : (320.07 GB)
EFI (disk0s1) <not mounted>: 209.7 MB
Macintosh HD (disk0s2) / [Startup]: 319.21 GB (64.84 GB free)
Recovery HD (disk0s3) <not mounted>: 650 MB
OPTIARC DVD RW AD-5970H
USB Information:
Apple Inc. FaceTime HD Camera (Built-in)
Apple Inc. Apple Internal Keyboard / Trackpad
Apple Inc. BRCM2070 Hub
Apple Inc. Bluetooth USB Host Controller
Apple Computer, Inc. IR Receiver
FireWire Information:
Thunderbolt Information:
Apple Inc. thunderbolt_bus
Kernel Extensions:
org.virtualbox.kext.VBoxDrv (4.1.2)
org.virtualbox.kext.VBoxUSB (4.1.2)
com.logmein.driver.LogMeInSoundDriver (1.0.3 - SDK 10.5)
Startup Items:
VirtualBox: Path: /Library/StartupItems/VirtualBox
Launch Daemons:
[System] com.adobe.fpsaud.plist 3rd-Party support link
[System] com.logmein.logmeinblanker.plist 3rd-Party support link
[System] com.logmein.logmeinserver.plist 3rd-Party support link
[System] com.logmein.raupdate.plist 3rd-Party support link
[System] com.microsoft.office.licensing.helper.plist 3rd-Party support link
[System] com.oracle.java.Helper-Tool.plist 3rd-Party support link
[System] com.sharpcast.xfsmond.plist 3rd-Party support link
[System] com.teamviewer.teamviewer_service.plist 3rd-Party support link
[System] com.zeobit.MacKeeper.AntiVirus.plist 3rd-Party support link
[System] org.macosforge.xquartz.privileged_startx.plist 3rd-Party support link
Launch Agents:
[System] com.logmein.LMILaunchAgentFixer.plist 3rd-Party support link
[System] com.logmein.logmeingui.plist 3rd-Party support link
[System] com.logmein.logmeinguiagent.plist 3rd-Party support link
[System] com.logmein.logmeinguiagentatlogin.plist 3rd-Party support link
[System] com.oracle.java.Java-Updater.plist 3rd-Party support link
[System] com.teamviewer.teamviewer.plist 3rd-Party support link
[System] com.teamviewer.teamviewer_desktop.plist 3rd-Party support link
[System] org.macosforge.xquartz.startx.plist 3rd-Party support link
User Launch Agents:
[not loaded] .dat0157.000 (hidden)/Users/fboyd3/Library/Application Support/Spotify/SpotifyWebHelper
[not loaded] com.adobe.ARM.[...].plist 3rd-Party support link
[not loaded] com.google.keystone.agent.plist 3rd-Party support link
[not loaded] com.microsoft.LaunchAgent.SyncServicesAgent.plist 3rd-Party support link
[not loaded] com.spotify.webhelper.plist 3rd-Party support link
[not loaded] com.zeobit.MacKeeper.Helper.plist 3rd-Party support link
[not loaded] org.virtualbox.vboxwebsrv.plist 3rd-Party support link
User Login Items:
iTunesHelper
GrowlHelperApp
Alarm Clock
Canon IJ Network Scanner Selector2
Microsoft Database Daemon
SugarSync Manager
Neat
LogMeIn
Dropbox
Spotify
Spotify
AdobeResourceSynchronizer
Internet Plug-ins:
LogMeInSafari64: Version: 1.0.730 3rd-Party support link
OVSHelper: Version: 1.0 3rd-Party support link
Default Browser: Version: 537 - SDK 10.9
Flip4Mac WMV Plugin: Version: 3.0.0.126 - SDK 10.8 3rd-Party support link
AmazonMP3DownloaderPlugin101750: Version: AmazonMP3DownloaderPlugin 1.0.17 - SDK 10.4 3rd-Party support link
AdobePDFViewerNPAPI: Version: 11.0.03 - SDK 10.6 3rd-Party support link
FlashPlayer-10.6: Version: 12.0.0.70 - SDK 10.6 3rd-Party support link
DivXBrowserPlugin: Version: 2.1 3rd-Party support link
LogMeIn: Version: 1.0.730 3rd-Party support link
Flash Player: Version: 12.0.0.70 - SDK 10.6 3rd-Party support link
iPhotoPhotocast: Version: 7.0 - SDK 10.8
LogMeInSafari32: Version: 1.0.730 3rd-Party support link
QuickTime Plugin: Version: 7.7.3
AdobePDFViewer: Version: 11.0.03 - SDK 10.6 3rd-Party support link
SharePointBrowserPlugin: Version: 14.3.4 - SDK 10.6 3rd-Party support link
Silverlight: Version: 5.1.20125.0 - SDK 10.6 3rd-Party support link
EPPEX Plugin: Version: 3.0.0.0 3rd-Party support link
WidevineMediaTransformer: Version: (null) 3rd-Party support link
JavaAppletPlugin: Version: Java 7 Update 25 Outdated! Update
Safari Extensions:
DivX Plus Web Player HTML5 <video>: Version: 2.1.0.900
Open in Internet Explorer: Version: 1.0
ClickToPlugin: Version: 2.5.3
DivX HiQ: Version: 2.1.0.900
Audio Plug-ins:
BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
AirPlay: Version: 1.9 - SDK 10.9
AppleAVBAudio: Version: 2.0.0 - SDK 10.9
iSightAudio: Version: 7.7.3 - SDK 10.9
iTunes Plug-ins:
Quartz Composer Visualizer: Version: 1.4 - SDK 10.9
User Internet Plug-ins:
Move-Media-Player: Version: npmnqmp 071705000010 3rd-Party support link
WebEx64: Version: 1.0 - SDK 10.6 3rd-Party support link
3rd Party Preference Panes:
DivX 3rd-Party support link
Flash Player 3rd-Party support link
Flip4Mac WMV 3rd-Party support link
Growl 3rd-Party support link
Java 3rd-Party support link
Old Applications:
Microsoft Language Register: Version: 14.3.4 - SDK 10.5 3rd-Party support link
/Applications/Microsoft Office 2011/Additional Tools/Microsoft Language Register/Microsoft Language Register.app
/Users/[redacted]/Library/Application Support/WebEx Folder/1326
Cisco WebEx Event Center: Version: 1304.07.2811.0 - SDK 10.5 3rd-Party support link
convertpdf: Version: 1.2 - SDK 10.5 3rd-Party support link
asannotation2: Version: 1206.25.2804.0 - SDK 10.5 3rd-Party support link
Neat ADF Scanner 2008 10_5: Version: 1.0.0.15 - SDK 10.5 3rd-Party support link
/Library/Image Capture/Devices/Neat ADF Scanner 2008 10_5.app
SLLauncher: Version: 1.0 - SDK 10.5 3rd-Party support link
/Library/Application Support/Microsoft/Silverlight/OutOfBrowser/SLLauncher.app
/Users/[redacted]/Library/Application Support/WebEx Folder/1324
convertpdf: Version: 1.2 - SDK 10.5 3rd-Party support link
Cisco WebEx Meeting Center: Version: 1304.23.2811.0 - SDK 10.5 3rd-Party support link
asannotation2: Version: 1206.25.2804.0 - SDK 10.5 3rd-Party support link
atmsupload: Version: 1209.12.2806.0 - SDK 10.5 3rd-Party support link
Amazon MP3 Downloader: Version: INFO_PLIST_VERSION - SDK 10.4 3rd-Party support link
/Applications/Microsoft Office 2011
Microsoft PowerPoint: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Excel: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Outlook: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Word: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Document Connection: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Solver: Version: 1.0 - SDK 10.5 3rd-Party support link
/Applications/Microsoft Office 2011/Office/Add-Ins/Solver.app
/Applications/Microsoft Office 2011/Office
Microsoft Graph: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Database Utility: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Office Reminders: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Upload Center: Version: 14.3.4 - SDK 10.5 3rd-Party support link
My Day: Version: 14.3.4 - SDK 10.5 3rd-Party support link
SyncServicesAgent: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Open XML for Excel: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Alerts Daemon: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Database Daemon: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Chart Converter: Version: 14.3.4 - SDK 10.5 3rd-Party support link
Microsoft Clip Gallery: Version: 14.3.4 - SDK 10.5 3rd-Party support link
/Applications/iWork '09
Microsoft AutoUpdate: Version: 2.3.6 - SDK 10.4 3rd-Party support link
/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app
/Library/Application Support/Microsoft/MERP2.0
Microsoft Error Reporting: Version: 2.2.9 - SDK 10.4 3rd-Party support link
Microsoft Ship Asserts: Version: 1.1.4 - SDK 10.4 3rd-Party support link
/Users/[redacted]/Downloads
Install Spotify 7: Version: 1.0 - SDK 10.5 3rd-Party support link
Install Spotify 3: Version: 1.0 - SDK 10.5 3rd-Party support link
Install Spotify: Version: 1.0 - SDK 10.5 3rd-Party support link
Install Spotify 2: Version: 1.0 - SDK 10.5 3rd-Party support link
Install Spotify 4: Version: 1.0 - SDK 10.5 3rd-Party support link
Install Spotify 5: Version: 1.0 - SDK 10.5 3rd-Party support link
Install Spotify 6: Version: 1.0 - SDK 10.5 3rd-Party support link
Time Machine:
Time Machine not configured!
Top Processes by CPU:
97% Microsoft Outlook
16% Google Chrome
5% WindowServer
3% Finder
2% EtreCheck
Top Processes by Memory:
180 MB Finder
164 MB soffice
156 MB mds_stores
147 MB Google Chrome
131 MB Numbers
Virtual Memory Information:
928 MB Free RAM
2.59 GB Active RAM
1.22 GB Inactive RAM
1.57 GB Wired RAM
31.52 GB Page-ins
1.33 GB Page-outsFollow these instructions to uninstall MacKeeper. They have been tested with the most recent version of MacKeeper (v 2.8). Earlier versions than the one released in 2012 require more extensive work to uninstall all its components.
The effects of having actually used MacKeeper to do anything are a completely different matter. The fastest way to take an exquisitely designed and painstakingly engineered Mac and make it run like a steaming pile of dung is to install and use such ill-conceived "cleaning" or "security" products. This is just one example of a broad category of time- and money-wasters capable of causing damage that can only be rectified by reinstalling OS X, restoring from a backup, or completely erasing your system and rebuilding it from the ground up. Never install such junk on a Mac.
If you used MacKeeper to encrypt any files or folders, use MacKeeper to un-encrypt them first.
Quit the MacKeeper app if it is running.
Open your Applications folder: Using the Finder's Go menu, select Applications.
Drag the MacKeeper icon from your Applications folder (not the Dock) to the Trash.
You will be asked to authenticate (twice):
You do not need to provide a reason for uninstalling it:
Just click the Uninstall MacKeeper button. You will be asked to authenticate again.
After it uninstalls you may empty the Trash and restart your Mac. All that will remain is an inert log file that does nothing but occupy space on your hard disk. -
Problem while opening the excel files
Hi
In my system , i have excel reports in my server disk . And i am opening the excel files through an action class like /viewReport.do?id=23 .....and thus from the action class i open my excel file .
After opening one excel file , i try to open another excel by clicking that link , then my system often hangs else excel shows an error saying "a report with name viewReport.do is already open " even though both of these files are different on the server
How can i avoid this ??
The reason why i am opening the excel file through an action class is , i need to perform some operations before opening that excel report
i tried by setting the
response.setHeader("Content-disposition","attachment; filename=myWorksheet.xls");
and i kept on changing the names but that doesnt work
Can any one let me know how to go abt this ??Hi Sir,
I found you posted the issue in the
APS.NET forum, and you seems use some code to open the file. Have you tried the last link in the thread?
Then, let's do some test to narrow down the issue.
I notice that you are using Office 2010, does the issue occur only with 'Reachlocal.xlsx' or every existed file?
If every Excel file has the issue, please try the following methods:
Open the file in
safe mode.
Repair Office 2010.
On the other hand, this problem might be caused by malware on the affected machine. There are now two known variants of malware which causes this problem: Win32/Crilock.A and
Win32/Buma!rts. They have both been identified as a new family of
ransomware.
http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2013/09/07/quot-cannot-open-the-file-because-the-file-format-or-extension-is-invalid-quot-opening-office-files.aspx
If you have any further assistance about code/program, I recommend you post the question to MSDN forum:
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
Regards,
George Zhao
TechNet Community Support -
Trying to open an Excel file attached to a Designer form
Hello everybody.
I am trying to open an excel form attached to a PDF file I created using Designer. The script I am using is attached to the click event of a button and reads "app.openDoc(MCFormPath.rawValue);" MCFormPath is a text fiel with a default value that reads: z:\009\Source documents\Meal challenge.xls (location of the document) Unfortunately nothing happens when I click on the button. Any ideas why?
Thanks in advance.[email protected] wrote:
> Hello everybody.
>
> I am trying to open an excel form attached to a PDF file I created using Designer. The script I am using is attached to the click event of a button and reads "app.openDoc(MCFormPath.rawValue);" MCFormPath is a text fiel with a default value that reads: z:\009\Source documents\Meal challenge.xls (location of the document) Unfortunately nothing happens when I click on the button. Any ideas why?
>
> Thanks in advance.
If you are trying to open an Excel form that is attached to the PDF file (via the attachments tab in
Acrobat), then this is the wrong script to use. You should consult the Acrobat Javascript reference:
http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/javascript/AcroJS.pdf
You may want to try the Adobe Acrobat Scripting forum as well.
Justin Klei
Cardinal Solutions Group
www.cardinalsolutions.com -
How to open an excel file with password in Crystal Reports XI Release 2
I have a problem when i try to open an excel 2003 file with password that i know
i recevived an error code 0xc59
How can I open a file in excel 2003 protected by password to create the report?
Thanks in advancedHi Pierluigi,
It looks like you have to open the excel file and use the data.
A few informative links.
http://support.microsoft.com/kb/257819#RetrieveExcel
http://support.microsoft.com/kb/211378/EN-US/
Hope this helps.
Regards,
Abhijeet Taskar. -
What app do i need to buy for a macbook, i need to open a excel file?
What app should i buy for my macbook to open an excel file?
Welcome to the Apple Support Communities
To open an Excel file on your Mac, you have different ways:
1. Purchase Microsoft Office 2011 for Mac > http://www.microsoft.com/mac
2. Purchase “Numbers“ on the App Store.
3. Download LibreOffice > http://www.libreoffice.org
Also, Microsoft Office (it contains Excel for Mac) and Numbers can create documents using Excel format, but LibreOffice is completely free -
ORA-27086: unable to lock file - already in use, Help
We have a windows 2003 server running 10.1.02 w/multiple instances. I created a new, fresh database using DBCA. the db created OK, and I can login as sys.
When I try to create a tablespace, I get these errors. Any suggestions, please?
Thanks,
Leor
SQL> CREATE TABLESPACE BGEN_DATA
2 DATAFILE 'BGEN_DATA.ora' SIZE 1000M REUSE
3 AUTOEXTEND ON NEXT 2M MAXSIZE UNLIMITED
4 ;
CREATE TABLESPACE BGEN_DATA
ERROR at line 1:
ORA-01119: error in creating database file 'BGEN_DATA.ora'
ORA-27086: unable to lock file - already in use
OSD-04002: unable to open file
O/S-Error: (OS 5) Access is denied.We have a windows 2003 server running 10.1.02
w/multiple instances. I created a new, fresh
database using DBCA. the db created OK, and I can
login as sys.
When I try to create a tablespace, I get these
errors. Any suggestions, please?
Thanks,
Leor
SQL> CREATE TABLESPACE BGEN_DATA
2 DATAFILE 'BGEN_DATA.ora' SIZE 1000M REUSE
3 AUTOEXTEND ON NEXT 2M MAXSIZE UNLIMITED
4 ;
EATE TABLESPACE BGEN_DATA
ERROR at line 1:
ORA-01119: error in creating database file
'BGEN_DATA.ora'
ORA-27086: unable to lock file - already in use
OSD-04002: unable to open file
O/S-Error: (OS 5) Access is denied.First of all, you need to give an absolute path to your datafile. Otherwise, it's going to be hard to track where's the file.
Do you have other database instance running on the same server?
PS, don't cross post on many forum. -
Opening multiple excel files thorugh a servlet
Hi
In my system , i have excel reports in my server disk . And i am opening the excel files through an servlet class like /viewReport.do?id=23 .....and thus from the servlet will open my excel file .
After opening one excel file , i try to open another excel by clicking that link , then my system often hangs else excel shows an error saying "a report with name viewReport.do is already open " even though both of these files are different on the server
How can i avoid this ??
The reason why i am opening the excel file through a servlet is , i need to perform some operations before opening that excel report
Can any one let me know how to go abt this ??I had a similar porblem....
I got some help from...http://www.javaworld.com/javaworld/jw-10-2006/jw-1019-xmlexcel.html?page=1...
This is my code in servlet...
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet spreadSheet = wb.createSheet("Users");
spreadSheet.setColumnWidth((short) 0, (short) (256 * 25));
spreadSheet.setColumnWidth((short) 1, (short) (256 * 25));
// Creating Rows
HSSFRow row = spreadSheet.createRow(0);
HSSFCell cell = row.createCell((short) 1);
cell.setCellValue("Year 2005");
cell = row.createCell((short) 2);
cell.setCellValue("Year 2004");
HSSFRow row1 = spreadSheet.createRow(1);
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
cell = row1.createCell((short) 0);
cell.setCellValue("Revenue ($)");
cell = row1.createCell((short) 1);
cell.setCellValue("25656");
cell = row1.createCell((short) 2);
cell.setCellValue("15457");
FileOutputStream output = new FileOutputStream(new File("/tmp/Users.xls"));
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=Users.xls");
ServletOutputStream out = response.getOutputStream();
wb.write(output);
output.flush();
output.close();
forward = null;
In firefox i get the download dialog box but not able to open in from there,i need to save it and then open. In IE i dont get the dialog box instead the excell open inside the browser......Please help me to open a excel sheet onclick on a link "Export to excel" in jsp......
Thanks in advance...
Message was edited by:
onlycoding
Maybe you are looking for
-
Can't use disc warrior 4.4 with my iMac lion
I have tried pushing "c" when restarting the computer to boot from my Disc Warrior (4.4) disc but it is ignored. When I push the "option" button on startup to boot from the disc warroir disc I get the dreaded 3 beep sound and I have to turn off the
-
TS3297 Cannot connect to iTunes error
I am trying to download an app onto my ipad but can't due to a "cannot connect to iTunes error." I have tried tried shutting down, resetting, changing the time back and then correcting and adjusting the DNS address. I also do not have any uploads pe
-
Acrobat.exe process not ending when application closes
This also affected the acrord32.exe process until I uninstalled adobe reader. I have recently updated to the new 10.1.0 version of Acrobat (think I was running 10.0.1 before), I was not having the issue before upgrading. I only discovered I had the p
-
How to check the code source of some function in the portal.
hi all. i have some problem in the portal. i use the ESS in the portal, and now some people can not check their salary. i want to check the code source, but i do not know it uses which program. can some one tell me the way to check the program. best
-
Error when load sptial data by using sqlldr
Currently, I have a shapeFile, so I have used shp2sdo tool to convert shapeFile to Oracle Spatial database. But when using sqlldr tool, I get the following errors: ----- Log file content ------ SQL*Loader: Release 10.2.0.1.0 - Production on Sat Mar 2