Garbage characters in excel file opened by jsp

          I am storing an excel file as blob in database. While retrieving
          from database when I open in the jsp page , it shows a lot of garbage characters
          and all formatting is lost. I am using content type "application/vnd.ms-excel".
          I am also setting correct mime type in web.xml as application/excel. It is weblogic
          6.1 sp2 with oracle 8.1.6. the pdf and word docs are working well. Please help
          soon.
          Thanks
          

Download the Open G Toolkit from www.openg.org. There is a VI called Quit Application.vi that works great. I have used it with the very stupid Brooks 0154 SmartDDE Controller program to reset the application.
Be sure to save the document and close the DDE communication first.
Michael
www.abcdefirm.com
Michael Munroe, ABCDEF
Certified LabVIEW Developer, MCP
Find and fix bad VI Properties with Property Inspector

Similar Messages

  • Opening Excel  files from a JSP page

    Hi,
    I am not able to open up an Excel file through JSP.
    I am using following code snippet in JSP page
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-Disposition","inline; filename=Test.xls");Do i need to do additional settings for rendering Excel from a JSP
    Thanks in advance !!!

    Hi,
    In my application , we have Excel files on the server i.e we are not creating excel sheets.
    I just want to display these static excel files through a jsp.
    I am able to display the excel files by reading them into ByteArrayOutputStream
    <%
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-Disposition","attachment; filename=B.xls");
    ServletOutputStream so = response.getOutputStream();
    String filename = "D:\\Test.xls";
    String mimetype = "application/vnd.ms-excel";
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    InputStream in = new BufferedInputStream(new FileInputStream(filename));
    byte bytebuff[] = new byte[500];
    for(int lengthread = 0; (lengthread = in.read(bytebuff)) != -1;){
    output.write(bytebuff, 0, lengthread);
    byte data[] = output.toByteArray();
    response.setContentType(mimetype);
    so.write(data);
    in.close();
    so.close();
    %>But my question is that , do i really need to do all this for rendering excel through a jsp.
    Can't i do it by just setting the content type ?
    Thanks

  • LIST_FROM_MEMORY - Excel File - Open data set

    Hello,
    A long time ago I asked people here how to convert a submit program to html and using open/transfer/close data set altoghter. I got a lot of help for that and I am greatful.
    However, I may need to try something and would like to ask how does this apply when you want to transfer <b>LIST_FROM_MEMORY -> Excel File -> Open/transfer/close data set</b>leading it to be saved to the application server.
    Thank you all and good day.

    Do we have to write the list into application server in XL format?
    Once we get the data from LIST_FROM_MEMORY, then write this data into application server using DATASETS
    Refer to these links
    How can I upload data from excel file from Application Server?
    Regds
    Manohar

  • Open an excel file in a jsp

    using apache poi excel, i created a workbook and add that into the season and opened in new jsp by servletoutputstream(these are happening at onclick).
    first time it's working fine,
    if i try do it again without closing this jsp, I am getting the same results in the previous jsp.But this works fine if i close the the jsp and do that.
    regards
    Senthil Arjunan

    duffymo wrote:
    SoulTech2012 wrote:
    duffymo wrote:
    That's fine, but you can serve up an Excel file (for download) with a couple lines of code. That doesn't require Spring. Too often I see these noobs working on a web project and throwing half a dozen frameworks at it because people told them to or recommended them. Noobs don't often know better and I have no doubt that some of them would attempt to use Spring just to get an Excel file to download if they were told to. But then again, that's their problem I guess.You win. What did I win?The debate, of course.
    Do you realize how often this question is asked and how many times the code has been posted?! No, which is why I asked. Please post them just one more time.Nobody likes a smart@ss. I seriously doubt, as much time as you spend here, that you truly believe that. Yes, I'm calling you a liar.
    >
    Besides, I have no interest in helping to set a precident that there's no need to do any research when you can simply ask for a handout here. Posting the code, or not, is still a better response than recommending Spring.Fine. Post the code.
    %knock yourself out!
    in 60 seconds I found a half dozen posts of the same exact code
    http://search.sun.com/search/onesearch/index.jsp?qt=download+excel+file&rfsubcat=&col=developer-forums&cs=false&rt=true&reslang=en

  • Problem making an Excel file from a jsp

    Hi.
    I'm developing a web application that uses Excel for printing the reports. So far everything has worked fine, at least for the created Excel files that do not have any images on them. Now I need to create an excel file with an image as the header. I tried adding the necessary code to include the image, but when I open it, the image is not displayed (like when you open an HTML page that could load a certain image). I tried using different ways to set the src to see if maybe the path was the problem, but everytime I got the same result...
    How can I do this? How can I include the image and actually display it when the user opens the file in Excel?
    Thanks in advance
    CyberSpider

    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...

  • Save and Close excel file opened through OLE

    Hi,
    I have opened an excel file on my desktop and edited it.Now I have to save this file and close it.
    Right now , I am manually saving the file and closing it. So please give the steps to automate the process of saving and closing .
    Please find the code below for opening a file and editing.
    report zkntest2.
    INCLUDE: <line>,
             <icon>,
             <symbol>,
             ole2incl.
    DATA: g_excel_app             TYPE ole2_object,
          g_excel_workbook        TYPE ole2_object,
          g_excel_worksheet       TYPE ole2_object,
          g_excel_usedrange       TYPE ole2_object,
          g_excel_cell            TYPE ole2_object,
          g_excel_return          TYPE ole2_object.
    data :H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    CONSTANTS:c_appl(17)              TYPE c VALUE 'Excel.Application'.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 with frame title text-001.
    PARAMETERS p_ofile LIKE rlgrap-filename default 'C:\layout.xls'.
    SELECTION-SCREEN END OF BLOCK blk1.
    CREATE OBJECT g_excel_app c_appl.
    CALL METHOD OF g_excel_app 'Workbooks' = g_excel_workbook.
    CALL METHOD OF g_excel_workbook 'Open'
      EXPORTING #1 = p_ofile.
    SET PROPERTY OF g_excel_app 'Visible' = 1.
    CALL METHOD OF g_excel_app 'Workbooks' = H_MAPL.
    PERFORM FILL_CELL USING  4 9 1 'Kiran'(001).
    PERFORM FILL_CELL USING  5 9 1 'Ref#'(002).
    PERFORM FILL_CELL USING  6 9 1 'Claim#'(003).
    PERFORM FILL_CELL USING  7 9 1 'Location'(004).
    FREE OBJECT g_excel_app.
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF g_excel_app 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      GET PROPERTY OF H_ZL 'Font' = H_F.
      SET PROPERTY OF H_F 'Bold' = BOLD .
    ENDFORM.                    "FILL_CELL

    Try add this code below.
      CALL METHOD OF G_EXCEL_APP 'ActiveWorkbook' = G_EXCEL_WORKBOOK.
      CALL METHOD OF G_EXCEL_WORKBOOK 'SaveAs' EXPORTING #1 = '1.xls'.
      CALL METHOD OF G_EXCEL_WORKBOOK 'Close'.
      CALL METHOD OF G_EXCEL_APP 'Quit'.
      FREE G_EXCEL_APP.

  • Can I globally change a setting so that Word/Excel files open in NeoOffice

    We are evaluating the use of open "Office" applications. Is there a global setting that will allow us to force Word & Excel files to open in NeoOffice (and vice versa)? In addition, is there an Import Data feature in NeoOffice or OpenOffice?

    See this article:
    http://docs.info.apple.com/article.html?artnum=106171

  • Excel file download in jsp

    Hi,
    Is it possible to download excel file on the server on a JSP page. Kindly advice.
    Thanks in advance.

    yes...
    What is the scenario....
    is it..
    1. You have a XLS on server...alredy created..
    2. Now you need a link on JSP page....that is linked to this EXS file...
    3. User acess your web application and click on link....
    4. A popup comes up....and user selects either to save or download the file....
    Is this your scenario....
    If not then specify steps you are looking for....and you face issue in which step....
    Edited by: Saurabh Agarwal on Jul 6, 2011 12:21 PM

  • Excel file processing in jsp

    Hello friends
    I want to read Excel files jsp(or java).I used sql driver,but it does'nt reads the file properly.I want to read file in jsp.I went thr many sites and found many ways like apache poi,JExcel api etc
    I found JExcel api is not free.I am getting errors with poi.I found no proper documentation on it.On apache site there are many versions to download poi packages.I confused about which to download.
    If any one has used poi successfully,please let me know

    related to POI
    **POI**
    Site
    http://poi.apache.org/Api
    http://poi.apache.org/apidocs/index.htmlExamples
    http://www.google.co.in/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=7WV&q=POI+examples&btnG=Search&meta=

  • How to Downlaod a Excel file using FTP- -JSP

    Hi..i am dynamically generating excel file(i.e...writing into the excel file from Acees databse after executing the queries on it)...i have set the content-type to vnd-msexcel ....now i want that file to be downlaoded using FTP...FTP is new to me...any help could be greatly appreciated...
    Thanks in advance....

    JavaWorld published an article about this topic. It is called "Java FTP client libraries reviewed" and it can be found here :
    http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
    Best regards
    Jean-Pierre Norguet
    Jean-Pierre Norguet
    JavaWorld Press
    http://wasa.ulb.ac.be/jp.html

  • Downloaded excel files opened in multiple instances

    Whenever I download then open the file from Firefox, it opens in a new Excel instance. Hence I am not able to move data to other workbook I had opened previously, and have to save it first, then reopen within the same instance. How do I force it to open in the same instance?
    I didn't have this problem before with Firefox, it worked just how I wanted. But suddenly something changed around 1 month ago (unknownly) and I have to go through extra step to save then reopen every time. I have searched the web for similar problem but none helped.
    I don't have this problem with Excel itself. (when double click on the files it always open in the same instance) Also, the same problem doesn't exist on my other computer (With the website/Firefox), so I'm just puzzled which part caused the problem. I've tried to reinstall Firefox, restore everything to default. But problem still existed. I don't recall changing any setting when this problem started to occur. Any help is appreciated!!!!

    I know going through the route "open file" in EXCEL can assure me files are open within the same instance, but I want to eliminate this extra step. As mentioned, previously, this can be done without any problem. I'm just repeating the same step as done before, but suddenly, all these new downloaded files stopped open in the same instance, and I don't know which setting is off and caused this.

  • File opening from jsp

    Hello,
    I have a file in the server's hard disk.
    A I have jsp with the link to the file.
    I'd like to file be opend with the standard windows application after clicking on the link.
    How could I realize this? What kind of file link I need?
    Thanks,
    Ljosika

    You must put link to some "context" of your web server not to server hard disk.
    eg. if you're using Tomcat you can create directory "downloads" under "ROOT" directory in webapps directory and then you can put files there and use.
    DOwnload file
    If your application is under Tomcat/webapps/myapp then use
    DOwnload file
    and so on...

  • I solved excel file  download from jsp or javabean

    first jexcel api download
    i used the jexcel api
    here sample ; using jexcel api
    This code is servlet
    ==================================================================
    SaleAgent sa = null;
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    // get Sale List DB Agent Class
    // you are modify
    sa = new SaleAgent();
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws IOException, ServletException {
    res.setContentType("application/vnd.ms-excel");
    res.setHeader("content-disposition", "attachment; filename=datesale.xls");
    // to get Sale List Parameter
    // you are modify
    String biz_id = req.getParameter("biz_id");
    String begindate = req.getParameter("begindate");
    String enddate = req.getParameter("enddate");
    // send parameter , set Parameter to get Data List from Database
    // you are modify
    sa.processDaySale(biz_id, enddate);
    ServletOutputStream out = res.getOutputStream();
    try {
    WritableWorkbook workbook = Workbook.createWorkbook(out);
    WritableSheet sheet = workbook.createSheet("datesale", 0);
    // head cell
    WritableCellFormat cf = new WritableCellFormat();
    cf.setAlignment(Alignment.CENTRE);
    cf.setBackground(Colour.LIGHT_GREEN);
    cf.setWrap(true);
    // data cell
    WritableCellFormat cf2 = new WritableCellFormat();
    cf2.setAlignment(Alignment.CENTRE);
    cf2.setWrap(true);
    // total cell
    WritableCellFormat cf3 = new WritableCellFormat();
    cf3.setAlignment(Alignment.CENTRE);
    cf3.setBackground(Colour.LIME);
    cf3.setWrap(true);
    // etc
    WritableCellFormat cf4 = new WritableCellFormat();
    cf4.setBackground(Colour.LIME);
    cf4.setWrap(true);
    // column width setting
    sheet.setColumnView(0, 10);
    sheet.setColumnView(1, 15);
    sheet.setColumnView(2, 15);
    sheet.setColumnView(3, 15);
    sheet.setColumnView(4, 15);
    sheet.setColumnView(5, 15);
    sheet.setColumnView(6, 15);
    sheet.setColumnView(7, 15);
    // head row setting
    Label label = new Label(0, 0, "NO.", cf);
    sheet.addCell(label);
    label = new Label(1, 0, "sale_date", cf);
    sheet.addCell(label);
    label = new Label(2, 0, "week", cf);
    sheet.addCell(label);
    label = new Label(3, 0, "total_sale", cf);
    sheet.addCell(label);
    label = new Label(4, 0, "net_sale", cf);
    sheet.addCell(label);
    label = new Label(5, 0, "cash", cf);
    sheet.addCell(label);
    label = new Label(6, 0, "card", cf);
    sheet.addCell(label);
    label = new Label(7, 0, "merch_bond", cf);
    sheet.addCell(label);
    // data row setting
    int t_total = 0;
    int t_net = 0;
    Number number = null;
    int maxRow = sa.getCount();
    for(int i = 0; i < maxRow; i++) {
    int t_sales = sa.getTotal_Sales_Price(i);
         int n_sales = sa.getTotal_Sales_Price(i) - sa.getTotal_Dc_Price(i);
    number = new Number(0, i+1, i + 1, cf2);
    sheet.addCell(number);
    label = new Label(1, i+1, sa.getSale_Time(i), cf2);
    sheet.addCell(label);
    number = new Number(2, i+1, t_sales);
    sheet.addCell(number);
    number = new Number(3, i+1, sa.getTotal_Dc_Price(i));
    sheet.addCell(number);
    number = new Number(4, i+1, n_sales);
    sheet.addCell(number);
    number = new Number(5, i+1, sa.getCash(i));
    sheet.addCell(number);
    number = new Number(6, i+1, sa.getCredit_Card(i));
    sheet.addCell(number);
    number = new Number(7, i+1, sa.getMerch_bond(i));
    sheet.addCell(number);
    t_total = t_total + t_sales;
    t_net = t_net + n_sales;
    // total row setting
    label = new Label(0, maxRow + 2, "", cf4);
    sheet.addCell(label);
    label = new Label(1, maxRow + 2, "Total : ", cf3);
    sheet.addCell(label);
    number = new Number(2, maxRow + 2, t_total, cf4);
    sheet.addCell(number);
    label = new Label(3, maxRow + 2, "", cf4);
    sheet.addCell(label);
    number = new Number(4, maxRow + 2, t_net, cf4);
    sheet.addCell(number);
    label = new Label(5, maxRow + 2, "", cf4);
    sheet.addCell(label);
    label = new Label(6, maxRow + 2, "", cf4);
    sheet.addCell(label);
    label = new Label(7, maxRow + 2, "", cf4);
    sheet.addCell(label);
    workbook.write();
    workbook.close();
    } catch(JXLException e) {
    e.printStackTrace();

    humm
    may be servlet link's target have to hidden frame
    i don't know correctly reason...

  • Opening an excel file in jsp

    how do you open an excel file in my jsp and target it to a table?

    can't it be done using the file class?
    i just want to open the excel file, that's all--
    Open means what ?
    See if this is useful
    String myDB =  "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=c:/book.xls;"
        + "DriverID=22;READONLY=false";
    //con=DriverManager.getConnection("jdbc:odbc:myExcel");
    con=DriverManager.getConnection(myDB,"","");
    dbmd=con.getMetaData();
    stat=con.createStatement();
    rs=stat.executeQuery("Select * from `Sheet1$`");//[Sheet1$]--
    I think it is not possible with File class. and if it is so
    then how you are going to handle the data ?

  • How to download Excel file in JSP Page

    Actually I have a page
    Where I am uploading the files to server and it is listing the files which are all uploaded to the server.
    If I try to click the file which is uploaded it has to download to the local system.
    DOC, TXT, PDF, PPT. These file formats are try to download to local. But Excel file, opening the file content only not downloading to local.
    Any solution

    Hi Bangalore:
    As my experience,there may be some symbol such as "\r\n" was added in the content of the Excel file you want to download. this is no porblems to text format file, but to binary format file, such file can not be open. So I suggest you check-up the content of the file befor it was writed to the client, remove unwanted symbol, it should be word!
    I'm a newer to the here , and my english is poor. I thirst for intercommunion, I'm sorry for the syntax error in my reply.

Maybe you are looking for

  • How do you remove a Jailbreak from an iPod Touch?

    I bought an iPod Touch 3rd Gen from someone, it was jailbroken and I didn't know. I went into the general settings and reseted all settings and data. Since then, the iPod has been reseting itself all the time, passing from the home screen's apple log

  • New MacBook cant see Airport Card

    Just bought a new MacBook "refurb" from the Apple store. It was running fine, and accessing wireless networks, but just last night, it stopped seeing the Airport Card. When you click on "turn airport on" in Network Preferences, or you click on the ai

  • HowTo: Use package structure in generated code?

    Hi, I'm trying to find out if JCS is meeting my requirements for JSF development. So far it is pretty good, although the lack of support for new components is defeating the purpose of JSF for a great deal. One of the most terrible things I encountere

  • How can I restore my bookmarks properties?

    A few days ago, I installed XMarks extension in Firefox and Chrome to sync my bookmarks between the two browsers. I just noticed that all of my Firefox boomarks properties have been deleted (I used the bookmarks properties to save password data occas

  • My iphone is disabled, it says plug into itunes, but it says to type in the passcode.. how do i fix this?

    I cant plug it into my itunes because my laptop is being fixed.. but even if when it comes back all the data will be lost so if I restore my iphone everything will be lost because I have no backed it up with icloud. I need a way of fixing it without