Open up ms word in JSP

When I set the content type to msword and try to display the page as a Word document, the images are all broken. I'm certain the images location are correct, because it displays properly when it's set as a normal JSP page. Any ideas?
Thanks

Are you trying to open a web page within the MS Word plug-in? Why?
The original web page is defined in such a way that the web browser knows to go back to the server for the images it needs. The Word plug-in - which is launched if you set the content type to msword - does not know to do that because if you open any Word document on your computer, the computer assumes all of the files it needs are local.
Or rather, let's say your file is called "foobar.jsp". From word's perspective, it's no different than calling...
c:\msword.exe "c:\temporary internet files\foobar.jsp"In other words, there's no reason for it to not assume that everything it needs is within that one file.
Convert your JSP output into a true Microsoft Word document first (see jakarta.apache.org/poi/index.html) in order to bundle the images into the document, and then send the document to the browser.

Similar Messages

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

  • How to open a doc file using jsp Anchor tag

    when i am trying to open a doc file using a jsp it is opening with out proper alignment.
              how to open a doc file with proper alignment using Anchor Tag in JSp Page
              

    Hello!
    Does some one of you had open a MS word file (.doc) in Java search for a token like [aToken] replace it with another text and then feed it to a stream of save it?
    I want to build a servlet to open a well formatted and rich on media (images) ms word document search for tokens and replace them with information form a web form.
    Any Ideas?
    Thank you in advanced.

  • Present MS Word from JSP

    We are using Solaris/Netscape Web Server.
              I have JSP question for the JSP community.
              Scenario:
              1. We are developing a web site to store sensitive MS Word documents
              for the authorized intrnet users to browse and download.
              2. Users are force to redirect to the company HR web site to enter their HRID
              and password first when they're accessing our site.
              3. Then the HR web site will redirect the users to our site with users'
              cookie info.
              4. Our site check the cookie info, if the accesing user is an authorized
              user, our site will set the session, and JSP codes will display links
              in HTML to allow user to access the sensitive MS Word documents.
              Security Risk:
              The users who accessing the sensitive MS Word documents could cut/paste
              the document URL and email to other parties, when other parties access
              this document URL they are by passing the session control, they can access
              it directly.
              What We Did:
              1. Convert all the MS Word Documents to HTML then warp with JSP codes. This
              will only work for those MS Word Documents without embedded marcos.
              2. Hide the URL from Popup Browser. Users can still get the URL from
              Browser's Properties.
              3. Put all the MS Word Documents in the secure directory. Two layers of
              password protection is annoying, our users are complaining.
              How Can We Improve:
              1. Could we set content type to "application/msword"? and present these
              sensitive MS Word documents directly thru JSP, then each embedded hyperlink
              is JSP presenting these Word files.
              If this is doable, how to include MS Word in JSP?
              2. Is there a better way to achieve this?
              Thanks,
              Willy Jair
              [email protected]
              

    You can use iText (its open source) to generate rtf-files which can be read by Word.

  • Can't open document using Word or Text Edit

    I couldn't find a specific topic so I'm posting this here. I just got a new white macbook and transferred some word documents to it. I was out of town and realized I'd forgotten to load the Word program, so I opened a couple of documents using Text Edit and saved them as new documents. One document opened without issue, but the other document won't open with either Text Edit or MS Word 2004. When I try to open it in Word the message states it cannot be opened and may or may not be a valid word document. When I try to open in TextEdit the message states that the document is not in the right format. Please help -- I really don't want to have to re-create the document as it is about 12 pages!
    Thanks, Sandy

    There are 2 unusual options in File, Open in the Windows version of Word (sorry, I'm on a Mac without Word). One is something like Recover Text From Any Format, and the other is Open and Repair. One I think is on a drop down menu in the Open screen. I'm not sure if these are available on the Mac version, but it's worth a try! Also: do you have all the proper converters set up? I have Word 2004 for Mac running on one machine, a legal copy, and I was able to do updates and even get a free conversion program that actually backward converts Word 2007 for Windows and Word 2008 for Mac files down to Word for Mac 2004. It's worked quite will. I support Word on Macs and Windows at work and have used that conversion utility to great advantage when we had users call with Word docs that wouldn't open. Good luck!

  • How can I use Automator to open and save Word docs with links?

    Hi-
    I'm having trouble building a Workflow to open and save Word docs with links.
    My Workflow so far:
    1. Get Finder items
    2. Copy Finder items (to new folder)
    3. Rename selected items
    4. Open selected items (Word docs)
    Three problems occur.
    The first is a Word 2004 problem -- I can't get the warning "This document has links in it; do you want to open it with/without updating the links" to go away (Unilke the Macro warning toggle capability, there is nothing in the Preferences for Word 2004 that addresses the links warning, as far as I can tell; any insight you can shed on this would be terrific.)
    The second problem happens with Automator: if I manually accept the update of the first document's links, Automator opens that document but then halts completely, even though I've instructed it to open multiple documents.
    The third problem I have is that there's no Finder action in Automator that allows me to save the document that's now open (as far as I can see).
    Any suggestions for how to fix? If I can get this to work, and scheduled in iCal, it will be an unbelievable time saver.
    Thanks,
    Jeremy
    PowerPC G5   Mac OS X (10.4.6)  

    Hi there Jeremy,
    to do this you are going to have to add in some Run AppleScript steps...
    These will rely on GUI Scripting. So first you need to activate GUI Scripting.
    Now we need to add in a Run AppleScript action to the end of your workflow...
    This will replace your current number 4 in the workflow (Open Selected...)
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">on run {input, parameters}
    set allItems to every item of input
    repeat with currItem in allItems
    tell application "TextWrangler"
    open currItem
    end tell
    activate application "TextWrangler"
    tell application "System Events"
    tell process "TextWrangler"
    delay 2
    --when the Word document is opened I have told it to press okay !
    --I don't know what key you want it to press in the dialog box
    keystroke return
    delay 2
    --save the doc
    keystroke "s" using command down
    delay 5
    --close the doc
    keystroke "w" using command down
    end tell
    end tell
    end repeat
    return input
    end run</pre>
    The above script should open each Word Document, press a button in the dialog box then do a save and then close the doc...then loop through the rest of them.
    You need to replace the name Text Wrangler with Microsoft Word (or whatever it is called!), I don't have it on my Mac.
    You will have to let me know what button needs pressing in the first dialog, if it isn't the 'highlighted ' one then we will have to amend the script...
    regards
    Ric

  • Open And Edit Word File In SharePoint Site Programmatically (Without Save On Local system)

    Hi Sir ,
             I am working as sharepoint developer. I have face some problem in Edit and open document file in sharepoint site programmatically. I want to open file and edit directly in sahrepoint site without save in local system,
         Issue:   I have upload one doc file then try to edit and open but In that case file is dowanload and save in local save.

    Hello,
    As i understand you want to open and update word file. Please have a look at below links:
    http://mysharepointwork.blogspot.ca/2010/06/programmatically-open-and-save.html
    http://howtosharepoint.blogspot.ca/2010/05/programmatically-edit-and-save-file.html
    It is good place to start.
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • When i try to open a pdf file it opens as a word document and then a window pops up saying file conv

    When I try to open a pdf file it opens with microsoft word which I can't view. Then a window pops up with "file convertion - permissioning.pdf
    could you tell me how to rectify this,
    Thanks

    Your file association is corrupted; reinstalling or repairing Adobe Reader will likely fix it.
    If you want to fix it manually, tell us your operating system & version.

  • I am unable to open the microsoft word and excel and pdf files after upgratding to 4.3.3 os version

    I am unable to open the microsoft word and excel and pdf files after upgratding to 4.3.3 os version. I was able to access them in 4.3.1 .
    Can anybody tell when is this getting resolved.

    http://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile
    Your old Profile is located here in Vista & Win7: <br />
    ''drive'':\Users\''Windows login user name''\AppData\Roaming\Mozilla\Firefox\Profiles\''profile_name''

  • I'm trying to open a 900kb Word doc (240pages) in Pages but get this error message:  Import Warning - A table was too big. Only the first 40 columns and 1,000 rows were imported.

    I'm trying to open a 900kb Word doc (240pages) in Pages but get this error message:  Import Warning - A table was too big. Only the first 40 columns and 1,000 rows were imported.

    Julian,
    Pages simply won't support a table with that many rows. If you need that many, you must use another application.
    Perhaps the originator could use a tabbed list rather than a table. That's the only way you will be able to contain a list that long in Pages. You can do the conversion yourself if you open the Word document in LibreOffice, Copy the Table, Paste the Table into Numbers, Export the Numbers doc to CSV, and import to Pages. In Pages Find and Replace the Commas with Tabs.
    There are probably other ways, but that's what comes to mind here.
    Jerry

  • HT1386 I am unable to sync music to my touch IPod. No matter what I try, nothing works.  When I plug the IPod into the  laptop Itunes opens but the word 'device'  with my Ipod listed does not appear on the left side of the screen,

    I am unable to sync usic to my touch Ipod..When I plug it into my laptop Itunes opens but the word 'device' along with the name of my Ipod does not apperar.
    My Ipod and Itunes are upto to date. After Itunes opens a small box with the word Ipod appears near the top of the right side of the screen.  Then screen will go through the five steps of syncing. Afterward, still nothing has transfered to my Ipod(The box next to the songs I wanted were check)
    ANY IDEAS?..THANKS

    If you  have iTunes 11 turn on the Sidebar. Go to iTunes>View and click on Show Sidebar. You can also do a Crtl+S to show the sidebar. The sidebar is where Devices appears. and Control+B to show the Menu bar
    Then make sure that you have the right boxes chacked to sync. See:
    iTunes 11 for Windows: Set up syncing for iPod, iPhone, or iPad
    Have you successfuly synced from that iTunes library before?

  • Can't open Excel or Word files on share drive (SMB or AFP) after 10.9.2

    After updating to Mavericks OS 10.9.2, I can no longer open excel or word files on my company file share.  I receive the error:
    'FILEPATH' could not be found.
    Ckeck the spelling of the file name, and verify that the file location is correct.
    If you are trying to open the file from your list of most frequently used files on the File menu, make sure that the file has not been renamed, moved, or deleted.
    I am able to open files on my lcaol hard drive, and other external USB Flash drives.  Word present's a slightly different error, with the same theme (filename).
    I've tried rebooting both the client and server (both running 10.9.2).  Was successful opening files when booting the client into safe mode.  Any ideas?
    Bill

    I don't know if this will help but I had a similar problem that started yesterday. I have two macs.  Once can't open MS Office files from the other Mac but can open Office files on each Mac. Drove me nuts for about 2 hours today - on the phone with Apple twice and Microsoft once.  Finally found a similar post from 2007 that suggested to turn off and on file sharing by unchecking the "Share files and folders using AFP", on both computers and rebooting. That fixed it. 
    Funny thing, it was only with Office files I created since updating the software last week. Old Office files opened fine. 

  • I just updated my OS to Lion, I am no longer able to open all my "Word" documents, is there a way I can do this or change them all to Pages?

    I just updated my OS to Lion, I am no longer able to open all my "Word" documents, as the new system does not support this, can I get around this somehow?, or some way to change the documents all to "Pages"? Or, should I reinstall the Leopard OS, change all the word documents to Pages and then reinstall Lion?
    Thanks

    You can open Word files in Pages by default without any problem. Select one of the Word files by clicking once on it in Finder. Press cmd-i to Get Info on the file. In the bottom half of the window that opens, is Open with:. Below that click on the drop down box and select Pages.app. Then click on Change All... and confirm the "Are you sure... " warning. Now, all Word files will open in Pages.
    HTH

  • So I've been trying to open some Microsoft Word Documents and it says it can't be opened because PowerPC applications are no longer supported. What do I do about this?

    So I've been trying to open some Microsoft Word Documents and it says it can't be opened because PowerPC applications are no longer supported. What do I do about this?

    Workarounds:
    1.  Restore the OS X that you formerly used to run Word 2004;
    2.  Partition your hard drive or attach an external hard drive and install Snow Leopard (and Rosetta) so that you can "dual-boot" into Microsoft Word 2004;
    3.  Upgrade to Word 2011 or use an alternative program; or
    4.  The solution I use: Install Snow Leopard (and Rosetta) into Parallels 7 or 8:
                                  [click on image to enlarge]
    Full Snow Leopard installation instructions here:
    http://forums.macrumors.com/showthread.php?t=1365439

  • How to fix EXC_BAD_ACCESS error? I just upgraded to 10.7.5 and now I can't open any MS Word documents

    How to fix EXC_BAD_ACCESS error? I just upgraded to 10.7.5 and now I can't open any MS Word documents.
    I get this error message every time:
    Microsoft Error Reporting log version: 2.0
    Error Signature:
    Exception: EXC_BAD_ACCESS
    Date/Time: 2013-05-28 02:28:42 +0000
    Application Name: Microsoft Word
    Application Bundle ID: com.microsoft.Word
    Application Signature: MSWD
    Application Version: 14.3.4.130416
    Crashed Module Name: Microsoft Word
    Crashed Module Version: 14.3.4.130416
    Crashed Module Offset: 0x00938638
    Blame Module Name: Microsoft Word
    Blame Module Version: 14.3.4.130416
    Blame Module Offset: 0x00938638
    Application LCID: 1033
    Extra app info: Reg=en Loc=0x0409
    Crashed thread: 0
    I tried to remove the plist files, but it hasn't worked! Please help!

    What version of Microsoft Office for Mac do you have?
    Pete

Maybe you are looking for