Background
Our web application stores Microsoft Word documents which users want to edit (ideally with Word) in their browser of choice.
To access the web application (and the documents), users must login. As they are unwilling to login whenever they edit a document, document retrieval and storage must occur in their login session, which is easiest to accomplish if document download and upload is done by the browser.
Question
How can I embed Word into (or at least invoke it from) a browser window to edit a document the browser has retrieved from the server? It should work in both Internet Explorer and Firefox.
Own Research
ActiveX is not supported by Firefox.
There is not javascript api for invoking (let alone embed) native applications. Even if there were, I don't see how I could pass the document, and neither Internet Explorer 10 not Firefox 20 appears to offer an api to write a file to disk.
I could write a (signed) Java Applet to invoke Word, but ensuring that all changes are uploaded to the server appears difficult (what if the user closes the browser window before saving in Word?)
Eclipse has this nice feature of permitting in place editing word documents. This appears to be part of their SWT toolkit, but as that requires native code, I am not sure how to deploy it is an applet?
I don't know if they are embeddable for free, but you can take a look at Microsoft Office Webapps
Related
I work at a transcription company that stores physician's transcriptions on a central file server. Users are able to access our website and open up the transcription (a .doc file) to view, edit, e-sign, print, ect.
Currently, when the user goes to open the document, it uses a Java application and the local computer's Microsoft Word to open an instance of the document. Currently there are limitations to the application though.
Only Windows OS compatible (due to the Java COM operation)
Only 32-bit Java compatible
Difficult to replicate for mobile application
My question was, is it possible to have an in-browser editor, with the functionality of Word, that is able to pull and open Microsoft Word documents from a file server and allow users to make edits and save them across Windows and Apple OS, with possible mobile app integration as well?
A friend at Google suggested using Google Docs, which would require google accounts and a BA agreement, creating a little too much work on the client side. Any suggestions would help.
Thank you!
Of course a native docx editor would be best, however, you can convert to XHTML, edit with CKEditor, then convert back to docx.
This blog post of mine ignores the details/intricacies involved in doing that, instead jumping ahead to explain how to track content through that process.
I am a Java programmer. I would like to write a client-side Java program that adds-on to Firefox to perform operations on the HTML received from a specific remote web site, BEFORE that HTML is displayed in the user's browser. The client side Java program would have to:
Locate and read specific files on the local (end-user) machine on which it resides.
Check the URLs of web pages requested by Firefox.
If a URL requested through Firefox contains a specific domain:
Iterate through the HTML text looking for startcode and endcode.
Slice out the string between startcode and endcode.
Transform the string between startcode and endcode using info from file on local pc.
Replace the string between startcode and endcode with the transformed string.
Allow the Firefox browser window to display the modified HTML.
Basically, the Java program would intercept incoming HTML from a specific web site and alter the contents before the contents are displayed on the user's screen. How would I go about writing this kind of program?
Of course, I have administrative privileges on the computers that would run this program. But I have never written a browser add on before. I would like to write it in Java, but the code would need to always be on the client computer. The code could never be on the server. I do not know where to start this project.
#Athafoud is correct in general. No browser supports Java out of the box.
Instead:
You can write browser extensions for Firefox, Chrome, Safari, Opera in Javascript. E.g. the firefox-addon has a link list to get you started with Firefox extension development.
You can also write browser extensions for Firefox in C/C++ (to some extend) using either js-ctypes or XPCOM.
You can write some limited C++ stuff for Chrome via their NaCL APIs.
You could potentially write Java Applets for browsers that support the Java plugin and bundle them with and script them from your extension (to some extend) but that is a PITA.
Firefox extension APIs are the most capable as anything Firefox can do, extensions can do too (incl. calling into external libraries). Other browsers have far more limited extensibility/extension-facing APIs (due to architectural issues and sometimes in the name of security, although that bold security claim is... well, bold).
As for the particular requirements you gave in your question:
Firefox extensions are capable of transforming raw HTTP responses (although this is a bit cumbersome), as well as the DOM once HTML is parsed (from javascript). Firefox can read/write all files in the file system (abiding OS-level ACLs, of course).
Chrome extensions are not capable of transforming raw HTTP responses ATM, but you could modify the DOM once parsed. Also IIRC Chrome cannot read arbitrary files by default but you can manually enable read-access.
I dont think that you are able to use native java to write a firefox addon. You can use javascript. A good place to start is on Mozilla documentation site.
There is also a good guide here shortest-tutorial-for-firefox-extension, it is a bit old and the SDK has change, but i think is good start.
And a more update from mozzila itself how-to-develop-firefox-extension
I work for a non-profit who uses MS Access 2003 to keep track of donations and benefactors. Someone, a long time ago, wrote a huge VBA application inside access to keep track of everything, but we've outgrown Access's limitations. We're looking at replacing it with a web application (Java/MySQL), perhaps created with Wavemaker, but one feature which is very useful is the ability to launch a Word document (I don't know the name of the feature exactly), based on a template, that populates the template with some data from the Access DB. For example, a "Thank You" letter for a benefactor which is populated with their name and address.
I have no idea how to mimic this feature in a web application, and I'm open to any suggestions (even the abhored ActiveX controls). Any ideas?
Thanks in advance!
The general approach is not to automate client side. So you generate a PDF or word or perhaps even a rich text file server side then THEN provide a URL/link for the user to click on.
The user can then click on that URL (file) and the local client side software (either browser or word) can then open + render that file.
So a browser is quite happy to allows one to open a PDF or word (rtf) file FROM server side in the client side. And this includes opening such files with Word.
Attempting to launch CLIENT side software from a browser is not only a “high” risk adventure but if you setup such computers to allow the browser to create + launch + run + use such files client side then you open a security hole the size of a barn door.
What is to say with such security holes being opened the next site will not open or scan or look for files like “banking” or personal finance? So you really do not want nor can you attempt to automate client side software from a web browser.
However creating a PDF or even using some kind of web based report writer, they often have a “web export” option that creates a PDF or even Word format file that can be opened local. For example SQL server reporting services has a great PDF and Word export feature.
In fact if you using Access web services (that is Access web publishing for 2010), then the Access web reports render these reports near “perfect” in word and in fact Web Access Reports render better in Word then do client based Access applications!
So for example, looking at an Access Web based Report, you see this option:
If you click on actions then you get this option in the web browser:
Now, when you click on that, you can choose PDF or Word and your LOCAL client opens + renders the report. Really nice is all graphics and formatting is preserved in the web report (unlike client reports that loose their graphics).
The above of course is using Access Web publishing which just so happens to use SQL server reporting services. The “key” suggesting here DESPITE the fact that you don’t have or may not have SQL reporting services is that the creating + rendering of the document occurs SERVER side, and THEN the client can simply “open” or consume the report as PDF or in this case as above shows Word. Once again this means no client side automaton is required.
So create the document or template 100% server side. Depending on the reporting system and Web development tools you adopt then such tools might have built in Word creating system. In above I ONLY used MS Access to create this web site and the Access Web development tools are based on SQL reporting services which has the PDF and Word export built in as per above shows.
If you don’t have a report system you can still adopt a PDF format system or even use a common format like Rich Text which CLIENT side MS Word handles and opens quite well.
Here is the case.
User should be able to open MS Word document which is located somewhere in the network (ie. \remote\machine\documents\document_to_edit.docx) with MS Word 2007 by clicking link in the browser. Browser is IE7+.
Edit the document, close it and save it (no "Save as..." just "Save") in the same place in the network (\remote\machine\documents\document_to_edit.docx)
Is that at all possible? If so how should I do that?
Don't think this is relative, but I'm using JAVA + Wicket for my web application.
EDIT:
Any suggestions are welcome.
Main thing is - open file as it was on your computer and save it after edit.
(Read update below)
Short answer: not possible.
Long answer: When you open anything from a browser, even some local file, it will open the given file from the browser cache (or some temporary download directory) but not the original file linked. Therefore, after you save the changes the copied file will be updated.
Added:
Ok, after I thought about it for a while, there could be some ways to do it in intranet application. Here's how: Java applet: run native code from browser?
So, basically, you will serve the applet which will communicate with your javascript (I guess this way would be easiest to implement) (info on how to do it) and send a network path to the applet. Applet will start winword.exe passing it the required parameters.
Or, there's another option with ActiveX: http://codereflex.net/how-to-run-exe-on-webpage/ . The downside is - it works only with IE, but that seems what you need anyway.
IE can open \\server\share\file.docx type links and it opens the original file, not a downloaded version. You may need to add the domain of your http server to trusted sites in the security settings of IE first though. Have tested this and it does work
I am working on a web application developed in Java with struts running on Tomcat. I have a requirement in the web application as follows:
One JSP page having a list of PDF files each associated with a checkbox. The JSP page has one Button. Once the user selects the PDF documents he wants to print by selecting the associated checkboxes, user clicks on the button.
Then all the selected PDF docs should be sent to a specific local Printer( i.e. printer connected to the client machine where from user is accessing the web application). The selected PDF files should not be opened either in acrobat reader or in browser. The PDF docs should not be visible to the user while being sent to printer.
Could anyone please help me in implementing this requirement?
It is possible with Internet Explorer and ActiveX. Search about "auto print" and "silent printing" with Google. You may have to lower security settings in Internet Explorer for that.
We're using it here for some Intranets from our Customers.
For Firefox you may be able to trigger the print dialog via javascript. (http://stackoverflow.com/questions/975652/silent-print-a-embedded-pdf)
If this is the case you can disable print dialog in FF with setting print.always_print_silent=true in about:config.
Never did it on my own, so I cannot say for sure if it works like the ActiveX thing does.
For Chrome there is an issue requesting same feature like FF has. See https://code.google.com/p/chromium/issues/detail?id=31395.
You will most likely have to use a Java Applet for this. The browser have no inherent capability to print a pdf document. You may be able to access the "standard" adobe plugin, but to my knowledge it is not exposed to the standard scripting environment.
You can look here: Can a Java Applet use the printer?
Note: it is recommended to have the applet signed to prevent security restrictions and/or annoying questions to the user to allow access to printer.
You'll also need some form of PDF renderer in your applet (to render to printer). Something like http://java.net/projects/pdf-renderer/, read more here: http://juixe.com/techknow/index.php/2008/01/17/print-a-pdf-document-in-java/
That is not possible with JavaScript. It is possible with either Flash or a Java applet. In either case, you will need to be able to use both the Printer drivers and a custom PDF reading toolkit. There are adequate plugins for both for PDF reading, and both come with a printing API.
If I may say so, this is a bad requirement -- it is not good to force a user to print a document without reading it -- and should be re-negotiated, especially since it is trivially simple to have those documents print to PDF anyway.