将html代码写入临时文件夹下面的 然后发来给webbrowser使用
2012-12-14 09:51
204 查看
private void FormTemplatePreview_Load(object sender, EventArgs e) { this.textBoxReviewTitle.Text = this.Title.Trim(); this.webBrowser1.Url = new Uri(WriteHtmlToPath()); } //将html代码写入临时文件夹下面的 然后发来给webbrowser使用 private string WriteHtmlToPath() { string tempPath = System.IO.Path.GetTempPath(); string htmlPath = Path.Combine(tempPath, @"tempReview.html"); if (!File.Exists(htmlPath)) { File.Create(htmlPath); } File.WriteAllText(htmlPath, this.Content); return htmlPath; }
相关文章推荐
- 在QTP中,经常会遇到需要写入外部文件的地方,比如写Log什么的,这时,可以使用下面代码进行写Txt操作。
- 关于使用WinHtmlEditor控件获得html代码加载到wpf中webbrowser控件上乱码问题
- 黄聪:wordpress向mysql字段中保存html代码(使用add_option()方法),然后无法显示出问题
- 将 html 代码写入 js 文件中,然后在网页中引用此 js 文件,实现头模板重用
- Java使用wkhtmltox实现HTML代码生成PDF文档或者图片
- Web MVC开发程序代码的简写方法,强类型数据和Html helper使用方法。车老师代码
- 使用PHP遍历文件夹与子目录的函数代码
- 使用 pylint 检测python代码质量(sonar-scanner调用pylint,然后数据交给sonar服务器)
- 漂亮的代码2:遍历文件夹目录,使用promise
- 最大化 JavaScript 应用程序的金科玉律是尽可能使用外部 JavaScript 文件,而不是直接将 JavaScript 代码包含在 HTML 文件中
- 在Silverlight页面里显示HTML的免费控件下载(附使用方法代码)
- 向WebBrowser控件插入HTML代码
- html页面不使用缓存的代码
- 后端往前段传递参数,大部分人都清楚,无非就是发起ajax请求获取后端值,然后通过js写入html相应位置即可。但是前段html页面之间,怎么传递参数呢?
- 使用lua代码创建文件夹,解压zip文件到指定目录(亲测可用)
- 【Html】想加入一行代码吗?使用<code>标签
- 打开Word2003时出现“无法访问您试图使用功能所在的网络位置”请按确定重试,或在下面框中输入包含安装程序包genko.msi的文件夹的路径.
- 强制不使用“兼容性视图”的HTML代码
- 分享7个超实用的Emmet(zen coding)HTML代码使用技巧
- django中使用ckeditor 直接显示html代码的问题