htmlコードを一時フォルダの下に書き込んでwebbrowserに送信します.

1811 ワード

        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;
        }