How to open DOC/XLS files using UIWebView on iPhone 3.0?

Hi,
I am using the following code to display doc/xlst files on UIWebView. It's surprised that I can get the content of the file but cannot show in WebView.
NSData *myData = [NSData dataWithContentsOfFile: fileDesPath];
NSString *ext = [m_openFiles.fileExtension lowercaseString];
NSString *mimeType;
if ([ext isEqualToString:@"doc"]) {
mimeType = @"application/msword";
}else if([ext isEqualToString:@"xls"]){
mimeType = @"application/vnd.ms-excel";
}else if([ext isEqualToString:@"wma"]){
mimeType = @"audio/x-ms-wma";
}else if([ext isEqualToString:@"jpg"] || [ext isEqualToString:@"jpeg"]){
mimeType = @"image/jpeg";
}else if([ext isEqualToString:@"tif"]||[ext isEqualToString:@"tiff"]){
mimeType = @"image/tiff";
}else if([ext isEqualToString:@"htm"]||[ext isEqualToString:@"html"]){
mimeType = @"text/html";
}else if([ext isEqualToString:@"mov"]){
mimeType = @"video/quicktime";
}else if([ext isEqualToString:@"mp4"]){
mimeType = @"video/mp4";
}else if([ext isEqualToString:@"txt"]){
mimeType = @"text/plain";
}else{
mimeType = [NSString stringWithFormat:@"application/%@", ext]; //pdf
NSLog(mimeType);
//Here, I can get the myData. The value is the content of the doc file.
if (myData) {
[self.myWebView loadData:myData MIMEType:mimeType textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:fileDesPath]];
After loadData, it cannot show anything in webview!
Can someone help me in this matter?
Thanks,
Message was edited by: Small Apple

Hi Maurício -
For your future reference and for the information of everyone who comes across this post in the future:
We host all of our DataPlugins on our website at ni.com/dataplugins.  There are hundreds of file formats supported through the available DataPlugins, and there is also a link on that site where you can request a DataPlugin be written for file formats that aren't currently supported (such as custom *.CSV files).
Derrick S.
Product Manager
NI DIAdem
National Instruments

Similar Messages

  • How to open a pdf file using OPEN DATASET

    Im trying to convert a pdf into binary format. So im trying to read the contents of the pdf into a XSTRING. Using the FM 'SCMS_XSTRING_TO_BINARY' i can convert the XSTRING to binary format.
    How to open a pdf file using OPEN DATASET and transfer its contents in a XSTRING variable.
    What i've tried is....
    DATA: f_name type string value 'C:\rep_output_pdf.pdf',
          x1 type xstring,
          LT_DATA TYPE STANDARD TABLE OF X255.
    OPEN DATASET f_name FOR input IN BINARY MODE.
    READ DATASET f_name INTO x1.
    CLOSE DATASET f_name.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER     = x1
        TABLES
          BINARY_TAB = LT_DATA.
    Im getting a short dump .
    Short text: The file is not open.
    Plz help me out.

    Hello Rajesh,
    You are trying to do use OPEN DATASET with a local file. NOT POSSIBLE
    You have to have the file in the app server to use OPEN DATASET.
    BR,
    Suhas

  • Problem downloading .doc, .xls file using servlet

    i have a servlet which downloads the files to client(browser). It works file for .txt file but .doc, .xls files are opend but they contain garbage.
    plz letr me know if u know problem!!!!!
    -amit

    Probably because you output them using the Writer you got from getWriter instead of using the OutputStream you can get from getOutputStream.

  • How to open the pdf file using LabVIEW program

    I want to open the pdf file using the system exe, but it is not happening . Can you help me?
    Solved!
    Go to Solution.

    In simpler version
    Mark the satisfied answer as accepted solution for your question,you mistakenly marked youself 
    Message Edited by Baji on 04-07-2009 05:03 PM
    Balaji PK (CLA)
    Ever tried. Ever failed. No matter. Try again. Fail again. Fail better
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
    Attachments:
    open pdf.JPG ‏25 KB

  • How to open a PDF file using NWDS or VC

    Hi Frndz...
    As per my requirment i need to open a PDF file on browser which PDFs are reside on R/3 and in my case EP server is on UNIX usinig either NWDS or VC ....
    Thanks in Advance
    Regards
    Rajesh
    09903726944

    hi,
    can you put your question much more clearly? I couldnt get you properly.
    Check out the following links, they may be useful
    [How to Create a pdf form Using Web Dynpro - Java;
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/805709cb-ec97-2910-04b8-f3d6303d8d3b]
    [Diff - PDF view inside NWDS livecycle designer and when App. is run;
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/90e8e837-cc15-2a10-8db1-a87e2d29e9c9]
    Regards,
    Murthy.

  • How to open a text file using button click event

    hi, How can i open a text file in a textpad or notepad on the click event of a button.?
    Thanks
    Jay

    Pnt,
    this will not work LV 8.0.1 and LV 8.6 will give back error 193.
    Attached is a VI to use the ShellExecute WinAPI. The VI is LV 7.1.1.
    Message Edited by waldemar.hersacher on 10-09-2008 10:48 PM
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions
    Attachments:
    ShellExecute.zip ‏27 KB

  • How To Open PDF Attached file use CLIENT_HOST 11 g forms

    How to open pdf file on client side at 11 g forms ?
    when i open any attached (PDF )file on client side is not open those file open on server side plz guide me how to  open those file on client machine using client host?
    thanks

    Where is the pdf you are trying to open? Is it on the server or the client? If the file is stored on the server then you can access it using WEB.SHOW_DOCUMENT assuming it is stored in a place that has a virtual mapping. For example:
    WEB.SHOW_DOCUMENT ('http://server/someLocation/file.pdf','_blank');If the file is on the client then you need to configure your application to use WebUtil. Then you can do what Francois suggested.

  • How to open a PDF file using forms 9i

    Hi guys!!! Could you please help me with this?
    Using the webutil library, i've found the function FILE_OPEN_DIALOG which yes, it is like windows' dialog box, but it doesn't open the specific file. If i have the PDF software, and a pdf file, and i use the webutil code to open the file from forms, why doesn't it open de file?
    Code used:
    :block.item := WEBUTIL_FILE.FILE_OPEN_DIALOG('c:\',
    'pdf|*.pdf',
    'Select a file: ') ;
    I have also used:
    :block.item := webutil_file.file_selection_dialog(directory_name => 'c:\',
    file_name => null,
    file_filter => 'pdf|*.pdf',
    title => 'Select a file',
    dialog_type => open_file, --save_file
    select_file => TRUE);
    thnx!!

    The dialog just gives you the name of the file to open. You then have to write code to open the file. web.show_document should work.
    I have deleted your last entry. Whatever you think about the situation, a civilized language (which I know Spanish to be) would be appreciated.

  • How to display .doc/.xls file uploaded using blob type of column in table.

    Hi,
    Here
    http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm
    I learnt about uploading & viewing file through BLOB in a form or report . It works fine for pictures & notepad file. But when i upload word file (i.e. *.doc) or excel file ( *.xls ) , and try to view it through DOWNLOAD
    it gives message box
    ' Do you want to save this file, or find program online to open it?'
    I searched lot but enable to find proper & easy to understand solution.
    Hope understand my problem.
    Thanks in advance.

    Hi,
    I am using table emp having fields id,name,,,,,,,,,photo,mimetype,filename,last_update_date.
    photo is of type BLOB. I updated photo (text item) on form.
    I Used BLOB DOWNLOAD Format Mask with appropriate entries & selected display as Attachment.
    So my problem is partially solved. Now if DOWNLOAD link on Form is clicked it displays Excel sheet
    in different window. But still, DOWNLOAD link on my Interactive report not working properly.
    DOWLOAD on interactive if it is clicked it has two problems
    1) It opens image or notepad file in same window.
    2) Not able to open Excel sheet.
    thanks for reply.

  • Print .PDT,.DOC,.XLS files using java print API

    Hi,
    I need to print different types of documents like pdf, word, excel files etc.
    Please let me know how to proceed on this.
    I tried using the following code, but it is printing all junk/html tags on the paper.
    Please let me know how to resolve this.
    Thanks in advance
    import java.io.File;
    import java.io.IOException;
    import javax.print.DocFlavor;
    import javax.print.DocPrintJob;
    import javax.print.PrintException;
    import javax.print.PrintService;
    import javax.print.PrintServiceLookup;
    import javax.print.SimpleDoc;
    public class PrintDocument {
      static public void main(String args[]) throws Exception {
        try {
             PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
            DocPrintJob printerJob = defaultPrintService.createPrintJob();
            File pdfFile = new File("C:\\temp\\sample.doc");
            SimpleDoc simpleDoc = new SimpleDoc(pdfFile.toURL(), DocFlavor.URL.AUTOSENSE, null);
            printerJob.print(simpleDoc, null);
        } catch (IOException ie) {
          ie.printStackTrace();
        } catch (PrintException pe) {
          pe.printStackTrace();
    }

    Hi
    I would like to see if it was possible.  I thought it would be easy, as
    there is a standard batch processing sequence (Print 1st page of all) using
    Java that comes with Acrobat 7.  This allows you to print the first page of
    a number of files that you select when the sequence is run.  Its code is:
    /* Print 1st Page */
    /* This sequence prints the first page of
       each document selected to the default printer.
    this.print
    To my uninformed mind it seemed logical that the same code, slightly
    modified to print all pages, should work from within a form.
    Anyway, if there is a way to choose individual files, I would appreciate
    that.
    Thanks
    Rob

  • How to open a pdf file using Acrobat reader in Java?

    Or if you can just tell me where in the tutorial is the section that discuss running other application from Java, I'd appreciate it. My assignment(at work, not school) is to make a class that receive a pdf file, which is passed by RMI, and display it in a child window or in a JDesktopPane. Thank you.
    kindo

    Hi Kindoo,
    try using Runtime.exe(fileName)
    Nagaraj

  • Problem opening a "xls" file

    Good day
    I'm having a difficulty opening a .xls file using a Ms Exel 2003.
    It prompt a box saying:
    The file you are trying to open, 'AA.xls' is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source
    before opening the file. Do you wan to open the file now?
    If i click Yes. Another pop up will show:
    The information you were working on might be lost. Ms. Office excel can try to recover it for you and i checked on the " recover my work and restart Ms.office excel"
    A blank Ms.Excel will be shown.
    The size of the file shown on the icon are still there but nothing contain in it.
    Pls. help.

    Hi,
    According to this error, this .xls file may be damaged. The following steps might help recover your file:
    1. Click the File menu
    2. Click Open
    3. Locate the file, but do not click the Open button.  Instead, click the drop-down arrow next to the Open button.
    4. Click "Open and Repair"
    5. In the dialog that pops up, choose "Repair".  If that does not work, try the "Extract Data".
    6. Let us know if this works.  If not, we will see what else we can come up with for you.
    Regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • How to get Header in Downloaded .xls file using  GUI_Download function

    How to get Header in Downloaded .xls file using  GUI_Download function ???
    How to use the the Header parameter available in GUI_Download function .

    HI,
    see this sample code..
    data : Begin of t_header occurs 0,
           name(30) type c,
           end of t_header.
    data : Begin of itab occurs 0,
           fld1 type char10,
           fld2 type char10,
           fld3 type char10,
           end   of itab.
    DATA: v_pass_path TYPE string.
    append itab.
    itab-fld1 = 'Hi'.
    itab-fld2 = 'hello'.
    itab-fld3 = 'welcome'.
    append itab.
    append itab.
    append itab.
    append itab.
    append itab.
    t_header-name = 'Field1'.
    append t_header.
    t_header-name = 'Field2'.
    append t_header.
    t_header-name = 'Field3'.
    append t_header.
      CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
        EXPORTING
          default_extension     = 'XLS'
        IMPORTING
          fullpath              = v_pass_path.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = v_pass_path
          filetype                        = 'DBF'
        TABLES
          data_tab                        = itab
          FIELDNAMES                      = t_header
    Cheers,
    jose.

  • How do I open a .dd file using OS X?

    I had a corrupt external HDD which i used to use with an old laptop. I used data recovery software and managed to recover 33gb of data. However it is saved in the old diskdoubler format. (.dd file extension). How do I open a .dd file using OS X? ive tried stuffit and unarchiver but they dont work. any help?

    Look at these links.
    http://forums.appleinsider.com/archive/index.php/t-40241.html
    http://www.enews.org/blog/2009/03/opening-diskdoubler-files-from-mac-os-9.html
     Cheers, Tom

  • How to open *.doc files on the fileserver in ABAP ?

    Hi, everyone.
    I met an issue about how to open a word file located on another fileserver which is inside a same net workgroup with SAP server.
    I know ABAP could call OLE function to activate WORD but
    what must I conduct to let it open a given word file ??
    Any help appreciated.
    Thank you.

    you can use
    CL_GUI_FRONTEND_SERVICES=>EXECUTE method to do this.
    just pass path along with document name to "DOCUMENT" parameter of this method.
    Regards
    Raja

Maybe you are looking for