Excel sheet garbled when in portal and rendered in browser: ok on file-sys.

Hi,
We are facing a strange problem. Our WebLogic Portal App uses the JExcelAPI to generate an Excel spreadsheet when users click on a link to view the sheet. This sheet, when it opens in browser, appears garbled (special chars all over etc). However, the same file, when written to a local file instead of being written to the browser, works just fine!
We set the following response headers:
response.setContentType(contentType);
response.setContentLength(length);
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "max-age=0");
response.setHeader("Content-Disposition", createAttachmentFilename(name));
We also set the @page directive, like so:
<%@ page contentType="application/vnd.excel" %>
Given that the file-based excel sheet is ok, we are thinking this problem is due to the way portal handles the response etc...can anyone please help figure this out? We are using JPF-based portlets.
I can paste more code if needed.
Thanks in advance,
Vik.

where are you printing the bytes out? If you are doing it within a portlet, this is wrong , it must be standalone.(you cannot change the the mime type of an included portlet page). If you want to do it within the portlet you must open a new link to a page/servlet that will print out the bytes (outside the Portal framework)
if you have a standalone page(or servlet) and you are still facing this problem , use firefox and livehttpheaders or equivalent and post the request and response headers. If everything looks as it should be, then use Fiddler or any other proxy and inspect the actual bytes you are getting and compare with the file on file system bytes .
regards
deepak

