首次提交:添加src文件夹代码
This commit is contained in:
31
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml.cs
Normal file
31
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Spire.Doc;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.Helper.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// HelpWindowView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class HelpWindowView : System.Windows.Controls.UserControl
|
||||
{
|
||||
public HelpWindowView()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadWordAsHtml(".\\doc.docx");
|
||||
}
|
||||
|
||||
private void LoadWordAsHtml(string filePath)
|
||||
{
|
||||
Document doc = new Document();
|
||||
doc.LoadFromFile(filePath);
|
||||
|
||||
// 转换为HTML
|
||||
string tempHtml = Path.Combine(Path.GetTempPath(), "temp.html");
|
||||
doc.SaveToFile(tempHtml, FileFormat.Html);
|
||||
|
||||
// 显示在WebBrowser
|
||||
webBrowser.Navigate(tempHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user