fixed 导出提示问题

This commit is contained in:
LittleBoy 2024-11-14 20:13:23 +08:00
parent 5b6b615bd2
commit afddb096b7
11 changed files with 46 additions and 30 deletions

Binary file not shown.

View File

@ -8,6 +8,10 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Project</StartAction>
<StartProgram>C:\Soft\Kingsoft\WPS Office\12.1.0.17827\office6\wps.exe</StartProgram>
<StartProgram>C:\Soft\Kingsoft\WPS Office\12.1.0.18608\office6\wps.exe</StartProgram>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>C:\Soft\Kingsoft\WPS Office\12.1.0.18608\office6\wps.exe</StartProgram>
</PropertyGroup>
</Project>

View File

@ -275,7 +275,8 @@ namespace AIProofread
// 如果是
//var shouldCheckSaved = ext.EndsWith(".wps") || doc.Paragraphs.Count < 200 || doc.Tables.Count < 20;
// !shouldCheckSaved &&
if (!documentInfo.Saved() || !doc.Saved)
// 必须保存才能继续校对
if (!doc.Saved)
{
data.Add("code", 1);
data.Add("message", "请保存文档后再进行校对");
@ -618,7 +619,7 @@ namespace AIProofread
{
try
{
DocumentUtil.ExportProofreadResult();
Globals.ThisAddIn.ActiveDocument.ExportResult();
return BridgeResult.Success();
}
catch (Exception ex)

View File

@ -12,7 +12,7 @@ namespace AIProofread
public class Config
{
public static readonly string APP_NAME = "AI校对王";
public static readonly string APP_VERSION = "1.2.2";
public static readonly string APP_VERSION = "2.0.0";
public static bool IS_WPS = false;
public static readonly string CONFIG_FILE = AppDomain.CurrentDomain.BaseDirectory + "app.json";

View File

@ -31,11 +31,11 @@
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormLogger));
this.LogText = new System.Windows.Forms.RichTextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.TsmiClear = new System.Windows.Forms.ToolStripMenuItem();
this.panel1.SuspendLayout();
this.panel1 = new System.Windows.Forms.Panel();
this.contextMenuStrip1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// LogText
@ -50,45 +50,46 @@
this.LogText.Name = "LogText";
this.LogText.ReadOnly = true;
this.LogText.ShowSelectionMargin = true;
this.LogText.Size = new System.Drawing.Size(784, 491);
this.LogText.Size = new System.Drawing.Size(784, 310);
this.LogText.TabIndex = 0;
this.LogText.Text = "";
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.TsmiClear});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(125, 26);
//
// TsmiClear
//
this.TsmiClear.Name = "TsmiClear";
this.TsmiClear.Size = new System.Drawing.Size(124, 22);
this.TsmiClear.Text = "清除日志";
this.TsmiClear.Click += new System.EventHandler(this.TsmiClear_Click);
//
// panel1
//
this.panel1.Controls.Add(this.LogText);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(784, 491);
this.panel1.Size = new System.Drawing.Size(784, 310);
this.panel1.TabIndex = 1;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.TsmiClear});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48);
//
// TsmiClear
//
this.TsmiClear.Name = "TsmiClear";
this.TsmiClear.Size = new System.Drawing.Size(180, 22);
this.TsmiClear.Text = "清除日志";
this.TsmiClear.Click += new System.EventHandler(this.TsmiClear_Click);
//
// FormLogger
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 491);
this.ClientSize = new System.Drawing.Size(784, 310);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FormLogger";
this.Text = "实时日志";
this.TopMost = true;
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormLogger_FormClosed);
this.panel1.ResumeLayout(false);
this.contextMenuStrip1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}

View File

@ -60,7 +60,7 @@ namespace AIProofread.Model
/// <summary>
/// 文件名称
/// </summary>
private string fileName;
public string fileName;
private string uniqueId;
public string UniqueId { get { return uniqueId; } }
@ -222,6 +222,7 @@ namespace AIProofread.Model
public void Initialize()
{
this.fileName = CurrentDocument.FullName;
ranges.Clear();
ComputeUniqueId();
if (TaskPane == null) CreateTaskPane();
@ -758,5 +759,13 @@ namespace AIProofread.Model
Logger.Log(ex);
}
}
public void ExportResult()
{
TaskPane.Control.BeginInvoke(new Action(() =>
{
DocumentUtil.ExportProofreadResult();
}));
}
}
}

View File

@ -73,6 +73,7 @@ namespace AIProofread
try
{
AppInitialize();
Logger.Log("ThisAddIn_Startup IS_WPS --> " + IsWPS);
// 处理文档事件
Application.DocumentOpen += Application_DocumentOpen;
@ -183,10 +184,11 @@ namespace AIProofread
{
return;
}
//var activeDocument = CurrentWordApplication.ActiveDocument;
var activeDocument = CurrentWordApplication.ActiveDocument;
// 设置当前文档
ActiveDocument = documentList.SetActiveDocument(CurrentWordApplication.ActiveDocument);
ActiveDocument = documentList.SetActiveDocument(activeDocument);
Logger.Log("Application_DocumentChange -- " + ActiveDocument.fileName);
}
public void SetActiveDocument(Document doc)
@ -212,13 +214,12 @@ namespace AIProofread
private void Application_WindowActivate(Document activeDoc, Window Wn)
{
ActiveDocument = documentList.SetActiveDocument(activeDoc);
Logger.Log("Application_WindowActivate -- " + ActiveDocument.fileName);
//// 当前文档添加书签集合
//if (!allMarks.ContainsKey(activeDoc))
//{
// allMarks[activeDoc] = new Dictionary<int, ProofreadItem>();
//}
//Logger.Log("Application_WindowActivate -- " + activeDoc.FullName);
////ShowPanel(Doc);
//// 创建面板
//if (!taskPanels.ContainsKey(activeDoc))

View File

@ -561,7 +561,7 @@ namespace AIProofread
{
suggest += "(敏感词)";
}
else if (string.IsNullOrEmpty(it.Addition))
else if (!string.IsNullOrEmpty(it.Addition))
{
suggest += $"({it.Addition})";
}