diff --git a/.vs/AIProofread/v17/.suo b/.vs/AIProofread/v17/.suo index cd063af..3846f68 100644 Binary files a/.vs/AIProofread/v17/.suo and b/.vs/AIProofread/v17/.suo differ diff --git a/AIProofread/AIProofread.csproj b/AIProofread/AIProofread.csproj index 82bedbf..73b0baf 100644 --- a/AIProofread/AIProofread.csproj +++ b/AIProofread/AIProofread.csproj @@ -344,6 +344,12 @@ FormWebView.cs + + Form + + + MessageTips.cs + UserControl @@ -405,6 +411,9 @@ FormWebView.cs + + MessageTips.cs + ProofreadMainControl.cs @@ -501,6 +510,18 @@ + + + + + + + + + + + + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/AIProofread/Bridge.cs b/AIProofread/Bridge.cs index c7e596c..bd9fdd7 100644 --- a/AIProofread/Bridge.cs +++ b/AIProofread/Bridge.cs @@ -136,7 +136,7 @@ namespace AIProofread Globals.ThisAddIn.ribbon.SetBtnStatus(key, status); } - public void showDialog(string message, string confirmText = "", string confirmAction = "") + public void ShowDialog(string message, string confirmText = "", string confirmAction = "") { Globals.ThisAddIn.ActiveDocument?.ShowDialog(message, confirmText, confirmAction); } @@ -206,7 +206,7 @@ namespace AIProofread } catch { - showDialog("打开网页失败"); + ShowDialog("打开网页失败"); } } @@ -591,9 +591,14 @@ namespace AIProofread return InitContent(content, documentId, false); } + public void ShowMessage(string message,int closeDelay=1000) + { + //FormMessage.ShowMessage(message, closeDelay); + Globals.ThisAddIn.ActiveDocument?.ShowMessage(message, closeDelay); + } public string ShowDialogMessage(string message) { - var result = FormMessage.ShowMessage(message); + var result = FormMessage.ShowMessage(message, "确认",null); if (result == DialogResult.Retry) { return "retry"; diff --git a/AIProofread/Config.cs b/AIProofread/Config.cs index 422d293..c1e73fd 100644 --- a/AIProofread/Config.cs +++ b/AIProofread/Config.cs @@ -12,7 +12,7 @@ namespace AIProofread public class Config { public static readonly string APP_NAME = "AI校对王"; - public static readonly string APP_VERSION = "2.0.1"; + public static readonly string APP_VERSION = "2.0.2"; public static bool IS_WPS = false; public static bool UpgradeForcedNotice = false; public static readonly string APP_BASE_DIR = AppDomain.CurrentDomain.BaseDirectory; diff --git a/AIProofread/Controls/FormMessage.Designer.cs b/AIProofread/Controls/FormMessage.Designer.cs index dd544f2..f5456a7 100644 --- a/AIProofread/Controls/FormMessage.Designer.cs +++ b/AIProofread/Controls/FormMessage.Designer.cs @@ -44,7 +44,7 @@ this.LblMeesage.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.LblMeesage.Location = new System.Drawing.Point(30, 60); this.LblMeesage.Name = "LblMeesage"; - this.LblMeesage.Size = new System.Drawing.Size(320, 140); + this.LblMeesage.Size = new System.Drawing.Size(320, 70); this.LblMeesage.TabIndex = 4; this.LblMeesage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -70,6 +70,7 @@ this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(380, 46); this.panel1.TabIndex = 3; + this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); // // label1 // @@ -81,6 +82,7 @@ this.label1.Size = new System.Drawing.Size(74, 21); this.label1.TabIndex = 0; this.label1.Text = "温馨提示"; + this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown); // // BtnClose // @@ -96,7 +98,7 @@ this.BtnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.BtnClose.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.BtnClose.ForeColor = System.Drawing.Color.Black; - this.BtnClose.Location = new System.Drawing.Point(200, 214); + this.BtnClose.Location = new System.Drawing.Point(200, 150); this.BtnClose.Name = "BtnClose"; this.BtnClose.Size = new System.Drawing.Size(120, 44); this.BtnClose.TabIndex = 2; @@ -116,7 +118,7 @@ this.BtnConfirm.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.BtnConfirm.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.BtnConfirm.ForeColor = System.Drawing.Color.White; - this.BtnConfirm.Location = new System.Drawing.Point(60, 214); + this.BtnConfirm.Location = new System.Drawing.Point(60, 150); this.BtnConfirm.Name = "BtnConfirm"; this.BtnConfirm.Size = new System.Drawing.Size(120, 44); this.BtnConfirm.TabIndex = 1; @@ -129,7 +131,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(380, 286); + this.ClientSize = new System.Drawing.Size(380, 216); this.Controls.Add(this.LblMeesage); this.Controls.Add(this.panel1); this.Controls.Add(this.BtnClose); diff --git a/AIProofread/Controls/FormMessage.cs b/AIProofread/Controls/FormMessage.cs index 3bca276..998e424 100644 --- a/AIProofread/Controls/FormMessage.cs +++ b/AIProofread/Controls/FormMessage.cs @@ -1,10 +1,24 @@ using System; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace AIProofread.Controls { public partial class FormMessage : BaseWinForm { + public const int WM_NCLBUTTONDOWN = 0xA1; + public const int HT_CAPTION = 0x2; + + [DllImport("user32.dll")] + public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); + [DllImport("user32.dll")] + public static extern bool ReleaseCapture(); + + /// + /// 初始化宽度 + /// + private const int INIT_WIDTH = 380; + public FormMessage() { InitializeComponent(); @@ -37,26 +51,46 @@ namespace AIProofread.Controls ), BtnClose.Location.Y); } + /// + /// 计算缩放 + /// + /// + /// + private int ScaleSize(int size) + { + return (int)(size * this.Width * 1.0 / INIT_WIDTH); + } + private void ResetButtons() { - BtnClose.Location = new System.Drawing.Point(200, BtnClose.Location.Y); - BtnConfirm.Location = new System.Drawing.Point(60, BtnConfirm.Location.Y); + BtnClose.Location = new System.Drawing.Point(ScaleSize(200), BtnClose.Location.Y); + BtnConfirm.Location = new System.Drawing.Point(ScaleSize(60), BtnConfirm.Location.Y); BtnConfirm.Visible = true; BtnConfirm.Enabled = true; } - - public static DialogResult ShowMessage(string message,string confirmText = "确认",string confirmAction = null) + public static FormMessage ShowMessage(string message, int closeDelay = 3000) + { + FormMessage formMessage = new FormMessage(); + formMessage.SetMessage(message); + formMessage.HideConfirm(); + // 先置顶 + formMessage.TopMost = true; + formMessage.Show(); + return formMessage; + } + public static DialogResult ShowMessage(string message, string confirmText = "确认", string confirmAction = null) { FormMessage formMessage = new FormMessage(); formMessage.SetMessage(message); formMessage.currentConfirmAction = confirmAction; - if(string.IsNullOrEmpty(confirmText)) + if (string.IsNullOrEmpty(confirmText)) { formMessage.HideConfirm(); } else { + formMessage.BtnConfirm.Text = confirmText; formMessage.ResetButtons(); } return formMessage.ShowDialog(); @@ -81,5 +115,21 @@ namespace AIProofread.Controls { this.Close(); } + + private void HanleMouseDown() + { + ReleaseCapture(); + SendMessage(this.Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0); + } + + private void label1_MouseDown(object sender, MouseEventArgs e) + { + HanleMouseDown(); + } + + private void panel1_MouseDown(object sender, MouseEventArgs e) + { + HanleMouseDown(); + } } } diff --git a/AIProofread/Controls/MessageTips.Designer.cs b/AIProofread/Controls/MessageTips.Designer.cs new file mode 100644 index 0000000..65d3ae0 --- /dev/null +++ b/AIProofread/Controls/MessageTips.Designer.cs @@ -0,0 +1,46 @@ +namespace AIProofread.Controls +{ + partial class MessageTips + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // MessageTips + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(483, 360); + this.Name = "MessageTips"; + this.Text = "MessageTips"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/AIProofread/Controls/MessageTips.cs b/AIProofread/Controls/MessageTips.cs new file mode 100644 index 0000000..7d15e8a --- /dev/null +++ b/AIProofread/Controls/MessageTips.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace AIProofread.Controls +{ + public partial class MessageTips : Form + { + public MessageTips() + { + InitializeComponent(); + } + } +} diff --git a/AIProofread/Controls/MessageTips.resx b/AIProofread/Controls/MessageTips.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/AIProofread/Controls/MessageTips.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/AIProofread/Model/DocumentInfo.cs b/AIProofread/Model/DocumentInfo.cs index b7ab6a0..8d0c7a2 100644 --- a/AIProofread/Model/DocumentInfo.cs +++ b/AIProofread/Model/DocumentInfo.cs @@ -115,6 +115,19 @@ namespace AIProofread.Model FormMessage.ShowMessage(message, confirmText, confirmAction); })); } + public void ShowMessage(string message, int closeDelay) + { + var msgForm = FormMessage.ShowMessage(message, closeDelay); + // n毫秒后自动关闭 + System.Threading.Tasks.Task.Delay(closeDelay).ContinueWith(t => + { + if(msgForm.IsDisposed) return; + TaskPane.Control.BeginInvoke(new Action(() => + { + msgForm.Close(); + })); + }); + } public void ShowLogin(string action) { @@ -589,6 +602,10 @@ namespace AIProofread.Model int index = 0; foreach (var item in correct.CorrectItems) { + if (item.Origin == "不同变换角色" || item.Origin == "给与") + { + Console.WriteLine("", item.Id); + } if (marks.ContainsKey(item.Id)) continue; Logger.Log(string.Format("mark type {0} data {1}->{2}", item.Tag, item.Origin, item.Text)); int _prev = prevOffset; @@ -607,7 +624,7 @@ namespace AIProofread.Model try { if (item.Tag == "i") - { + { insertMarks.Add(new InsertMarkData() { Mark = mark, diff --git a/AIProofread/Properties/Resources.Designer.cs b/AIProofread/Properties/Resources.Designer.cs index f34240d..02d9710 100644 --- a/AIProofread/Properties/Resources.Designer.cs +++ b/AIProofread/Properties/Resources.Designer.cs @@ -369,5 +369,45 @@ namespace AIProofread.Properties { return ((System.Drawing.Bitmap)(obj)); } } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap logo { + get { + object obj = ResourceManager.GetObject("logo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap logo_no_text { + get { + object obj = ResourceManager.GetObject("logo_no_text", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap logo_no_text_wps { + get { + object obj = ResourceManager.GetObject("logo_no_text_wps", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap logo_wps { + get { + object obj = ResourceManager.GetObject("logo_wps", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/AIProofread/Properties/Resources.resx b/AIProofread/Properties/Resources.resx index 18a61ee..ae4466c 100644 --- a/AIProofread/Properties/Resources.resx +++ b/AIProofread/Properties/Resources.resx @@ -160,6 +160,9 @@ ..\Resources\icon-setting.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icon-update.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -181,6 +184,9 @@ ..\Resources\icon-export.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icon-history.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\button_default.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -190,6 +196,9 @@ ..\Resources\icon-refresh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\logo_wps.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + ..\Resources\icon-clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -202,13 +211,16 @@ ..\Resources\icon-logout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icon-history.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\icon_close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\icon-panel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\icon_close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\logo_no_text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\logo_no_text_wps.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/AIProofread/Resources/icon-book-wps.jpg b/AIProofread/Resources/icon-book-wps.jpg index d02cc2a..b13b6d2 100644 Binary files a/AIProofread/Resources/icon-book-wps.jpg and b/AIProofread/Resources/icon-book-wps.jpg differ diff --git a/AIProofread/Resources/icon-book.png b/AIProofread/Resources/icon-book.png index 94068fe..5ddec18 100644 Binary files a/AIProofread/Resources/icon-book.png and b/AIProofread/Resources/icon-book.png differ diff --git a/AIProofread/Resources/icon-clear-wps.jpg b/AIProofread/Resources/icon-clear-wps.jpg index 2d591e0..7fe57a8 100644 Binary files a/AIProofread/Resources/icon-clear-wps.jpg and b/AIProofread/Resources/icon-clear-wps.jpg differ diff --git a/AIProofread/Resources/icon-clear.png b/AIProofread/Resources/icon-clear.png index e6945a7..fd55ee0 100644 Binary files a/AIProofread/Resources/icon-clear.png and b/AIProofread/Resources/icon-clear.png differ diff --git a/AIProofread/Resources/icon-export-wps.jpg b/AIProofread/Resources/icon-export-wps.jpg index 98e5742..a976799 100644 Binary files a/AIProofread/Resources/icon-export-wps.jpg and b/AIProofread/Resources/icon-export-wps.jpg differ diff --git a/AIProofread/Resources/icon-export.png b/AIProofread/Resources/icon-export.png index f449f13..c5c56e0 100644 Binary files a/AIProofread/Resources/icon-export.png and b/AIProofread/Resources/icon-export.png differ diff --git a/AIProofread/Resources/icon-history-wps.jpg b/AIProofread/Resources/icon-history-wps.jpg index 90df8b5..e015061 100644 Binary files a/AIProofread/Resources/icon-history-wps.jpg and b/AIProofread/Resources/icon-history-wps.jpg differ diff --git a/AIProofread/Resources/icon-history.png b/AIProofread/Resources/icon-history.png index 1ad3d17..f0dec0d 100644 Binary files a/AIProofread/Resources/icon-history.png and b/AIProofread/Resources/icon-history.png differ diff --git a/AIProofread/Resources/icon-logout-wps.jpg b/AIProofread/Resources/icon-logout-wps.jpg index 7ee6611..c6825b2 100644 Binary files a/AIProofread/Resources/icon-logout-wps.jpg and b/AIProofread/Resources/icon-logout-wps.jpg differ diff --git a/AIProofread/Resources/icon-logout.png b/AIProofread/Resources/icon-logout.png index b83acc7..c85e6d0 100644 Binary files a/AIProofread/Resources/icon-logout.png and b/AIProofread/Resources/icon-logout.png differ diff --git a/AIProofread/Resources/icon-panel-wps.jpg b/AIProofread/Resources/icon-panel-wps.jpg index 064f943..142707f 100644 Binary files a/AIProofread/Resources/icon-panel-wps.jpg and b/AIProofread/Resources/icon-panel-wps.jpg differ diff --git a/AIProofread/Resources/icon-panel.png b/AIProofread/Resources/icon-panel.png index 9b64958..9526c18 100644 Binary files a/AIProofread/Resources/icon-panel.png and b/AIProofread/Resources/icon-panel.png differ diff --git a/AIProofread/Resources/icon-phone-wps.jpg b/AIProofread/Resources/icon-phone-wps.jpg index 049e252..b7fa713 100644 Binary files a/AIProofread/Resources/icon-phone-wps.jpg and b/AIProofread/Resources/icon-phone-wps.jpg differ diff --git a/AIProofread/Resources/icon-phone.png b/AIProofread/Resources/icon-phone.png index 104a133..0cda381 100644 Binary files a/AIProofread/Resources/icon-phone.png and b/AIProofread/Resources/icon-phone.png differ diff --git a/AIProofread/Resources/icon-proofread-wps.jpg b/AIProofread/Resources/icon-proofread-wps.jpg index 0d7b4fc..9275f63 100644 Binary files a/AIProofread/Resources/icon-proofread-wps.jpg and b/AIProofread/Resources/icon-proofread-wps.jpg differ diff --git a/AIProofread/Resources/icon-proofread.png b/AIProofread/Resources/icon-proofread.png index d659595..5bf47b1 100644 Binary files a/AIProofread/Resources/icon-proofread.png and b/AIProofread/Resources/icon-proofread.png differ diff --git a/AIProofread/Resources/icon-refresh-wps.jpg b/AIProofread/Resources/icon-refresh-wps.jpg index 2ccde9d..d6100b5 100644 Binary files a/AIProofread/Resources/icon-refresh-wps.jpg and b/AIProofread/Resources/icon-refresh-wps.jpg differ diff --git a/AIProofread/Resources/icon-refresh.png b/AIProofread/Resources/icon-refresh.png index d78f0be..914604e 100644 Binary files a/AIProofread/Resources/icon-refresh.png and b/AIProofread/Resources/icon-refresh.png differ diff --git a/AIProofread/Resources/icon-save-wps.jpg b/AIProofread/Resources/icon-save-wps.jpg index bf749cc..88e95e0 100644 Binary files a/AIProofread/Resources/icon-save-wps.jpg and b/AIProofread/Resources/icon-save-wps.jpg differ diff --git a/AIProofread/Resources/icon-save.png b/AIProofread/Resources/icon-save.png index 7ef3b41..6628bd0 100644 Binary files a/AIProofread/Resources/icon-save.png and b/AIProofread/Resources/icon-save.png differ diff --git a/AIProofread/Resources/icon-setting-wps.jpg b/AIProofread/Resources/icon-setting-wps.jpg index 5c5c3c6..116b6eb 100644 Binary files a/AIProofread/Resources/icon-setting-wps.jpg and b/AIProofread/Resources/icon-setting-wps.jpg differ diff --git a/AIProofread/Resources/icon-setting.png b/AIProofread/Resources/icon-setting.png index 11c9bbe..3f6485d 100644 Binary files a/AIProofread/Resources/icon-setting.png and b/AIProofread/Resources/icon-setting.png differ diff --git a/AIProofread/Resources/icon-update-wps.jpg b/AIProofread/Resources/icon-update-wps.jpg index ef784dc..a5aeb14 100644 Binary files a/AIProofread/Resources/icon-update-wps.jpg and b/AIProofread/Resources/icon-update-wps.jpg differ diff --git a/AIProofread/Resources/icon-update.png b/AIProofread/Resources/icon-update.png index bac0c00..4452f4b 100644 Binary files a/AIProofread/Resources/icon-update.png and b/AIProofread/Resources/icon-update.png differ diff --git a/AIProofread/Resources/icon-user-wps.jpg b/AIProofread/Resources/icon-user-wps.jpg index 603faca..49c70f2 100644 Binary files a/AIProofread/Resources/icon-user-wps.jpg and b/AIProofread/Resources/icon-user-wps.jpg differ diff --git a/AIProofread/Resources/icon-user.png b/AIProofread/Resources/icon-user.png index 74fed4b..97aaa19 100644 Binary files a/AIProofread/Resources/icon-user.png and b/AIProofread/Resources/icon-user.png differ diff --git a/AIProofread/Resources/logo.png b/AIProofread/Resources/logo.png new file mode 100644 index 0000000..03d1248 Binary files /dev/null and b/AIProofread/Resources/logo.png differ diff --git a/AIProofread/Resources/logo_no_text.png b/AIProofread/Resources/logo_no_text.png new file mode 100644 index 0000000..c3bf0a2 Binary files /dev/null and b/AIProofread/Resources/logo_no_text.png differ diff --git a/AIProofread/Resources/logo_no_text_wps.jpg b/AIProofread/Resources/logo_no_text_wps.jpg new file mode 100644 index 0000000..654b0ca Binary files /dev/null and b/AIProofread/Resources/logo_no_text_wps.jpg differ diff --git a/AIProofread/Resources/logo_wps.jpg b/AIProofread/Resources/logo_wps.jpg new file mode 100644 index 0000000..f2ad370 Binary files /dev/null and b/AIProofread/Resources/logo_wps.jpg differ diff --git a/AIProofread/Ribbon1.Designer.cs b/AIProofread/Ribbon1.Designer.cs index c65f032..7603381 100644 --- a/AIProofread/Ribbon1.Designer.cs +++ b/AIProofread/Ribbon1.Designer.cs @@ -41,20 +41,22 @@ namespace AIProofread Microsoft.Office.Tools.Ribbon.RibbonDropDownItem ribbonDropDownItemImpl3 = this.Factory.CreateRibbonDropDownItem(); this.tabAIProofread = this.Factory.CreateRibbonTab(); this.group1 = this.Factory.CreateRibbonGroup(); + this.BtnLogo = this.Factory.CreateRibbonButton(); this.BtnProofreadAll = this.Factory.CreateRibbonButton(); this.BtnExportProofreadResult = this.Factory.CreateRibbonButton(); this.btnClear = this.Factory.CreateRibbonButton(); this.btnOpenLexicon = this.Factory.CreateRibbonButton(); this.btnSetting = this.Factory.CreateRibbonButton(); + this.Group = this.Factory.CreateRibbonGroup(); + this.ButtonSaveCache = this.Factory.CreateRibbonButton(); + this.ButtonLoadCache = this.Factory.CreateRibbonButton(); + this.grpOther = this.Factory.CreateRibbonGroup(); this.BtnGetContact = this.Factory.CreateRibbonButton(); this.BtnUpdate = this.Factory.CreateRibbonButton(); this.btnLogin = this.Factory.CreateRibbonButton(); this.btnLogout = this.Factory.CreateRibbonButton(); - this.LblNickname = this.Factory.CreateRibbonLabel(); this.LblDate = this.Factory.CreateRibbonLabel(); - this.Group = this.Factory.CreateRibbonGroup(); - this.ButtonSaveCache = this.Factory.CreateRibbonButton(); - this.ButtonLoadCache = this.Factory.CreateRibbonButton(); + this.LblNickname = this.Factory.CreateRibbonLabel(); this.group2 = this.Factory.CreateRibbonGroup(); this.BtnShowPanel = this.Factory.CreateRibbonButton(); this.grpDebug = this.Factory.CreateRibbonGroup(); @@ -70,6 +72,7 @@ namespace AIProofread this.tabAIProofread.SuspendLayout(); this.group1.SuspendLayout(); this.Group.SuspendLayout(); + this.grpOther.SuspendLayout(); this.group2.SuspendLayout(); this.grpDebug.SuspendLayout(); this.SuspendLayout(); @@ -78,6 +81,7 @@ namespace AIProofread // this.tabAIProofread.Groups.Add(this.group1); this.tabAIProofread.Groups.Add(this.Group); + this.tabAIProofread.Groups.Add(this.grpOther); this.tabAIProofread.Groups.Add(this.group2); this.tabAIProofread.Groups.Add(this.grpDebug); this.tabAIProofread.Label = "AI校对王"; @@ -86,19 +90,22 @@ namespace AIProofread // // group1 // + this.group1.Items.Add(this.BtnLogo); this.group1.Items.Add(this.BtnProofreadAll); this.group1.Items.Add(this.BtnExportProofreadResult); this.group1.Items.Add(this.btnClear); this.group1.Items.Add(this.btnOpenLexicon); this.group1.Items.Add(this.btnSetting); - this.group1.Items.Add(this.BtnGetContact); - this.group1.Items.Add(this.BtnUpdate); - this.group1.Items.Add(this.btnLogin); - this.group1.Items.Add(this.btnLogout); - this.group1.Items.Add(this.LblNickname); - this.group1.Items.Add(this.LblDate); this.group1.Name = "group1"; // + // BtnLogo + // + this.BtnLogo.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; + this.BtnLogo.Image = global::AIProofread.Properties.Resources.logo_no_text; + this.BtnLogo.Label = "AI校对王 \r\n"; + this.BtnLogo.Name = "BtnLogo"; + this.BtnLogo.ShowImage = true; + // // BtnProofreadAll // this.BtnProofreadAll.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; @@ -139,11 +146,45 @@ namespace AIProofread // this.btnSetting.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; this.btnSetting.Image = global::AIProofread.Properties.Resources.icon_setting; - this.btnSetting.Label = "插件设置\r\n"; + this.btnSetting.Label = "设置\r\n"; this.btnSetting.Name = "btnSetting"; this.btnSetting.ShowImage = true; this.btnSetting.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btnSetting_Click); // + // Group + // + this.Group.Items.Add(this.ButtonSaveCache); + this.Group.Items.Add(this.ButtonLoadCache); + this.Group.Name = "Group"; + // + // ButtonSaveCache + // + this.ButtonSaveCache.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; + this.ButtonSaveCache.Image = global::AIProofread.Properties.Resources.icon_save; + this.ButtonSaveCache.Label = "保存进度\r\n"; + this.ButtonSaveCache.Name = "ButtonSaveCache"; + this.ButtonSaveCache.ShowImage = true; + this.ButtonSaveCache.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.ButtonSaveCache_Click); + // + // ButtonLoadCache + // + this.ButtonLoadCache.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; + this.ButtonLoadCache.Image = global::AIProofread.Properties.Resources.icon_history; + this.ButtonLoadCache.Label = "加载进度\r\n"; + this.ButtonLoadCache.Name = "ButtonLoadCache"; + this.ButtonLoadCache.ShowImage = true; + this.ButtonLoadCache.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.ButtonLoadCache_Click); + // + // grpOther + // + this.grpOther.Items.Add(this.BtnGetContact); + this.grpOther.Items.Add(this.BtnUpdate); + this.grpOther.Items.Add(this.btnLogin); + this.grpOther.Items.Add(this.btnLogout); + this.grpOther.Items.Add(this.LblDate); + this.grpOther.Items.Add(this.LblNickname); + this.grpOther.Name = "grpOther"; + // // BtnGetContact // this.BtnGetContact.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; @@ -181,41 +222,17 @@ namespace AIProofread this.btnLogout.Visible = false; this.btnLogout.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.btnLogout_Click); // - // LblNickname - // - this.LblNickname.Label = "xxx 已登录"; - this.LblNickname.Name = "LblNickname"; - this.LblNickname.Visible = false; - // // LblDate // this.LblDate.Label = "过期时间:"; this.LblDate.Name = "LblDate"; this.LblDate.Visible = false; // - // Group + // LblNickname // - this.Group.Items.Add(this.ButtonSaveCache); - this.Group.Items.Add(this.ButtonLoadCache); - this.Group.Name = "Group"; - // - // ButtonSaveCache - // - this.ButtonSaveCache.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; - this.ButtonSaveCache.Image = global::AIProofread.Properties.Resources.icon_save; - this.ButtonSaveCache.Label = "手动保存数据\r\n"; - this.ButtonSaveCache.Name = "ButtonSaveCache"; - this.ButtonSaveCache.ShowImage = true; - this.ButtonSaveCache.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.ButtonSaveCache_Click); - // - // ButtonLoadCache - // - this.ButtonLoadCache.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; - this.ButtonLoadCache.Image = global::AIProofread.Properties.Resources.icon_history; - this.ButtonLoadCache.Label = "追踪历史数据\r\n"; - this.ButtonLoadCache.Name = "ButtonLoadCache"; - this.ButtonLoadCache.ShowImage = true; - this.ButtonLoadCache.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.ButtonLoadCache_Click); + this.LblNickname.Label = "xxx 已登录"; + this.LblNickname.Name = "LblNickname"; + this.LblNickname.Visible = false; // // group2 // @@ -278,7 +295,7 @@ namespace AIProofread // // BtnTest // - this.BtnTest.Label = "打开dialog"; + this.BtnTest.Label = "获取当前位置"; this.BtnTest.Name = "BtnTest"; this.BtnTest.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler(this.BtnTest_Click); // @@ -317,6 +334,8 @@ namespace AIProofread this.group1.PerformLayout(); this.Group.ResumeLayout(false); this.Group.PerformLayout(); + this.grpOther.ResumeLayout(false); + this.grpOther.PerformLayout(); this.group2.ResumeLayout(false); this.group2.PerformLayout(); this.grpDebug.ResumeLayout(false); @@ -355,6 +374,8 @@ namespace AIProofread internal Microsoft.Office.Tools.Ribbon.RibbonButton BtnExportProofreadResult; internal Microsoft.Office.Tools.Ribbon.RibbonButton BtnShowVersion; internal Microsoft.Office.Tools.Ribbon.RibbonDropDown dropDown1; + internal Microsoft.Office.Tools.Ribbon.RibbonGroup grpOther; + internal Microsoft.Office.Tools.Ribbon.RibbonButton BtnLogo; } partial class ThisRibbonCollection diff --git a/AIProofread/Ribbon1.cs b/AIProofread/Ribbon1.cs index bb20e7a..7a23f77 100644 --- a/AIProofread/Ribbon1.cs +++ b/AIProofread/Ribbon1.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Text; using AIProofread.core; using System.Windows.Forms; +using AIProofread.Properties; namespace AIProofread { @@ -75,6 +76,7 @@ namespace AIProofread public void InitWPS() { IS_WPS = true; + BtnProofreadAll.Image = AIProofread.Properties.Resources.icon_proofread_wps; btnClear.Image = AIProofread.Properties.Resources.icon_clear_wps; btnOpenLexicon.Image = AIProofread.Properties.Resources.icon_book_wps; @@ -90,6 +92,7 @@ namespace AIProofread BtnShowPanel.Image = AIProofread.Properties.Resources.icon_panel_wps; // 导出校对结果 BtnExportProofreadResult.Image = AIProofread.Properties.Resources.icon_export_wps; + BtnLogo.Image = Resources.logo_no_text_wps; } public void ProcessLoginInfo(Userinfo userinfo) @@ -186,12 +189,13 @@ namespace AIProofread private void btnClear_Click(object sender, RibbonControlEventArgs e) { //DocumentUtil.ClearProofreadMarks(); - var result = MessageBox.Show("请确认是否清除此文档的所有校对标注?", "提示", MessageBoxButtons.OKCancel); - if (result == DialogResult.OK) - { - //Bridge.bridge.clearAllProofreadMark(null); - Globals.ThisAddIn.ClearAllProofreadMark(); - } + + Globals.ThisAddIn.ActiveDocument.ShowDialog("请确认是否清除此文档的所有校对标注?", "确定", "clear-tips"); + //if (result == DialogResult.OK) + //{ + // //Bridge.bridge.clearAllProofreadMark(null); + // Globals.ThisAddIn.ClearAllProofreadMark(); + //} } private void btnShowPane_Click(object sender, RibbonControlEventArgs e) @@ -473,8 +477,39 @@ namespace AIProofread // 获取当前系统时间戳 //int time = (int)(DateTime.Now.Ticks / 10000000); //BtnTest.Label = "测试按钮" + time; - var result = MessageBox.Show("Test", "xxx"); + //var result = MessageBox.Show("Test", "xxx"); + //Globals.ThisAddIn.Application. + var app = Globals.ThisAddIn.Application; + var selection = app.Selection; + var range = selection.Range; + // 获取所在页 + var pageNumber = GetIndexPageNumber(range); + // 获取所在行 + var rowNumber = range.get_Information(WdInformation.wdFirstCharacterLineNumber); + int paragraphNumber = 0; + if (range.Paragraphs.Count > 0) + { + // 获取当前文本在文档的段落数 + var currentParagraph = range.Paragraphs.First; + var currentParagraphStart = currentParagraph.Range.Start; + var allParagraphs = app.ActiveDocument.Paragraphs; + for (var i = 1; i <= allParagraphs.Count; i++) + { + var paragraph = allParagraphs[i]; + var paragraphStart = paragraph.Range.Start; + if (paragraphStart > currentParagraphStart) + { + break; + } + if (currentParagraphStart == paragraphStart || paragraph == currentParagraph) + { + paragraphNumber = i; + break; + } + } + } + MessageBox.Show($"当前页:{pageNumber}, 行:{rowNumber}, 段落:{paragraphNumber}"); } private void ButtonSaveCache_Click(object sender, RibbonControlEventArgs e) diff --git a/AIProofread/ThisAddIn.cs b/AIProofread/ThisAddIn.cs index ba07a0c..b211829 100644 --- a/AIProofread/ThisAddIn.cs +++ b/AIProofread/ThisAddIn.cs @@ -505,12 +505,21 @@ namespace AIProofread public void ClearAllProofreadMark() { ActiveDocument?.ClearAllProofreadMark(); - Globals.ThisAddIn.SendMessageToWeb("clear-tips", null); + //Globals.ThisAddIn.SendMessageToWeb("clear-tips", null); + } + + public void ShowDialog(string message, string confirmText, string confirmAction) + { + ActiveDocument?.ShowDialog(message, confirmText, confirmAction); + } + public void ShowMessage(string message, int closeDelay) + { + ActiveDocument?.ShowMessage(message, closeDelay); } - //public string LoadCacheByPath() - //{ + //public string LoadCacheByPath() + //{ //} @@ -526,7 +535,7 @@ namespace AIProofread /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InternalStartup() + private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); diff --git a/AIProofread/Util/User32Util.cs b/AIProofread/Util/User32Util.cs index 44309d3..20d8e9c 100644 --- a/AIProofread/Util/User32Util.cs +++ b/AIProofread/Util/User32Util.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace AIProofread.Util { @@ -28,5 +29,35 @@ namespace AIProofread.Util [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetForegroundWindow(IntPtr hWnd); + + #region 获取系统屏幕缩放比例 + public const int HORZRES = 8; + public const int VERTRES = 10; + public const int LOGPIXELSX = 88; + public const int LOGPIXELSY = 90; + public const int DESKTOPVERTRES = 117; + public const int DESKTOPHORZRES = 118; + + [DllImport("user32.dll")] + public static extern IntPtr GetDC(IntPtr ptr); + [DllImport("gdi32.dll")] + public static extern int GetDeviceCaps( + IntPtr hdc, // handle to DC + int nIndex // index of capability + ); + [DllImport("user32.dll", EntryPoint = "ReleaseDC")] + public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc); + [DllImport("user32.dll")] + public static extern IntPtr GetDesktopWindow(); + + public static float GetSreenScale() + { + var hdc = GetDC(GetDesktopWindow()); + int nWidth = GetDeviceCaps(hdc, DESKTOPHORZRES); + ReleaseDC(IntPtr.Zero, hdc); + float f_Scale = (float)nWidth / (float)Screen.PrimaryScreen.Bounds.Width; + return 1 / f_Scale; + } + #endregion } } diff --git a/AIProofread/core/DocumentUtil.cs b/AIProofread/core/DocumentUtil.cs index 636c4e0..7d7bf24 100644 --- a/AIProofread/core/DocumentUtil.cs +++ b/AIProofread/core/DocumentUtil.cs @@ -481,7 +481,12 @@ namespace AIProofread public static void ExportProofreadResult() { + string currentName = Globals.ThisAddIn.Application.ActiveDocument.Name; + // 去掉文件名后缀 + currentName = currentName.Substring(0, currentName.LastIndexOf(".")); SaveFileDialog sfd = new SaveFileDialog(); + // 设置默认文件名 + sfd.FileName = currentName + "_勘误表.xlsx"; sfd.Filter = "Excel文件|*.xlsx"; var result = sfd.ShowDialog(); // 如果用户取消选择,则返回 @@ -491,29 +496,44 @@ namespace AIProofread } try { + if (File.Exists(sfd.FileName)) + { + // 判断原始文件是否可以删除 + if (File.GetAttributes(sfd.FileName).HasFlag(FileAttributes.ReadOnly)) + { + Globals.ThisAddIn.ShowDialog("已经存在名勘误表文件,请更换名称或者手动删除", null, null); + return; + } + // 删除文件 重新写入新数据避免出现未知不可控bug + File.Delete(sfd.FileName); + } ProcessExport(sfd.FileName); } catch (Exception) { - Globals.ThisAddIn.ActiveDocument.ShowDialog("导出勘误表失败", null, null); + Globals.ThisAddIn.ShowDialog("导出勘误表失败", null, null); } - + } private static void ProcessExport(string fileName) { - using (var fs = File.OpenWrite(fileName)) + using (var fs = File.Create(fileName)) { var book = new XSSFWorkbook(); var sheet = book.CreateSheet("Sheet1"); + var simHeiFont = CreateBaseFont(book, "黑体", 11); + simHeiFont.Color = NPOI.HSSF.Util.HSSFColor.Black.Index; // 设置表格样式 var style = CreateBaseCellStyle(book); - style.SetFont(CreateBaseFont(book)); + /* 系统与正文用不同字体区分(包括顶部栏、处理列、新增、删除等提示)勘误表系统字体为黑体,所有字号统一 */ + style.SetFont(simHeiFont); style.BorderBottom = NPOI.SS.UserModel.BorderStyle.None; style.BorderTop = NPOI.SS.UserModel.BorderStyle.None; style.BorderLeft = NPOI.SS.UserModel.BorderStyle.None; style.BorderRight = NPOI.SS.UserModel.BorderStyle.None; style.WrapText = true; + sheet.SetDefaultColumnStyle(0, style); sheet.SetDefaultColumnStyle(1, style); sheet.SetDefaultColumnStyle(2, style); @@ -547,14 +567,10 @@ namespace AIProofread var blackFont = CreateBaseFont(book); blackFont.Color = NPOI.HSSF.Util.HSSFColor.Black.Index; + var redFont = CreateBaseFont(book); redFont.Color = NPOI.HSSF.Util.HSSFColor.Red.Index; - // 字体加粗增大 - var strongFont = CreateBaseFont(book); - // 字体加粗 - strongFont.IsBold = true; - // 字体更大 - strongFont.FontHeightInPoints = 13; + // 获取排序后的数据 var list = ExportDataItem.GetExportData(Globals.ThisAddIn.ActiveDocument.marks); // 对 list 进行排序 @@ -569,6 +585,7 @@ namespace AIProofread row.CreateCell(1).SetCellValue(item.PageNumber); row.CreateCell(2).SetCellValue(item.LineNumber); + #region 引用原文内容 string originSentence = item.OriginSentence; if (it.Tag == "i") { @@ -593,8 +610,12 @@ namespace AIProofread // 设置单元格内容自动换行 oriCell.CellStyle.WrapText = true; oriCell.SetCellValue(originText); + #endregion + // 原始内容 row.CreateCell(4).SetCellValue(it.Origin); + + #region 建议 var suggest = it.Text; if (it.Tag == "r") { @@ -602,14 +623,6 @@ namespace AIProofread if (it.Type == "blacklist") { tag = "黑名单"; - XSSFRichTextString replaceText = new XSSFRichTextString(suggest + $" {tag}"); - replaceText.ApplyFont(blackFont); - if (tag != "") - { - // 对查找内容引用红色 - replaceText.ApplyFont(suggest.Length + 1, suggest.Length + 1 + tag.Length, strongFont); - } - row.CreateCell(5).SetCellValue(replaceText); } else { @@ -617,29 +630,47 @@ namespace AIProofread // 易错词不标识 if (it.Type == "confusion" || it.Type == "model" || it.Type == "other") { - row.CreateCell(5).SetCellValue(suggest); + //row.CreateCell(5).SetCellValue(suggest); } else if (it.Type == "first_choice") { - row.CreateCell(5).SetCellValue(suggest + " 【提示】首选"); + + tag = "【提示】首选"; + //row.CreateCell(5).SetCellValue(suggest + " 【提示】首选"); } else if (it.Type == "now_called") { - row.CreateCell(5).SetCellValue(suggest + " 【提示】现称"); + tag = "【提示】现称"; + //row.CreateCell(5).SetCellValue(suggest + " 【提示】现称"); } else if (it.Type == "quoting_legal") { - row.CreateCell(5).SetCellValue(suggest + " 【提示】法规"); + tag = "【提示】法规"; + //row.CreateCell(5).SetCellValue(suggest + " 【提示】法规"); } else if (it.Type == "incorrect_expression") { - row.CreateCell(5).SetCellValue(suggest + " 【提示】表述有误"); + tag = "【提示】表述有误"; + //row.CreateCell(5).SetCellValue(suggest + " 【提示】表述有误"); } - else + else if(!string.IsNullOrEmpty(it.Addition)) { - row.CreateCell(5).SetCellValue(suggest + (string.IsNullOrEmpty(it.Addition) ? "" : $" 【提示】{it.Addition}")); + //row.CreateCell(5).SetCellValue(suggest + (string.IsNullOrEmpty(it.Addition) ? "" : $" 【提示】{it.Addition}")); + tag = $"【提示】{it.Addition}"; } } + if (string.IsNullOrEmpty(tag)) + { + row.CreateCell(5).SetCellValue(suggest); + } + else + { + XSSFRichTextString replaceText = new XSSFRichTextString(suggest + $" {tag}"); + replaceText.ApplyFont(blackFont); + // 对查找内容引用红色 + replaceText.ApplyFont(suggest.Length + 1, suggest.Length + 1 + tag.Length, simHeiFont); + row.CreateCell(5).SetCellValue(replaceText); + } } else @@ -672,7 +703,7 @@ namespace AIProofread if (tag.Length > 0) { // 对查找内容引用红色 - suggestText.ApplyFont(startIndex, it.Tag == "i" ? startIndex + 2 : tag.Length, strongFont); + suggestText.ApplyFont(startIndex, it.Tag == "i" ? startIndex + 2 : tag.Length, simHeiFont); row.CreateCell(5).SetCellValue(suggestText); } else @@ -680,7 +711,11 @@ namespace AIProofread row.CreateCell(5).SetCellValue(suggest); } } - row.CreateCell(6).SetCellValue(StatusText(it.IsAccept)); + #endregion + // 处理状态 + var statusValue = new XSSFRichTextString(StatusText(it.IsAccept)); + statusValue.ApplyFont(simHeiFont); + row.CreateCell(6).SetCellValue(statusValue); } catch (Exception ex) { @@ -691,7 +726,7 @@ namespace AIProofread // 保存到文件 book.Write(fs); - Globals.ThisAddIn.ActiveDocument.ShowDialog("导出成功", null, null); + Globals.ThisAddIn.ShowMessage("导出成功", 3000); } } @@ -705,15 +740,19 @@ namespace AIProofread return style; } - private static IFont CreateBaseFont(IWorkbook workbook) + private static IFont CreateBaseFont(IWorkbook workbook, string name, int size) { // 宋体 11 var font = workbook.CreateFont(); - font.FontName = "宋体"; - font.FontHeightInPoints = 11; + font.FontName = name; + font.FontHeightInPoints = size; return font; } + private static IFont CreateBaseFont(IWorkbook workbook) + { + return CreateBaseFont(workbook, "宋体", 11); + } private static string StatusText(int status) { diff --git a/AIProofread/obj/Debug/AIProofread.Properties.Resources.resources b/AIProofread/obj/Debug/AIProofread.Properties.Resources.resources index 1447a9c..70ba9fd 100644 Binary files a/AIProofread/obj/Debug/AIProofread.Properties.Resources.resources and b/AIProofread/obj/Debug/AIProofread.Properties.Resources.resources differ diff --git a/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache b/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache index 04fa245..e68eb9c 100644 Binary files a/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache and b/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache differ diff --git a/AIProofread/obj/Debug/AIProofread.csproj.CoreCompileInputs.cache b/AIProofread/obj/Debug/AIProofread.csproj.CoreCompileInputs.cache index a4c1605..2b744e1 100644 --- a/AIProofread/obj/Debug/AIProofread.csproj.CoreCompileInputs.cache +++ b/AIProofread/obj/Debug/AIProofread.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -8f0bfa7787b64c7e81e5cec3f2098ad425c0efe864d9c3506d226b26674a4392 +54a319e61bbb40f00beb0f42abcb8716c81b74e48883b7a20bcbaff71f4ef2ff diff --git a/AIProofread/obj/Debug/AIProofread.csproj.FileListAbsolute.txt b/AIProofread/obj/Debug/AIProofread.csproj.FileListAbsolute.txt index db462b7..9bccb84 100644 --- a/AIProofread/obj/Debug/AIProofread.csproj.FileListAbsolute.txt +++ b/AIProofread/obj/Debug/AIProofread.csproj.FileListAbsolute.txt @@ -211,3 +211,4 @@ C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread. C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofr.8811D769.Up2Date C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.dll C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.pdb +C:\Users\yaclt\source\repos\repos\AIProofread\AIProofread\obj\Debug\AIProofread.Controls.MessageTips.resources diff --git a/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache b/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache index 910b48a..6194c63 100644 Binary files a/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache and b/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache differ diff --git a/AIProofread/obj/Debug/AIProofread.dll b/AIProofread/obj/Debug/AIProofread.dll index 13800dd..f4335cf 100644 Binary files a/AIProofread/obj/Debug/AIProofread.dll and b/AIProofread/obj/Debug/AIProofread.dll differ diff --git a/AIProofread/obj/Debug/AIProofread.pdb b/AIProofread/obj/Debug/AIProofread.pdb index 4a759e5..b0b9d8b 100644 Binary files a/AIProofread/obj/Debug/AIProofread.pdb and b/AIProofread/obj/Debug/AIProofread.pdb differ diff --git a/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 132988b..8a1d0a1 100644 Binary files a/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/AIProofread/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll b/AIProofread/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll index 12d83bb..277e1f8 100644 Binary files a/AIProofread/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll and b/AIProofread/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll differ