我想在保存时设置路径。 这是我的代码。这段代码应该设置一个路径,但它不起作用
SaveFileDialog1.ShowDialog()
SaveFileDialog1.InitialDirectory = "C:\Users\owner\Downloads"
答案 0 :(得分:0)
您必须先设置InitialDirectory
,然后再显示对话框。
SaveFileDialog1.InitialDirectory = "C:\Users\owner\Downloads"
SaveFileDialog1.ShowDialog()
答案 1 :(得分:0)
在显示对话框之前声明路径
string path="C:\Users\owner\Downloads";
SaveFileDialog1.InitialDirectory = path;
SaveFileDialog1.ShowDialog();
答案 2 :(得分:0)
jQuery( "#pdfsubmit" ).click(function() {
var $form = $("form[name='pdf-download']"),
$successMsg = $(".alert");
$.validator.addMethod("letters", function(value, element) {
return this.optional(element) || value == value.match(/^[a-zA-Z\s]*$/);
});
$form.validate({
rules: {
firstname: {
required: true,
minlength: 3,
letters: true
},
email_id: {
required: true,
email: true
}
},
messagess: {
firstname: "Please specify your name (only letters and spaces are allowed)",
email_id: "Please specify a valid email address"
},
submitHandler: function sendToServer() {
console.log("#pdfsubmit clicked");
var pdf = new jsPDF('p', 'pt', 'a4');
pdf.addHTML(document.getElementById("product_sheet"), function() {
var file = btoa(pdf.output());
var formData = new FormData();
formData.append('data', file);
$.ajax({
url: jspod.ajax_url + '?action=so56917978_upload',
data: formData,
processData: false,
contentType: false,
type: 'POST',
success: function(data) {
alert(data);
}
});
});
}
});
});