This commit is contained in:
LittleBoy 2024-12-06 00:25:38 +08:00
parent d132bbfa3a
commit 753094447a
56 changed files with 570 additions and 101 deletions

Binary file not shown.

View File

@ -344,6 +344,12 @@
<Compile Include="Controls\FormWebView.Designer.cs">
<DependentUpon>FormWebView.cs</DependentUpon>
</Compile>
<Compile Include="Controls\MessageTips.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Controls\MessageTips.Designer.cs">
<DependentUpon>MessageTips.cs</DependentUpon>
</Compile>
<Compile Include="Controls\ProofreadMainControl.cs">
<SubType>UserControl</SubType>
</Compile>
@ -405,6 +411,9 @@
<EmbeddedResource Include="Controls\FormWebView.resx">
<DependentUpon>FormWebView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\MessageTips.resx">
<DependentUpon>MessageTips.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\ProofreadMainControl.resx">
<DependentUpon>ProofreadMainControl.cs</DependentUpon>
</EmbeddedResource>
@ -501,6 +510,18 @@
<ItemGroup>
<None Include="Resources\icon_close.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\logo.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\logo_wps.jpg" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\logo_no_text.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\logo_no_text_wps.jpg" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@ -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";

View File

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

View File

@ -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);

View File

@ -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();
/// <summary>
/// 初始化宽度
/// </summary>
private const int INIT_WIDTH = 380;
public FormMessage()
{
InitializeComponent();
@ -37,26 +51,46 @@ namespace AIProofread.Controls
), BtnClose.Location.Y);
}
/// <summary>
/// 计算缩放
/// </summary>
/// <param name="size"></param>
/// <returns></returns>
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();
}
}
}

View File

@ -0,0 +1,46 @@
namespace AIProofread.Controls
{
partial class MessageTips
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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
}
}

View File

@ -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();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -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,

View File

@ -369,5 +369,45 @@ namespace AIProofread.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap logo {
get {
object obj = ResourceManager.GetObject("logo", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap logo_no_text {
get {
object obj = ResourceManager.GetObject("logo_no_text", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap logo_no_text_wps {
get {
object obj = ResourceManager.GetObject("logo_no_text_wps", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap logo_wps {
get {
object obj = ResourceManager.GetObject("logo_wps", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -160,6 +160,9 @@
<data name="icon-setting" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-setting.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-update" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-update.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -181,6 +184,9 @@
<data name="icon-export" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-export.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-history" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-history.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="button_default" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\button_default.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -190,6 +196,9 @@
<data name="icon-refresh" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-refresh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo_wps" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo_wps.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-clear" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-clear.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -202,13 +211,16 @@
<data name="icon-logout" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-logout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-history" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-history.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="icon_close" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon_close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon-panel" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon-panel.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon_close" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon_close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="logo_no_text" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo_no_text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logo_no_text_wps" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logo_no_text_wps.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 948 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 942 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -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

View File

@ -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)

View File

@ -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.
/// </summary>
private void InternalStartup()
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);

View File

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

View File

@ -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)
{

View File

@ -1 +1 @@
8f0bfa7787b64c7e81e5cec3f2098ad425c0efe864d9c3506d226b26674a4392
54a319e61bbb40f00beb0f42abcb8716c81b74e48883b7a20bcbaff71f4ef2ff

View File

@ -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