32 lines
787 B
C#
32 lines
787 B
C#
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);
|
|
}
|
|
}
|
|
}
|