I have one page that shows links, and I have some text data. How can I make using C++ CGI that by clicking on hyperlink "Save As" dialog will appear and certain amount of my text will be saved with user-defined path and name to the file on the users filesystem.
Actually, main question is how to show "Save as" dialog. After it, I think, everything will be easy.
Just set an appropriate content-type header and then output the file.
The browser takes care of the rest. Any file type it doesn't recognize causes the Save as dialog to be displayed.
They key to forcing the "Save as" dialog with a MIME type the browser can display is the Content-Disposition header.
Related
I want to restrict my file browser to displaying only the types of file I specify, e.g. .txt files only. The only relevant snippets of a code I found are like the following:
fileInput("in_file",
"Input file:",
accept=c("txt/csv", "text/comma-separated-values,text/plain", ".csv")
However, this does't filter the files showing in the browser to just .txt and .csv. Any ideas?
As far as I understand, that's the right way to do it. If you view your app in the RStudio viewer it wouldn't do anything, but in a browser it should. I'm using Chrome and I just ran that code and it did in fact only show me txt and csv files.
Of course the user can still choose to view other files by going to the little select box and choosing to view all files, but they have to consciously choose to do that. By default only csv and txt files will be shown
In a Windows Save File dialog, I would like to automatically change the extension part of the filename in the edit box when the user changes the filter. That is, if the user is saving an image file, and changes the type to JPEG, the file name automatically changes to .jpg.
IIRC this used to be possible via hooks but that approach is no longer supported. Is there a way to accomplish it now? I'm using C++ (C++Builder if it makes any difference).
Thanks.
We have a word 2003 template we use as the basis for a configuration sheet for a system. The whole thing is based around form fields and the template is then locked. To write a new document we double click on the template, fill in the form fields, save and off we go.
The problem Ive got is that when finished writing in the "doc" file and closing or saving I always get a dialog asking if I want to save changes to the template as well. Even if I just double click the template "dot" file so that a blank "doc" file based on this is opened and then close that document straightaway I still get the save template query.
Is there anyway I can get rid of it as its damned annoying to everyone who uses the template.
Many thanks
Further note:
I've just had Word 2003 opened with no documents or templates opened. I use file open and open the template. Once it is open I then close it again. No "do you want to save" messages. I then use windows explorer and double click on the same template to create a document. I wait til the document is sitting in word ready to use. I then click close again without typing or changing anything - After the do you want to save changes to "Document 2" which I say no to, I then get the "do you want to save the template" message.
Further further note:
I have now tracked this to some code I have that adds a toolbar and buttons. within this code is a line customizationcontext = Thisdocument and then the toolbar and buttons are created. If I change the line to CustomizationContext = ActiveDocument I then do not get the prompt for saving when I close a document created from the template. I do however now get the prompt if I open the template and close it without changing anything(also the buttons I added do not appear correctly (but they do appear in the document))! I can live with this though as it is preferable than the other way round.
The most common reason for this to happen, is that one of your formats (paragraph or other) is marked to update the source template if changed.
Check all the used formats in your template if the option to save back changes is activated and de-activate this option - the same applies to any .doc already created from this template since it will carry over this option.
To check your formats (in Word 2003), open the sidebar for styles and formatting, change the filter at the bottom to "Used formats". Move your pointer over the format you like to inspect and select the action "Modify..." from the pull down menu at the right.
On the bottom right - just above the OK-button - you'll find the checkbox labeled "Automatically update".
See also Automatically update a paragraph style.
I'm working on a project that collects data from the project then displays it using xfdf to populate a .pdf file. Now when I use Chrome or Firefox it opens in a new tab which is exactly what I want, but some of my clients will be using IE, which opens it in the same window and causes some confusion. What area of the code should I be looking at in order to tackle and solve this problem?
I can show code examples, just let me know what I need to show.
Thanks,
Steve
Edit: When I click 'Print Application' button, it asks me to save or open the file. When they click open, it opens in the same tab, I want it to appear in a new tab.
In my experience, the best way to accomplish this is to alter your template linking to the PDF. For example:
Clicky!
This should work in all browsers.
I'm coding a small and basic error tracker with Qt. The whole application is in a QTable.
Each error is linked to a file ; so, one of the columns of my table deals with that. I have a QLabel and a button next to it ; you click on the button to select a file, and then, the label displays the name of the file.
What I'd like to do now : the QLabel appears as a link, and when you click on it, it opens the file (with whatever app is associated to the file's extension). I'd rather it in the form of a link, because it's more obvious for the user. If I don't manage to do it, I'll go with a home QLabel herited class with a click signal, but it's not quite the same thing.
So, is what I want to do possible ?
And how would you do it ? Thanks in advance for your help !
You can use html in QLabel's text, so lets use that. Then set the QLabel to automatically open the link:
ui->label->setText("Link to file");
ui->label->setOpenExternalLinks(true);