Displaying MS Word File in browser

Hello,
Can anyone pls tell about the method to display MS word file present in a folder in my site on the browser.
I dont want it to give it as download dialog box.
Thanks
Sharath

It may still be easier to use Google Documents.
But if you don't want to do that, I suggest that you check SourceForge or jakarta.apache.org. There's a project called POI that lets you process some Microsoft Office documents in Java (Excel in particular), and there's probably one that deals with Word docs. Someone may have already written a utility that uses that to turn Word into HTML. Then you could tie that into your servlet environment.
Trying to display the Word file on the user's browser, directly, as a Word file and not processed into something else, is likely to be a tremendous pain in the butt.
Another thing you could possibly do is convert all your Word documents into HTML or XML or some other more portable format, before you even install them on your server. Make it part of your build/deployment process. It sounds a bit painful, and it might be at first, but doing things at build time is much nicer than doing it at run time.
Generally, I'd advise moving away from Word format completely, even before build time, if you can possibly get away with it.

Similar Messages

  • Display MS word file in Office control

    Hi all,
    I am using the Office control UI element to display a MS word file in WD application. I have created a Mime object for the word file and get this file data into a Xstring attribute, and bind this attribute with the datasource property of the Office control.
    But at the runtime I am not able to display the Word file, it displays only a White colour container with text SAP IOS. Can anyone suggest me how I can get the word file in WD component using office control.
    I have also checked SOIS pakage, but didn't get any solution from the example given in this package.
    For your reference I am using the below code to get the mime object in Xstring attribute.
    DATA:
      mime_repository TYPE REF TO if_mr_api,
      content TYPE xstring,
      url TYPE string VALUE '/SAP/BC/WEBDYNPRO/SAP/ZTEST_SAN5/TEST.docx'.
      mime_repository = cl_mime_repository_api=>get_api( ).
      CALL METHOD mime_repository->get
        EXPORTING
          i_url     = url
        IMPORTING
          e_content = content.
      DATA lo_nd_office TYPE REF TO if_wd_context_node.
      DATA lo_el_office TYPE REF TO if_wd_context_element.
      DATA ls_office TYPE wd_this->element_office.
      DATA lv_test TYPE wd_this->element_office-test.
    navigate from <CONTEXT> to <OFFICE> via lead selection
      lo_nd_office = wd_context->get_child_node( name = wd_this->wdctx_office ).
    get element via lead selection
      lo_el_office = lo_nd_office->get_element( ).
      lv_test = content.
    Set single attribute
      lo_el_office->set_attribute(
        EXPORTING
          name =  `TEST`
         value = lv_test ).
    This lv_test having the Xstring data after execution but didn't set this data as word file at runtime.
    Please suggest if anyone have any idea on this.
    Thanks
    Sanket

    hi,
    try this in browser..
    tools->internet options->security->custom level
    here you will find Active x controls and plugis..
    enable all of them and try your applications..
    if it is helpful pl give some points buddy:-)
    regards,
    Kranthi.

  • Displaying a word file stored as BLOB in the database

    Post Author: Sathish K Sekar
    CA Forum: WebIntelligence Reporting
    Hi,
    Is it possible for us to display a word file which is stored as a BLOB object in  our database.
    We are using BO XIR2.
    Thanks in advance
    Sathish

    Post Author: InfluentialSoftware
    CA Forum: WebIntelligence Reporting
    Sathish - is this query specific to wanting to display a Word file or does it relate to how to display any BLOB objects in the database via Infoview?Thanks,Andy 

  • Reading/Displaying MS Word file in Flex application

    Hello,
    Is there any way, by which I can read/display word file as it is in Flex application (Web based). Is there any way or work around by which I can achieve this.

    Hello,
    You can find swc-s that convert doc files to pdf files, you can also convert one page at a time, in case you have a big document.
    Claude Bur.

  • Use JSP to display MS Word file

    Hi All,
    I have a JSP web application running on Mac OS X server and have some MS Word files on the server. I want to render the MS Word files to HTML, embed it as part of the web page. Is it possible at all? If so, where to start?
    Any adviced will be highly appreciated. Thanks.

    hi,
    try this in browser..
    tools->internet options->security->custom level
    here you will find Active x controls and plugis..
    enable all of them and try your applications..
    if it is helpful pl give some points buddy:-)
    regards,
    Kranthi.

  • Opening a MS Word file in Browser.

    Hi! Friends....
    I am trying to open a Ms Word file in a java prog. What actully i am doing is that i am opening the file using JSP.
    I am creating a blank file using
    new File();Then i am setting its content type
    setContent type('application/msword');seting its default encoding
    setEncoding('UTF-8')It is opening the file.But asking in which application to use.And thenasking which encoding type to use to open.
    I want that it should open that directly in Ms word and should not ask the encoding type to open for.
    Please suggest me some thing.
    Thanks and Regards

    You shouldn't be doing that in a JSP. Some widely used webbrowser developed by a team in Redmond would look at the URL (which ends at .jsp, is it?) rather than the headers.
    Use a Servlet for that which takes the file name as part of the request URL. You may find this article useful: [http://balusc.blogspot.com/2007/07/fileservlet.html]. Just change the content disposition to 'inline'.
    Jamwa wrote:
    Put the following in the body of your jsp:
    <%
    response.setHeader("Content-disposition", "attachment; filename=myFile.doc");
    %>
    That won't open the file directly. That would pop up a 'save as' dialogue.

  • Displaying *.pdf file on browser with servlet

    hi all
    this RAMESH,struggling to display a pdf file on browser from a remote mechine
    earlier i tried with servlet
    response.setContentenType("application/pdf")
    out.println();
    by this i am getting only some data as below
    endobj
    4 0 obj
    <<
    /ProcSet [ /PDF /Text /ImageB ]
    /Font << /Fo0 21 0 R /Fo12 24 0 R /Fo13 27 0 R /Fo16 30 0 R /Fo18 33 0 R /Fo19 36 0 R >>
    >>
    endobj
    For this purpose i have gone thru www.lowagie.com
    and gone thru all examples but i am not getting how to display on browser or at least awt frame
    please requesting all for suggest me some way
    tanks all
    -Ramesh

    are you trying to
    a) create a PDF dynamically
    b) send an existing PDF

  • Display word file from web repository

    Hi,
    I have an application that stores word files in the sap web repository. Now I need to display a word file in webdynpro. There are examples where a word file is displayed by the ui element officecontrol from mime repository.
    How I can get access to word files in web repository and display them?
    Regards,
    Ilya
    Edited by: Ilya M. on Dec 12, 2010 12:02 PM
    Edited by: Ilya M. on Dec 12, 2010 12:03 PM

    hi,
    see this thread [SAP Web Repository, how can acess it from outside|SAP Web Repository, how can acess it from outside]

  • Diaplay  Word file stored in blob into a browser using JSP

    Dear All
    I have files stored in oracle table in a blob field.I store the files using forms 10g and webutil. I can upload the files and display them successfully in forms, however when i use JSP to retrieve the files and display them in Internet Explorer, I'm able to display the pdf files, bmp , jpg and video but I'm getting junk characters when I try displaying (word , excel , access or powerpoint files which might contain arabic Characters )
    the code I use to display the files is as follows :
    <%
    try
    Connection conn = null;
    String username=session.getAttribute("username").toString().toUpperCase();
    String password=session.getAttribute("password").toString().toUpperCase();
    String ip = "*****************";
    String sid = "***************";
    Class.forName("oracle.jdbc.driver.OracleDriver");
    conn = DriverManager.getConnection("jdbc:oracle:thin:@"+ip+":1521:"+sid,username,password);
    String par = request.getParameter("LETTER");
    String par1 = request.getParameter("SERIAL");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select * from TableName where PK1 like '"+par+"'"+" and PK2 like '"+par1+"'" );
    if (rs.next())
    Blob pic = null;
    byte[] blobBytesArray = null;
    OutputStream stream = response.getOutputStream();
    pic = rs.getBlob("BLOBFIELD");
    int len = new Integer( new Long( pic.length()).toString() ).intValue();
    blobBytesArray = pic.getBytes(1,len);
    if (blobBytesArray != null)
    if (blobBytesArray.length > 0 )
    stream.write(blobBytesArray) ;
    catch(Exception e)
    System.out.println("Exception: " + e.getMessage() + "<BR>");
    %>
    can you please guide me of how to display other file types.
    Best Regards.

    Hello,
    Ideally when you store the document put the content-type in a column and set the content type in your JSP. This will indicate to the browser what is the type of file and you should not have any issue with any type.
    Regards
    Tugdual Grall

  • Word files are displayed with junk

    Hello,
    I am running Weblogic 6.1 SP2. It shows the word files with junk in it. How can I
    fix this problem?
    Thanks,
    Meghana

    It is probably not a problem with the WebLogic server itself; I've done Word
    files etc. from WL without an issue. Are you doing via FileServlet, your own
    JSP, etc. Does it work from Apache? If so, use telnet to compare headers.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for Weblogic
    "Michael Smith" <[email protected]> wrote in message
    news:[email protected]...
    >
    This problem still occurs on WLS 7.0 as well.
    "Cameron Purdy" <[email protected]> wrote:
    Use telnet to do a GET to WL and compare the results to a GET from
    another
    server. There's gotta be a dif in the header that confuses IE (not hard
    to
    do ....)
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for Weblogic
    "Eddie Sheffield" <[email protected]> wrote in message
    news:[email protected]...
    Cameron Purdy wrote:
    I am running Weblogic 6.1 SP2. It shows the word files with junk
    in
    it. How can I fix this problem?What Word files? How are you accessing them? Via a Servlet? JSP?
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    http://www.tangosol.com/coherence.jsp
    Tangosol Coherence: Clustered Replicated Cache for WeblogicSince I'm having the same problem I'd like to hear a solution as well.I
    just have a simple link to a Word document that lives on the server.No
    fancy processing or dynamic generation of the document or anything.
    There is a mime mapping defined in the web application deployment
    descriptor (viewed with the console tool) for "application/msword"with
    a file extension of "doc" It works fine from Mozilla - click the link
    and it asks if I want to save or open. But in IE 6 it just immediately
    displays the file contents in the browser as if it were plain text,so
    it comes out as junk. Using the same browser and clicking links toword
    docs on other web servers works fine - I get the save/open dialog and
    clicking open pops up Word as expected.
    Thanks for any ideas!
    Eddie Sheffield
    Senior Java Developer
    G3 Systems, Inc.
    P:540.951.4300
    F:540.951.4311
    http://www.g3.com

  • Want to open a new browser window and display the html file in locale disk.

    Hi,
    I want to open a new browser window and display the html file in local drive. The below html applet work in local system successfully. But i deploy the same in web server (Tomcat) and try the same in client machine it does not work. Please help.
    Note:
    The class below fileopen.FileOpen.class i make it as a jar and put it in jre\ext folder at the client machine.
    ------------------------------------FileOpen.html(Tomcat)-----------------------------------------------------
    <html>
    <body >
    <applet code="OpenFile.class" archive="loadfile.jar" width="100" height="100">
    <param name="path" value="file://c:/open.html" />
    </applet>
    </body>
    </html>
    -------------OpenFile.java in server(Tomcat)--------------------------------------------
    public class OpenFile extends Applet implements ActionListener{
    String path = "";
    fileopen.FileOpen open = null;
    Button b = null;
    public void init(){
    path = getParameter("path");
    b = new Button("Open");
    b.addActionListener(this);
    add(b);
    public void actionPerformed(ActionEvent ae){
    try
    open = new fileopen.FileOpen(this,path);
    catch (Exception e){
    e.printStackTrace();
    -------------------------------------------FileOpen.java /Client JRE/ext----------------------------------------------------
    package fileopen;
    public class FileOpen
    AppletContext context = null;
    URL url = null;
    public FileOpen(Applet applet,String path)
    try
    if(null != applet){
    context = applet.getAppletContext();
    if (null != path)
    url = new URL(path);
    context.showDocument(url, "_blank");
    }catch(Exception ex)
    ex.printStackTrace();
    Please help to solve this issue very urgent.
    Thanks in advance.
    By,
    Saravanan.K.

    zzsara wrote:
    I want to open a new browser window and display the html file in local drive. ...Did you ever pause to consider how ridiculous that is?
    The best audience for applets is people off the internet. 'People off the internet' might be using a computer that has no (what was it?) 'open.html' in the root of the C: drive. In fact (shock horror) they may not even be running Windows, and would therefore probably have no 'C:' drive at all.
    If you do not intend to distribute this to people off the web, an application makes a lot more sense, but even then, you cannot rely on the document being there unless you 'put it there' (during installation, for instance).
    As the other poster intimated, applets can load documents off the local disk as long as they are trusted. Here is an example*, but note that it is not so rash as to presume any particular path or file, and instead leaves it to the user to choose the document to display.
    * The short code can be seen at SDNShare on the [Defensive Loading of Trusted Applets|http://sdnshare.sun.com/view.jsp?id=2315] post.
    On the other hand, a sandboxed applet can load any document coming from its own server via URL, or get showDocument(URL) to work. In that case, the JRE must recognize that the URL is from its own server, so the best way to form URLs for applet use is via the URL constructor
    new URL(getDocumentBase(), "path/to/open.html");That is how I form the URL in this [ sandboxed example of formatting source|http://pscode.org/fmt/sbx.html?url=/jh%2FHelpSetter.java&col=2&fnt=2&tab=2&ln=0]. Of course, in this case the applet loads the document, then parses the text to draw the formatted version, but the point is that an URL produced this way will work with showDocument(URL).
    I am pretty sure showDocument() in an applet off the internet will work with an URL pointing to a foreign (not its own) server, but it will not be able to load documents off the end user's local disks.
    I suggest a couple of things.
    - Try to express this problem in terms of what feature it is that you want to offer the end user. Your question jumps directly to a bad strategy for achieving ..who knows what? An example of a feature is "Shows the applet 'help' files on pressing F1".
    - A good way to indicate interest in a solution is to offer [Duke stars|http://wikis.sun.com/display/SunForums/Duke+Stars+Program+Overview] to match that interest.
    Edit 1:
    ..and please figure out how to use the CODE tags.
    Edited by: AndrewThompson64 on Sep 12, 2008 11:14 PM

  • How can I retain the attached .pdf files (displayed as icons) from my word file 2010 to a pdf file?

    Hi everybody,
    I have looked for an answer in this forum ... without any good result.
    I worked on a Word 2010 file with some attached pdf files. These attached files are displayed as icons on the word file. If you double click on them, you can consult them. This works very good.
    Problem: I would like to convert this word 2010 file into a pdf file, which keeps the icons (linked to attached files) active. If I "pdf" this with my current system, icons are displayed as pictures: I cannot open the attached files.
    My question is very simple: is it possible to retain these active icons (= to open attached documents) in a pdf file? Which adobe package should I use?
    Many thanks for your help 
    cheers
    elgreengo

    No, it's not possible, but I agree it would be a very nice feature.

  • IE Browser not able to display a PDF file within the Browser window ...

    Hello acrobat experts!
    I'm now writing a plugin for the acrobat. According to my customer requirements, the pdf file is expected to be displayed within the MS IE
    browser widows. It worked within adobe Reader and Acrobat 7.0.x.
    Now I wanted to test my plugin against version adobe Reader and Acrobat
    8.0, 8.1.0, 8.1.1. Unfortunately, I got a strange behavior: pdf files are
    being diplayed in seperate windows, i.e. the IE browser window is empty
    and white blanked!
    - (Un)check "Display PDF in browser" option and close the window
    didn't help!
    - I tried also to upgrade gradually and after each upgrade checked if the
    problem persists --> I had the same behavoir after each update:
    7.0.5 -> 8.0; 8.0 --> 8.1.0; 8.1.0 --> 8.1.1
    - In some google - forums I found out that the following DLL's may be
    missing:
    Acropdf.dll, Acroiehelper.dll,Gbdetect.dll and Pdfshell.dll
    i got these dll's, put them into the activeX directory, but still I
    have the same problem
    You guys, do you have useful links / tips for me? Is this a known bug
    in the acrobat / Reader 8.0, 8.1.0, 8.1.1?
    By the it works fine within firefox!
    Further info about user SW versions:
    IE browser version 6.0 SP2, Windows XP SP2
    Thanks a lot in advance for your help
    Caleb

    thanks for the quick feedback-
    no, because my customer is using the IE 6. According to the system
    requirements all these Acrobat/Reader versions should also run
    properly under IE 6 http://www.adobe.com/support/downloads/detail.jsp?ftpID=3796
    I have a look in IE >> manage- add-ons and got the following Add-ons
    for adobe
    - Adobe PDF
    - Adobe PDF Conversion Tool helper
    both are enabled!
    Do I need more?
    can u pls check, if u have the following ddl's in the adobe home dir:
    Acropdf.dll, Acroiehelper.dll,Gbdetect.dll and Pdfshell.dll
    Thanks
    Caleb

  • Displaying PDF file in browser

    Hi,
    I want to display a PDF file in a browser which I have generated at runtime.
    I do it in this way:
    HttpServletResponse response = ((com.sap.tc.webdynpro.services.sal.adapter.core.IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletResponse();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    File pdfFile = new File("report1.pdf");
    try{
        baos.write(getBytesFromFile(pdfFile));
        response.setContentType("application/pdf");
        response.setContentLength(baos.size());
        ServletOutputStream out = response.getOutputStream();
        baos.writeTo(out);
        out.flush();
    catch(IOException ioe){
    If I put this code to a simple project (single view with this code only) its working fine. But if I want to display the file in a project which contains other functions and views it doesnt work (when the pdf should appear the application freezes).
    Can anyone help me?
    Ivo

    public int CreaFilePdf( )
           //@@begin CreaFilePdf()
           int ret = 0;
           byte[] pdfFoXMLFile = null;
           byte[] pdfFile;
           IWDCachedWebResource cachedPdfResource = null;
           String fileName = new String();
           String foText = new String();
           try {
                foText = this.toFoXML();
                wdContext.currentContextElement().setFoText(foText);
                pdfFoXMLFile = foText.getBytes("UTF-8");
                fileName = "Equipment.pdf";
                OutputStream outFo = new java.io.FileOutputStream("Equipment.pdf.fo");
                try {
                     outFo.write(pdfFoXMLFile);
                     outFo.flush();
                     outFo.close();
                } catch (IOException e2) {
                     // TODO Auto-generated catch block
                     e2.printStackTrace();
                /////////////fo to PDF
    //            Construct driver
                Driver driver = new Driver();
                //Setup logger
                Logger logger = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
                driver.setLogger(logger);
                MessageHandler.setScreenLogger(logger);
                //Setup Renderer (output format)       
                driver.setRenderer(Driver.RENDER_PDF);
                OutputStream out = new java.io.FileOutputStream("EquipmentFromFo.pdf");
                try {
                     driver.setOutputStream(out);
                     //Setup input
                     InputStream in = new java.io.FileInputStream("Equipment.pdf.fo");
                     try {
                          driver.setInputSource(new InputSource(in));
                          //Process FO
                          driver.run();
                     } finally {
                          in.close();
                } finally {
                     out.close();
                /////////////fo to PDF          
    //     /////////////////////////////web resource
         try {
           // create Excel 2003 XML data as a byte array for the given context node, attributes and headers 
           // Deserialize from a file
           File file = new File("EquipmentFromFo.pdf");
           // Get some byte array data ----> THIS  method is here: <a class="jive_macro jive_macro_message" href="" __jive_macro_name="message" modifiedtitle="true" __default_attr="2735976"></a>
           pdfFile = getBytesFromFile(file);
           //pdfFoXMLFile = this.toFoXML().getBytes("UTF-8");
           // create a cached Web Dynpro XLS Resource for the given byte array and filename
           //HERE create the URL object
           cachedPdfResource = this.getCachedWebResource(pdfFile, fileName, WDWebResourceType.PDF);
           // Store URL and filename of cached excel resource in context for UI linkToURL.
           if (cachedPdfResource != null) {
              wdContext.currentContextElement().setPdfFileURL(cachedPdfResource.getURL());
              wdContext.currentContextElement().setPdfFileName(cachedPdfResource.getResourceName());
           } else {
              ret = 1;
         catch (WDURLException e) {
              ret = 1;
           } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
           } catch (IOException e2) {
                // TODO Auto-generated catch block
                e2.printStackTrace();
           } catch (FOPException e3) {
                // TODO Auto-generated catch block
                e3.printStackTrace();
           return ret;
           //@@end

  • How to display an XML file as it is in browser that XI sent to my J2EE appl

    Hi all!
    I have a scenario like File->XI->J2EE appl.
    The file is getting picked up from my machine by XI.
    Now XI should send that XML file to my J2EE appl.
    My servlet receives that XML and displays as it is in browser. But am getting some error like:
    XML page cannot be displayed.
    XML document must have a top level element. Error processing resource 'http://localhost:7001/Invoke/DisplayRes'.
    I deployed my .ear file on BEA Weblogic application server9.0
    I found no error when i tested in SXI_MONI and RWB->Message monitor as well.
    This is my servlet code:
    public class DisplayRes extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doPost(request,response);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    BufferedReader brin =new BufferedReader(new InputStreamReader(request.getInputStream()));
    String inputLine;
    StringBuffer sBuf = new StringBuffer();
    PrintWriter out = response.getWriter();
    response.setContentType("text/xml");
    while ((inputLine = brin.readLine()) != null)
    sBuf.append(inputLine);
    //out.setContentType("text/xml");
    //out.println(sBuf.toString());
    out.write(sBuf.toString());
    brin.close();
    out.flush();
    what went  wrong? Help me
    Thanks

    Hi
    Can anyone tell me how XI sends messages to applications like J2EE. In REceiver comm channel, I think we specify about the target system like J2EE appl.
    Aadapter Type: HTTP
                   Receiver
    Transport Protocol:  HTTP1.0
    Message Protocol:    XI payload in HTTP body
    Adapter Engine:      Integration Server
    Addressing Type:     URL address
    Target host:         localhost
    Service Number:      7001(Port number of Weblogic appl server--where my J2EE appl is deployed).
    Path     :  /Invoke/DisplayRes/
    Authentication Type:Use Logon Data for SAP System
    Content Type: text/xml
    Username:   xiappluser
    password:   xx
    XML code:   UTF-8
    I suppose XI sends msgs to http://localhost:7001/Invoke/DisplayRes/........
    in this example if am correct?
    Then I have given all tyhe necessary setting but my servlet is not able to display XML msg in browser?
    This is my servlet code:
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
         PrintWriter out = response.getWriter();
         BufferedReader brin =new BufferedReader(new InputStreamReader(request.getInputStream()));
         String inputLine;
         StringBuffer sBuf = new StringBuffer();
            response.setContentType("text/xml");
         while ((inputLine = brin.readLine()) != null)
             sBuf.append(inputLine);
             out.println("hi");            
                out.println(sBuf.toString());
             brin.close();
             out.flush();
    What went wrong?
    Help me, all helpful answers are highly rewarded.
    Thanks

Maybe you are looking for