在Web浏览器中自动保存文件而不显示保存对话框 [英] Automatic save files without show save dialog in web browser
本文介绍了在Web浏览器中自动保存文件而不显示保存对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们,
这是我在webBrowser1_DocumentCompleted()方法中的代码。当我点击链接它显示保存文件dialog.my要求是保存文件在提供的文件夹路径上没有任何弹出通过c#代码或Java脚本。
hi friends,
here is my code in webBrowser1_DocumentCompleted() method. when i click on link it show save file dialog.my requirement is save files on provided folder path without any pop up through c# code or java Script.
foreach (HtmlElement row in webBrowser1.Document.Window.Frames["View_Frame"].Document.GetElementsByTagName("TR"))
{
foreach (HtmlElement link in row.GetElementsByTagName("A"))
{
//code to click on weblink to download files.
}
}
推荐答案
根据您要保存的内容,如果您愿意保存文本,我建议你使用下面的代码,将你需要的文本放到richTextBox中,就是这样:
richTextBox1.SaveFile(@InsertLocationHere);
如果不是文本,请告诉我文件扩展名究竟是什么。
Depending on what you want to save, if you want to save text, I suggest you use the following code, get the text that you need into a richTextBox and that's it:
richTextBox1.SaveFile(@InsertLocationHere);
If it's not text, then tell me what exactly the file extension is.
这篇关于在Web浏览器中自动保存文件而不显示保存对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文