I have the following code that saves the file in the default Excel version ona given user's machine.
xlWorkBook.SaveAs("c:\\AMORT_data", Excel.XlFileFormat.xlWorkbookDefault, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
How can I use the SaveFiledialog (particularly .filter) format use this syntax? I tried something like this but I get the old "Cannot complicitly convert...." error. Is it simply a matter of converting the Excel Default to a string or is it more complicated.
saveFileDialog1.Filter = Excel.XlFileFormat.xlWorkbookDefault;
Have you tried the following below:
saveFileDialog1.Filter = "Excel file|*.xls";
This should limit files to be shown in the saveFileDialog as an .xls file. The whole example of opening and saving files from a saveFileDialog can be seen here.
Take note that the SaveFileDialog is not responsible for saving the file per se. It just shows you where you will be saving your file. To make sure that the file you are saving is an excel file you can just check the file extension prior to saving so that you can inform the user of the correct format to use.
Related
I have coded a file download button and I want to change the file name when downloaded. The original file name is an ugly concatenation of Ids and is also signe by AWS.
When I use a local file, the downloaded is carried out as wished, with the modified name. But when I use the AWS stored and signed file I still get the real file name. Actually the issue occurs with all external files.
The example below shows the issue. The file should be download as newname.pdf. In my browser (Mac Chrome 67.0.3396.87) it's being downloaded as activities.pdf.
Test button
Probably not allowed by External servers: CORS headers.
Related: HTML5 download attribute not working when downloading from another server, even when Access-Control-Allow-Origin is set to all (*)
I created a new Azure WebJobs project which is a console app. I placed a settings.json file in the root and I'm trying to access it using the following code but I keep getting an error that says it cannot locate the file. I think it's looking for it under Debug folder but I don't want to move the file there. How do I reference that file?
var config = new Configuration();
config.AddJsonFile("settings.json");
I tried "~/settings.json" but that didn't work either.
You need to identify if it's a deployment or runtime issue, per this article.
Make sure that your file is in fact getting deployed:
In VS, check that it has Copy to Output directory set to Copy if Newer
Use Kudu Console to look at the relevant WebJob folder under D:\home\site\wwwroot\App_Data\jobs\... and make sure that the json file made it to there next to the exe.
You can try to add your json file into your WebJob project's Resources as shown:
Remember to set the file type as Text and encoding to UTF-8.
In your code, you can easily access your json file as string as below:
// The Resources property depends on your actual file name being referenced
var settingsJson = Resources.settings;
Hope this helps!
I am using OpenOffice Calc 4.1.1 on Windows 7.
I am trying to use Link to External Data to load an external CSV file from a gaming website Wowuction.com. If I open the URL in my browser I get a CSV file saved to disk. But when I use that exact same URL in the "URL of external data source" box and hit enter, there is a short pause like its loading, but then nothing happens. Nothing appears in the "Available tables/ranges" box, the OK button is still disabled.
Does OpenOffice Calc not support CSV as an external data source?
In short: Calc doesn't support loading a CSV file externally, only HTML, ODS, XLS, maybe another.
But if you are confortable writing a dos script, you can download the CSV file and convert it to HTML continuously. Then you can just direct the 'Link to External Data' to you local HTML file.
It's been done on ubuntu linux, in case you want a little reference.
this is my html code to make user to download a file and it is hitting controller
window.location.href="#routes.ListManagementController.downloadList("+listName+")?listname="+listName;
this is my controller code:
String listName = Form.form().bindFromRequest().get("listname");
response().setContentType("application/x-download");
response().setHeader("Content-disposition", "attachment;filename="+listName+"_data_export.csv");
The above two respose() statements make a pop up to download a file I want the browsed file location
File file = new File("C:/csv/" + filename);
So, using servlet api we can write the content into browsed file location using respose.getOutputStream() method. In play there are is no support for servlet. I want browsed file location selected by user so that i can give that location to File and write the file over there.
You can't get the location of a directory on the client, and even if you could, your server side could wouldn't be able to write to it (since it would usually be on a different computer).
:image => StorageRoom::Image.new_with_filename(path)
I have to get the path of the image. So far i have specified the path manually and it worked and now i have put in heroku but it shows Load Error - No such file present.
How can i get the path value of the local system using browse button.
Your problem may not be related to path names, but to the fact that Heroku has a read-only file system. If you try to write files onto disk in a Heroku app, it simply doesn't work -- the file will not be saved.
The exception is the "temp" directory. You can save files there, but they are not guaranteed to persist for longer than the duration of a single request.
Is the file you are trying to open actually saved in your Git repo? If so, it will be on the disk in your Heroku app, and you should be able to open it.
To see what the filesystem layout looks like on your Heroku instance, you can create a controller method like:
render :inline => Dir['**/*'].inspect
File.expand_path
Reference : http://saaridev.blogspot.com/2006/11/ruby-finding-absolute-path-of-running.html
You don't need the full path. As far as file path in the client machine is concerned for file uploads, the path is irrelevant as it poses security risks for the user.
Most modern browsers don't send the file path for file uploads. You could get the path using Javascript or Flash but still I don't see the logic behind doing this.
When a user clicks on the submit button the browser should at least send you the file name with the file data together with a bunch of other information like the mime type. Your web server would either write the file to disk or process it in memory assuming you have near infinite memory resources. Look at the RFC 1867 for file uploads for more on this.