Stanely,
Correct this code does contain a hard coded path, however if you add a
reference to System.Windows.Forms, you can then show the user the save dialog
from here they can select a path and click save you can then take the
returned path and use it in your export function. Check the code below for
more details
Assuming you have a reference to System.Windows.Forms
public void button1_OnClick(DocActionEvent e)
{
//Create the Save dialog object
System.Windows.Forms.SaveFileDialog MySaveDialog = new
System.Windows.Forms.SaveFileDialog();
// set the default file type to save the file as
MySaveDialog.DefaualtExt = "mht";
MySaveDialog.Filter = "MHT | Microsoft HTML File"
MySaveDialog.ShowDialog();
e.XDocument.View.Export(MySaveDialog.FileNames[0].ToString(),"MHT");
}
As for Signing the form, basically the rule is this. If your form is
attempting to write files to a users machine or access resources on a users
machine then it will need to be either digitally signed using a certificate
generated by a trusted source VeriSign is a good place to get a certificate
if you don't have your own certificate server. The other option is to use the
RegForm util that is included in the SDK this is a command line utility that
can set the form to a full trust level hence enabling it to access files on
the users computer. However as you are publishing this form to share point a
digital Certificate may be a better idea.
Stanley said:
Ben, thanks for your response. But this piece of code has the save location
hardcoded. I would like to have the user choose their own save location.
I also looked into the digital signature thing and i don't understand
exactly what it says or what to do, but it seems like lots of work for just
to save a file locally.
My situation is, i have a form on sharepoint. Users can use this form to
enter data into a database. But sometimes they would like to have a copy of
the form before submitting. A copy is not stored in sharepoint, that's why
they have to save their own copy. They could use the "file\export to" menu
option, but appearantly they are not "that smart", so we would like to give t
hem a button to click on.
Thanks,
Stanley