savefiledialog

Python tkFileDialog.asksaveasfile - get file path

不羁岁月 提交于 2019-12-11 04:18:57
问题 I want to get path of file "exportFile". exportFile = tkFileDialog.asksaveasfile(mode='a') If I write "print exportFile", I get: <open file u'C:/Users/Desktop/Test/aaaa.txt', mode 'a' at 0x02CB6078> But I need only path - "C:/Users/Desktop/Test/aaaa.txt". Is there any solution? Thank you. 回答1: Use tkFileDialog.asksaveasfilename instead of tkFileDialog.asksaveasfile . NOTE tkFileDialog.asksaveasfilename does not take mode parameter. 回答2: Try this: exportFile = tkFileDialog.asksaveasfile(mode=

How to close Win32 SaveFileDialog when an error has occurred?

霸气de小男生 提交于 2019-12-11 02:49:44
问题 I've run into an issue with the Microsoft.Win32.SaveFileDialog in our Wpf application. If the user enters an enormous file path, above the allowed maximum (I think its 255 chars?), within the SaveFileDialog then it starts to become unusable (details of this are in the code example). So as a work-around I want to close the dialogue and make them enter the file path again. However the problem is that the SaveFileDialog does not have a Close() routine or anything else that I can see to close it.

Powerpoint VBA Macro Save As Dialog File Filter

*爱你&永不变心* 提交于 2019-12-11 01:59:44
问题 I want to export a PPT presentation to an .html file. Therefore I have the VBA code Sub HTMLExport() ActivePresentation.SaveAs "C\Users\test\pptInHtml.htm", ppSaveAsHTML, msoFalse End Sub This works, but I need the code for a "Save As Dialog Box", where the user can choose the path where the file will be saved as html (the user can only pick "save as html", nothing else). This is the code for my SaveAsDialog Sub ShowSaveAsDialog() Dim dlgSaveAs As FileDialog Set dlgSaveAs = Application

SaveFileDialog bug in WPF

拜拜、爱过 提交于 2019-12-10 22:55:38
问题 I'm using Microsoft.Win32.SaveFileDialog class to save my files. When I saved file, and minimize my app, I can't restore it back. It happens only after when used Microsoft.Win32.SaveFileDialog . Here is code: Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = String.Format("{0} {1} {2}", ev["b"], ev["a"], ev["c"]); dlg.DefaultExt = ".csv"; dlg.Filter = "Supported format (.csv)|*.csv"; Nullable<bool> result = dlg.ShowDialog(); if (result == true) { string

Opening response stream in silverlight

我的梦境 提交于 2019-12-10 19:58:08
问题 I am attempting to return a image from a server using Silverlight 3. The server returns the Response stream like this: context.Response.ContentType = imageFactory.ContentType imgStream.WriteTo(context.Response.OutputStream) imgStream.Close() context.Response.End() On the Silverlight client I am handling the stream like: Dim request As HttpWebRequest = result.AsyncState Dim response As HttpWebResponse = request.EndGetResponse(result) Dim responseStream As IO.Stream = response.GetResponseStream

SaveFileDialog exception in my WPF app

不羁岁月 提交于 2019-12-10 17:21:57
问题 One of my customers is experiencing a crash in my WPF application when saving a file. My save file code is: var saveFileDialog = new SaveFileDialog { InitialDirectory = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"\MyApp"), FileName = "MyFile", OverwritePrompt = true, AddExtension = true }; if (saveFileDialog.ShowDialog() == true) { ... } And here is the exception they are getting: Value does not fall within the expected range. A System.ArgumentException

Save File to MyDocuments + App Folder

空扰寡人 提交于 2019-12-09 16:45:32
问题 I am trying to save my .NET application settings file to the user's %MyDocument%\MyApplication folder, but I don't know how to check for an existing folder\file, and create or append the folder\file on save. I don't want to open a saveFileDialog because I need the file to be in the same place on all user computers. This is what I have so far, but it isn't working. Any help would be appreciated: var saveSettings = settingsList.text; //assign settings to a variable saveSettings = Regex.Replace

How can I prompt a user to choose a location to save a file?

做~自己de王妃 提交于 2019-12-08 16:54:01
问题 In my main Form I have a method called SavePDFDocument(): private void SavePDFDocument() { PDFWrapper pdfWrapper = new PDFWrapper(); pdfWrapper.CreatePDF(horizontalPictureScroller1.GetPictures(), "pdfDocument.pdf"); } As you can see, right now I'm manually typing in a name for the file. I'd like to ask the user to choose where to save it and what name to give it. This is the CreatePDF() method I'm using above: public void CreatePDF(List<System.Drawing.Image> images, string filename) { if

System.Windows.Forms.SaveFileDialog does not enforce default extension

非 Y 不嫁゛ 提交于 2019-12-08 15:58:24
问题 I am trying to make SaveFileDialog and FileOpenDialog enforce an extension to the file name entered by the user. I've tried using the sample proposed in question 389070 but it does not work as intended: var dialog = new SaveFileDialog()) dialog.AddExtension = true; dialog.DefaultExt = "foo"; dialog.Filter = "Foo Document (*.foo)|*.foo"; if (dialog.ShowDialog() == DialogResult.OK) { ... } If the user types the text test in a folder where a file test.xml happens to exist, the dialog will

Show IE “Save As” dialog using Watin

二次信任 提交于 2019-12-08 13:20:30
问题 Has anybody has done this? Navigating to a web page and pop up the save as dialog? In this way, the browser can handle the file type, html, pdf, etc... 回答1: Do you need to this to be when a FileHandler is called or on a static webpage? If it is on a Handler page where the content type is returned then according the latest WatiN release documentation then you can do as follows: using(IE ie = new IE(someUrlToGoTo)) { FileDownloadHandler fileDownloadHandler = new FileDownloadHandler(fullFileName