Similar Messages

  • On excel sheet upload read the workbook and populate data to sharepoint list

    Requirement in my current project:
    In a document library when I upload an excel sheet, a specific workbook has to be read and the contents have to be uploaded to a sharepoint custom list.
    The approach followed was create an event receiver and register as a feature. Following is the code for event receiver.
    public override void ItemAdded(SPItemEventProperties properties)
                base.ItemAdded(properties);
                var list = getSPList("{150301BF-D0BD-452C-90D7-2D6CD082A247}");          
                SPListItem doc = properties.ListItem;
                doc["Msg"] = "items deleted from req list";
                doc.Update();
                string excelname=doc.File.Name;
                System.Diagnostics.EventLog.WriteEntry("ExcelUpload", "calling read excel");
                string filepath = doc.File.Url.ToString();
                doc["Msg"] = "excel name" + excelname + filepath;
                doc.Update();
                readExcel(excelname,filepath);
            private static SPList getSPList(String SPListGuid)
               // SPSite Site = SPContext.Current.Site;
                SPSite Site = new SPSite("http://omistestsrv:32252/sites/OMD");
                SPWeb web = Site.OpenWeb();
                Guid listid = new Guid(SPListGuid);
                web.AllowUnsafeUpdates = true;
                SPList List = web.Lists[listid];
                return List;
            private void readExcel(string excelname,string filepath)
                try
                    SPSecurity.RunWithElevatedPrivileges(delegate()
                        using (SPSite Site = new SPSite("http://omistestsrv:32252/sites/OMD"))
                            SPWeb web = Site.OpenWeb();
                            string workbookpath = web.Url + "/" + filepath;
                            web.AllowUnsafeUpdates = true;
                            var _excelApp = new Microsoft.Office.Interop.Excel.Application();
                            System.Diagnostics.EventLog.WriteEntry("ExcelUpload", "iside read excel");
        //my code breaks or fails when cursor reaches this statement. I am not able to open the excel sheet, there is no    //problem related to the permission. same code snippet works in a console application. but when tried as an
    event    //handler in sharepoint it breaks. can anyone help me to resolve the problem
                            workBook = _excelApp.Workbooks.Open(workbookpath, Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing,
    Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing);
                            System.Diagnostics.EventLog.WriteEntry("ExcelUpload", "after excel open");
                                int numSheets = workBook.Sheets.Count;
                                // Iterate through the sheets. They are indexed starting at 1.
                                System.Diagnostics.EventLog.WriteEntry("ExcelUpload", numSheets.ToString());
                                for (int sheetNum = 12; sheetNum < 13; sheetNum++)
                                    System.Diagnostics.EventLog.WriteEntry("ExcelUpload", "inside first for
    loop");
                                    Worksheet sheet = (Microsoft.Office.Interop.Excel.Worksheet)workBook.Sheets[sheetNum];
                                    Microsoft.Office.Interop.Excel.Range excelRange = sheet.get_Range("A13",
    "P89") as Microsoft.Office.Interop.Excel.Range;
                                    object[,] valueArray = (object[,])excelRange.get_Value(
                                        Microsoft.Office.Interop.Excel.XlRangeValueDataType.xlRangeValueDefault);
                                    var list = getSPList("{150301BF-D0BD-452C-90D7-2D6CD082A247}");
                                    for (int L = 1; L <= excelRange.Rows.Count; L++)
                                        string stringVal = valueArray[L, 1] as string;
                                        if ((valueArray[L, 1] != null) && (!string.IsNullOrEmpty(stringVal)))
                                            System.Diagnostics.EventLog.WriteEntry("ExcelUpload",
    "inside second for loop");
                                            SPListItemCollection
    listItems = list.Items;
                                            SPListItem item = listItems.Add();
                                            item["Product"] = valueArray[L,
    1];
                                            item["App"] = valueArray[L,
    2];
                                            web.AllowUnsafeUpdates
    = true;
                                            item.Update();
                                web.AllowUnsafeUpdates = false;
                                //Or Another Method with valueArray Object like "ProcessObjects(valueArray);"
                                _excelApp.Workbooks.Close();
                    //workBook.Close(false, excelname, null);
                    //Marshal.ReleaseComObject(workBook);
                catch (Exception e)
                    System.Diagnostics.EventLog.WriteEntry("ExcelUpload", e.Message.ToString());
                finally
                    System.Diagnostics.EventLog.WriteEntry("ExcelUpload", "finally block");
    Is this the only approach to meet this requirement or is there any other way to crack it. sharepoint techies please help me.

    as you described the scenario of the event that it should happen when user upload excel to a document library. Event Receiver is your best bet. However if you would have a requirement that users can send excel files any time to a network file location and
    you want to pick it, read it and create list items etc. You would write a sharepoint timer job that would run every 10 minute to check for file and if available on the network drive, perform the operation etc. so that users who send excel file does not need
    to come to the sharepoint etc. You can see that you have Event Receivcer option or Timer job option OR you would write a console application to trigger the code at a scheduled time on sharepoint server etc. so you are using the event receiver in the correct
    scenario.
    Moonis Tahir MVP, MCPD, MCSD.net, MCTS BizTalk 2006/SQL 2005/SharePoint Server 2007 (Dev & Config)

  • Open excel sheet through program calculate value and fetch value in program

    Hi experts,
    My requirement is to open a excel sheet while i execute a report,There is some calculation that i need to do in excel sheet and want to fetch the calculated value back in to my program.
    Is there any way of doing so ?
    Regards,
    Kashyap

    Hi Aditya ,
    let me once more clarify with ur requirements .
    User is uploading an excel sheet.
    U doing validations on the records and getting the error in records.
    Displaying the uploaded excel sheet to user to rectify the errors.
    and then update the databse with the correct records.
    So for the above
    use WS_upload ,GUI_Upload  FM for  uploading the excel sheet in itab.
    using this itab ,Dynamically add one more column for the errors.
    Refer :Re: Could anyone tell me how can I add columns in a internal table dynamically?
    Display records in an editable ALV grid.
    BCALV_EDIT_01
    BCALV_EDIT_02
    BCALV_EDIT_03
    BCALV_EDIT_04
    BCALV_FULLSCREEN_GRID_EDIT
    BCALV_GRID_EDIT
    BCALV_TEST_GRID_EDIT_01
    BCALV_TEST_GRID_EDITABLE
    Also see this
    http://www.sapdevelopment.co.uk/reporting/alv/alvscr.htm
    then update the database
    Regards
    Renu
    Edited by: Renu Gusain on May 8, 2009 8:40 AM

  • How to create an Excel sheet in side the Studio, and wirte somethiing

    actually i want to create one excel sheet and in that i want to place some data.
    can anybody help me..?

    Hi,
    In addition to the post I made on http://forums.bea.com/bea//thread.jspa?forumID=600000022&threadID=300003034 to add a template that has the header and formatting information you want you could use logic like this:
    templateName as String = "C:/Student/Excel/InvoiceTemplate.xls"
    newFileName as String = "C:/Order" + orderNumber + ".xls"
    // *** Warning ***
    // This next statement makes Excel visible
    // and should only be done for testing
    // purposes. Normally, this would be
    // run on the server with no human
    // interaction
    xl.visible = true
    // To open an existing Workbook use this syntax:
    workBookTemplate = open(xl.workbooks, filename : templateName)
    // Save as the filename you want. Including the orderNumber
    // variable simply ensures that the invoice is unique by the order
    // number.
    saveCopyAs workBookTemplate
    using filename = newFileName
    // Now open the new Workbook that you just created
    workbookNew = open(excel.workbooks, filename : newFileName)
    Hope this gets you going,
    Dan
    Edited by datwood at 04/29/2008 7:56 AM

  • Error message when taking photos, and photos are saved as blank files

    Hi, lately when I take photos it comes up with an error message and asks me to rename the file. The other day I took several photos in a row and had to rename them all in order to save them, but when I went back to the photo album on my phone the pictures were blank and wouldnt open properly. I really want those pictures back! Does anyone know whats going on and how to recover them?

    As far as the error message, did you try a battery pull to see if it stops the error message?
    If you are trying to view the pictures with the camera app or the pictures app, try exploring the media card and see if the files are there or not.  
    - Ira

  • After having shut down after installing updates, when I restarted and tried to open a word file, it started opening ALL the word docs and the only way I could stop it was by"force quit"  arted  and tried to open

    After having shut down after installing updates, when I restarted and tried to open a word doc, it started opening ALL the word docs and the only way I could stop it was by"force quit"  . This is REALLY annoying!!

    May be it is the Resume feature.
    System Preference > General > Number of recent items
    Uncheck the box next to      "Restore windows when quitting and re-opening apps".
    Best.

  • Change excel sheet name when using spool

    Hi, all! I encounter a problem when I was trying to spool a sql to excel using sqlplus.
    That is the sheet name is as same as the file name, but the requirement of client is the sheet name is "specific" and not as same as file name, could you please help if there is any solution for this.
    thanks a lot for your help.

    hi
    when you create XLS file manually in the command line, can you set the sheet's name?
    - no
    unless you use some "Basic's" commands to manipulate the file later within your batch file, I think there's no way (excel.exe file provides no options in the command line).

  • Microphone sounds garbled when I sing and play guitar.

    Hello, I just purchased a lenovo G505 and when i try to record when i play guitar and sing it comes out all garbled and like there is water in the background. I tried it on skyp and it worked fine it seems it is picking up the guitar as background noise and makes it garbled... my voice sound ok. I also bought an external mic.... no difference.. I also tried different distances.. no luck... what can I do...???? thanks    J 

    hi JilleeBreeze,
    Welcome to the Lenovo Forums.
    Can you try the following:
    1. Disable Microphone Boost by opening Control Panel (icon Views) > Sound > Recording Tab. Select the Microphone that you're using then click Properties > Levels Tab.
       - Link to picture
    2. Enable / Disable Audio Enhancements and observe
       - navigate to Control Panel (Icon Views) > Smart Audio and see if you can disable Microphone Noise Reduction, Echo Cancellation, etc.
       - Link to picture
    Regards
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • Excel Really Slow when moving arounf and loading saved file

    When trying to load a saved file I get the spinning logo foreever. I also get it when moving bettween cells.
    Mac Book Pro 17"   Mac OS X (10.4.7)  

    As said above, this behaviour is completely normal and a result of Excel (MS Office in general) being a PPC based program that is not optimized for the Intel structure yet. Therefore it runs under Rosetta and suffers from a crippling lag in responsiveness.
    Office 2007 will be a universal binary and should net you normal speeds again. It is set to be released within the first quarter of 2007 for Windows and a Mac OS version will follow shortly thereafter.

  • I've downloaded firefox for the first time. My internet works yet when I try and open the browser it says 'unable to connect'

    I can't seem to get firefox properly running on my computer. I've installed it, I have internet connection, yet when I open a window and try to go on a site, it says 'unable to connect'

    Hello Patrick O' D,
    In my experience t here are two different problems with the speed of firefox on startup
    # your os and setup
    # firefox - and exactly what you use with it
    Some factors will be down to your OS and for instance what does start up initially, many of those factors will affect other programmes/applications and not only firefox.
    Some other factors depend on Firefox and how you set that up, I always like to have the option to using Firebug but realise it cold clash with other software or slow down firefox startup so I only enable it as I need it. see for instance: https://addons.mozilla.org/en-US/firefox/performance/

  • Colours desaturate when I copy and paste an image into another file

    I'm using Illustrator CS4 with Windows Vista, 4GB RAM. I've created an image using lots of gradients and different shades of colour, and have tried copying it into a new file, but all the colours in the copied image are desaturated. For instance, a blue with an RGB value of 95 179 255, becomes 114 174 223 in the copied image. All the colours are similarly desaturated. It's very annoying! Anyone had a similar problem, or have any idea what's happening?

    Jacob,
    I am using Illustrator CS (ver.11.0.0) and all of my docs are cmyk. It might help you to know that this: the cmyk values in the original document were assigned as: c100 m55 y0 k0. When I close the doc and reopen it, the values change to: c93.74 m55.69 y2.35 k0. I don't understand why. Can you help?

  • Strange behavior when getting data and storing it into a tdms file

    Hi
    I am getting data from a VISA device(10bytes every 20ms) in a string buffer and then using indexing array get each element which is 2 bytes , filtering the data in real time using a butterworth filter and then storing the data to a TDMS.
    The problem is that the data goes haywire after a brief the the different elemetns just switch. So for example x becomes resistance, GSR becomes  etc
    I have uploaded the VI and the TDMS file converted to excel format

    You really should be writing to the TDMS file while you acquire the data.  By using the Autoindexing Tunnels to build the arrays, you are causing A LOT of memory allocations, which causes things to really slow down.  I would venture to say that you are missing data, causing what looks like a shift in the data.  But you would need to be looking at the error coming out of the VISA Read to know for sure.
    So look into the Producer/Consumer.  The idea is to use a parallel loop to log the data while your current loop reads and processes the data.  The data is sent to the consumer loop via a queue.

  • FM for uploading data into internal table from Excel sheet

    Hi,
    I have a slight problem in one of the function modules that I have created. Actually it has been copied from a standard SAP function module “KCD_EXCEL_OLE_TO_INT_CONVERT”. Now my created function module is throwing me a dump suggesting “Data objects in a Unicode program are not convertible”. Can anybody help me out in removing the error .
    Actually the need of copying the standard FM to a ZFM is to increase the length of the column which can be uploaded thru this FM. The standard FM has a restriction of being able to upload 32 characters whereas my requirement is to upload data having at least 150 characters. So in order to care the need I made a ZStructure ZAKHIL_CELLS taking the Value parameters as 150 characters instead of 32 characters.
    Well this is all done because I wanted to upload a excel sheet into an internal table and not use a tab delimited file. Can anybody help in this regard or suggest some other function module which can upload more than 150 characters from a excel sheet .
    ‘m also attaching structure of my ZStructure for ur reference .
    STRUCTURE ZAKHIL_CELLS1 .
    ROW KCD_EX_ROW_N NUMC 4 Flexible Excel upload: row number
    COL KCD_EX_COL_N NUMC 4 Column
    VALUE KCD_VALUE CHAR 150 External Data Transfer: Values of Parameters or Variables
    Thanks & Rgds,
    Akhil

    hi,
    sample excel sheet.
    coloumn 1 is name and column 2 is age
    name age
    A     8
    C     13
    D     55
    DATA : int_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    data : record like db_name_age occurs 0 with header line.
    DATA : v_start_col TYPE i VALUE '1', "starting col
           v_start_row TYPE i VALUE '1', " starting row
           v_end_col   TYPE i VALUE '2', " total columns
           v_end_row   TYPE i VALUE '10'. "total no of record
    FORM f_upload .
      CLEAR : int_excel, int_excel[].
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = wf_filename
          i_begin_col             = v_start_col
          i_begin_row             = v_start_row
          i_end_col               = v_end_col
          i_end_row               = v_end_row
        TABLES
          intern                  = int_excel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
    *Message is 'Unable to upload data from  '  wf_filename.
        MESSAGE e169(zm050) WITH wf_filename.
      ELSE.
        SORT int_excel BY row col.
        REFRESH : record.
        CLEAR   : record.
        LOOP AT int_excel.
          CASE int_excel-col. "go thru each column.
            WHEN 1.
              record-name  = int_excel-value.
            WHEN 2.
              record-age = int_excel-value.     
          ENDCASE.
          AT END OF row.
            APPEND record.
            CLEAR record.
          ENDAT.
        ENDLOOP.
    *inserting into table
      ENDIF.
    if this helped pld rewrd points,
    rgrds
    anver

  • How to update a custom list when there is a changes in excel sheet uploaded in document library

     
    I have created a document library in which m uploading a excel sheet with values in it and i have created a custom list with same no.of.rows and columns in the excel sheet given the same name of columns. Now i have to make sure that whatever changes i do
    in the excel sheet should automatically gets updated in custom list in sharepoint

    You'll need to create an event receiver for when you add/update a document on the source library (http://msdn.microsoft.com/en-us/library/office/gg749858(v=office.14).aspx)
    Then, with code open the excel file and count the rows. You can use the OpenXmlSDK to do that (http://www.microsoft.com/en-us/download/details.aspx?id=5124)
    Good luck ;)

  • Webi and Excel sheet universe

    Hi gurus,
    I created an universe based on Ms Excel sheet.
    I have created a webi report , but when iI run the report, it does not work ==> DataBase eroor : [Microsoft][ODBC driver manager] Data source name does not found and no default driver specified. (WIW 10901)
    However, this data source name exist , I cretaed it via odbc.
    So i don't understand the matter. Am I missing some settings ?
    Thanks for your help

    Hi Firmin
    Are you able to browse the data from Universe Designer?
    Suggest you to try the below:
    1. Open the Excel spreadsheet
    2. Select all the data values, make sure the remaining blank cells donu2019t get selected
    3. Click on Insert>>Name>>Define to give a name to the table
    4. Save the Excel
    5. Go to Start>>Control Panel>>Administrative tools>Data Sources(ODBC)
    6. Select System DSN>>Add>>Microsoft excel Driver(*.xls)
    7. Give a new data source name and click on Select workbook and point the saved excel sheet and 8. click on OK
    Note: Make sure the parameter <Parameter Name="Transactional Available">No</Parameter> is set to Yes under the Generic ODBC datasource in below location
    C:\Program Files\Business Objects\BusinessObjects Enterprise 11.5\win32_x86\dataAccess\connectionServer\odbc\odbc.sbo
    1. Create a new connection in Universe designer by using the Generic ODBC connection
    2. Create a new universe and insert the table which we have defined in the Excel sheet.
    3. Save and export this universe to the repository.
    4.Now create a webi report based on this Universe.
    Hope this helps!!
    Regards
    Sourashree

Maybe you are looking for

  • Customizing Pivot Table format in answers

    Hi, I have some questions about formats of a Pivot Table. 1) I want to change the position of row headings in Pivot Table view, show them on the right side of the table. Is there any way to do that? The reason is to show "results" column (sum on the

  • Received HTTP response code 500 : Error during conversion of XI message

    hi Facing the error , "Received HTTP response code 500 : Error during conversion of XI message" This is the fist time i am configuring the sender soap ( Axis Framework in the SOAP Adapter) (Quality of service Best effort) communication channel and i

  • Vibration on my Satellite L755-1LE

    There's constant vibration around my mousepad and it's getting annoying, my laptop is only a couple of months old. Maybe you know what could be causing it and how to solve it? I have BIOS 3.60 and I can't downgrade it because my model isn't on suppor

  • Does MS outlook 2007 in client machine is recommended in Exchange 2010

    Hi All, We have a users who uses an outlook via citrix. The outlook clinet on citrix servers is 2007 SP1 and recently there is an upgrade at Exchange server from 2007 to 2010 and all users mail boxes are upgraded to Exchange 2010. After upgrading use

  • Web part not doing anything on selected index change.

    My code is below. I tried to remote debug but when I do the breakpoint will not be hit.  No symbols have been loaded for this document.  When I bring up the modules my dll doesn't appear in there.  If anyone can see anything wrong with my code please