Microsoft Javascript Add-In: read/write to Excel, Access - javascript

I am trying to create a Microsoft Word Add in. I would like the javascript Add in to have the ability to read and write to Microsoft Access and Microsoft Excel files. This is trivial with VBA, but I do not want to divide up the user experience between my Javascript add in and a VBA button in the original Word document. I would like to be able to read and write from the Javascript add in somehow.
I know I have access to things like Word.run(function (context) {..... from the docs, but example functions have nothing to do with accessing other documents.
What is the right way to access other Microsoft documents from a Javascript add in to read and write?
Thanks.

By "other Microsoft documents" I'll assume you are talking about any related files the user has stored on their PC. But these JavaScript for Office add-ins are essentially just web pages running in an embedded browser, and applications running in a browser are sandboxed and just don't have access to the local computer (without installing client helper applications).
So your app will need to prompt the user to upload a file to your web server where you can interact with the file using a relevant API (which would be a completely different topic). Or you can use web-based APIs to interact with web-based file systems (OneDrive/Graph, Dropbox, etc.).

Related

Accessing user disk storage in chrome extension

I am building a chrome extension, I want to read and write in the user's disk storage. I want to make folders in users' documents, store screenshots, and delete and read. Is it possible?
I have searched, but could not find a way to do this, I want to know if it is possible, if it is possible, could you tell me, how to do that, or refer to some docs?
Extensions cannot access the file system directly.
(except in very limited ways)
Native Messaging allows extensions to access the file system, by passing messages to and receiving messages from a native application, such as a Python script.
The native application (which you have to program yourself) then accesses the file system directly.
Because your question isn't specific, I can only refer you to the official documentation:
https://developer.chrome.com/docs/apps/nativeMessaging/

Is it possible to create something like Google Chrome's Workspaces in the browser?

Is it possible to create something like Google Chrome's Workspaces, but with HTML5, Javascript or some other web based language?
I'm currently working on a web based ide, and I'm interested in implementing something similar to how Google Chrome handles local file editing. Basically asking the user for permission for accessing files in a particular directory that they select.
I've managed to open files that the user selects and show its content, but after editing there's no way to save it back to the same file, short of downloading it every time they save.
Is this possible with current technologies? or would I have to use something like Java?
The Achilles heel of your plan comes from a misunderstanding of the File System API. The most common misunderstanding about the File System API is that it might somehow give scripts direct read/write access to the client's local file system (e.g., C://whatever). As has been widely documented, including in the tag Wiki for HTML5-FileSystem here on Stackoverflow, "the File System API cannot directly access the local file system." The API provide access to a "virtual" file system, not the user's local file system. You cannot, therefore, use the File System API to "ask the user for permission for accessing files in a particular directory that they select," as you're seeking to do for your browser-based IDE project.

Read local file content and send it to server using Javascript

I am writing a very simple Elearning application for my virtual class. I wander if there may be a way using Javascript that works on the background to read the content of a file located on the user's computer and send its content to my server. Any one knows an open source code of Javascript doing this ?
I think that this can be done using XMLHttpRequest, i.e. AJAX, but I could not graps my way through. Any help
You can't gain access to a local file in browser because you are in sandbox, but there are some File API for Html 5 that you can programmatically select them and access their data just have a look at the following link
File API
Web applications should have the ability to manipulate as wide as possible a range of user input, including files that a user may wish to upload to a remote server or manipulate inside a rich web application. This specification defines the basic representations for files, lists of files, errors raised by access to files, and programmatic ways to read files. Additionally, this specification also defines an interface that represents "raw data" which can be asynchronously processed on the main thread of conforming user agents. The interfaces and API defined in this specification can be used with other interfaces and APIs exposed to the web platform.
Unfortunately there is no way to give JavaScript any access to the user's local files.
There is a very serious security issue with that.
There is however API for that on IE browsers (Which give nice big warning when you attempt to access the files)
I recommend to ask from the user to upload his own file (using <input type="file" />) and upload it to the server.
HTML5 specifications specify an API to access the local filesystem. It is supported in the latest versions of Chrome. See here for details http://net.tutsplus.com/tutorials/html-css-techniques/toying-with-the-html5-filesystem-api/.
If the environment is controlled (i.e in a classroom or intranet) you can build your application using this API.

HTML/Javascript/CSS Desktop Applications

I have written a program in HTML, Javascript and CSS, and I am displaying it in IE. I'm dependent on IE because data is written to, and read from an Excel File and I need to use ADO for that.
However, the "An activex object is trying to interact with oter parts of the page..." prompt is very irritating, seeing as it is an application that will be store locally on the user's computer, and will not be a web application. I find HTA difficult to debug and it seems as though it hasnt been updated in a while. I can't add my application to trusted sites and use custom level to deal with the activex prompt because it is stored on my computer. I was thinking on storing it on my local host, as I would then be able to add it to trusted site, but this would require adjustments to the user's computer.
Ao my question is, what is the best way for me to display my html/javascript/css program, as a desktop application, with little or no need to change any settings on the user's computer, that could read/write to and from excel spreadsheets (or if you know a better way of dealing with this data), and is stores on the user's couter rather than as a web application?
Any advice would be greatly appreciated:)
Write a windows application instead and use the Apis of excel. Your model of HTML CSS js will not work well with security.

web page to read client side registry

I currently have a web app that uses ActiveX / JScript to read files and to read the registry for a web page. Originally when designing the page, it was supposed to be on a site that only supported IE...then things changed and it is no longer that way. My question:
HTML5 is able to read files. Is there any way to read registry entries outside of ActiveX and internet explorer using javascript/html? I'm trying to avoid having to port the entire applet over to use Java, but that may be my best method.
The page makes no modifications, it only reads text files and registry entries.
It is not possible without a third party plugin.

Categories

Resources