I'm looking fora functionality that if you press a button or a link inside of a website, it will automatically open excel in you local computer. The button or link that you press is defined with specific data for instance data "test" and you want to have the data inside of the excel after you have pressed the button or link
Please remember that you have the data in the webpage and then when you press on the button or link you open the excel document and the data from the wepage will be transer automatically to the excel document.
Is it possible to do it? if yes, how?
I have tried finding a solution by using sourcecode but I failed.
You can use the ms-excel scheme to open a file in Excel.
A simple example:
<a href="ms-excel:ofe|u|http://berkeleycollege.edu/browser_check/samples/excel.xls">
Open in Excel
</a>
Demo: http://jsfiddle.net/DerekL/mp0p1gcq/
Another demo: http://jsfiddle.net/DerekL/x9npn97z/
Full Syntax Definition for the ms-excel scheme:
Excel Scheme = "ms-excel:" open-for-edit-cmd | open-for-view-cmd | new-from-template-cmd
open-for-edit-cmd = "ofe|u|" document-uri
open-for-view-cmd = "ofv|u|" document-uri
new-from-template-cmd = "nft|u|" template-uri ["|s|" save-location]
document-uri = URI location of document to open
template-uri = URI location of template file upon which new file will be based
save-location* = URI location of folder in which new document should be created
*save-location is an optional parameter
Related
I have a MVC project with a view. Have a directory on server with files, and have to show good looking Open File dialog box with this directory and files in it (not a user's local directory). I got a list of files, and path, and send as variables (string and array of strings) into my view, so now I can show directory listing on my page. But I'd like to use some standard looking dialog box for choosing file instead of writing my own window with radio buttons and text boxes.
Is there any way to fill Open file dialog box with my list of files With Javascript?
Regarding the buttons, you can take a look at bootstrap: https://getbootstrap.com/docs/4.0/components/list-group/
There you can use predefined buttons, lists etc. But specifically for downloading files there is no SPECIAL button of any kind.
Regarding the JS part, you can use something like:
<a id="download_link" download=filename.txt" href=”” onclick="getFile('someinputtxt')"><font size="5">Download Txt File</font></a>
<script>
function getFile(input)
{
var text = input;
var data = new Blob([text], {type: 'text/plain'});
var url = window.URL.createObjectURL(data);
document.getElementById('download_link').href = url;
}
</script>
There I create a text file with some input. But basically you can use a button/list that is already in bootstrap for example and just add the file using 'download':
Hope it helps.
My goal is to have the user press a button to select a file ONE TIME that will be used both as an attachement and the button icon. I know how to do each of these tasks separately, but this requires my user to select the same file twice. I am looking for a way to either:
Have them import a file as a button Icon, then change the Icon into a DataObject and attach it to the pdf
Have them import a file as a DataObject attachment, then convert it to an Icon
Is this possible? I haven't been able to figure this conversion step out.
Thanks
You can prompt the user for the file to import once and then use the path for the two use cases you need.
var img = app.browseForDoc(); // prompts the user to select the file
var imgPath = img.cPath; // get the device independent path to the file
this.importDataObject("myDataObjectFileName", imgPath); // import the data object
this.getField("myImageButton").buttonImportIcon(imgPath); // set "normal" the button face
Your button must be set up to show an icon first and you'll also want to set the scaling properties as well. You can make the attachment name the same as the file name with some simple string functions on the path.
I have created a Kendo spreadsheet on my project and I want to load the spreadsheet from the 'open file' button as below.
I want to get the uploaded/loaded file name to a JavaScript variable. Thank you.
The excelImport event passes the selected file in its event arguments. You can access the file name via e.file.name.
function getFileName(e) {
var fileName = e.file.name;
}
I am running a blog: http://jokesofindia.blogspot.com. I want to provide a dynamic link in the sidebar of my blog to download a Hindi newspaper in pdf format.
I tried to view source url of epaper.patrika.com and found that if I enter the url epaper.patrika.com/pdf/get/145635/1 it will download the first page and epaper.patrika.com/pdf/get/145635/2 it will download second page, and so on.
The last part of url is the page number. But the second to last part of the url, '145635', changes every day. Now I want to be able to enter this changing part of url manually every day and then have the JavaScript generate download links with the date replaced by the information I entered.
This code also needs to work on mobile devices such as Android.
You can use the html5 data object to store the data and use JS to get that data and append it to the link:
HTML
<div class="linkholder" data-number="12345">
PDF page 1
PDF page 2
</div>
JS
$(document).ready(function() {
var newNum = $('.linkholder').attr('data-number');
$('.linkholder a').each(function() {
var newLink = $(this).attr('href').replace('#', newNum);
$(this).attr('href',newLink);
});
});
view the CodePen to see it in action.
Below code is working fine to write XML data into a file.
function btnSave_onclick() {
var aFSO = new ActiveXObject("Scripting.FileSystemObject");
aTS = aFSO.OpenTextFile(FilePath,2,true);
aTS.Write (XMLText.value);
aTS.Close();
}
I want to change this code to show a dialog box to saveAs in desired location.
I found below code to open save as dialog box
document.execCommand('SaveAs','true',filename.txt);
Now question is how can I save data (which is in XMLText.value) through This dialog.
Is there any other way to save data trogh dialogBox. It is for IE
In other way Is it possible to provide a Browse button to select desired location in c: drive or any other drive and by saying ok get that path and store in a variable and by using above code can save directly to that location.
But here question is how to provide browse button?