using Spire.Doc; using System.IO; namespace Cowain.Bake.UI.Helper.Views { /// /// HelpWindowView.xaml 的交互逻辑 /// 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); } } }