Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Spell check now only happens if Word is not already opened.
Browse files Browse the repository at this point in the history
Word must now be closed before starting spell check.
  • Loading branch information
JeffJacobson committed Sep 25, 2017
1 parent 4281955 commit fbf1369
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 17 deletions.
Binary file modified SpellCheckAddIn/Config.Designer.cs
Binary file not shown.
4 changes: 2 additions & 2 deletions SpellCheckAddIn/Config.esriaddinx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<Name>Spell-Check</Name>
<AddInID>{7d90a5f5-bfe3-483a-be83-21fa5be6f97d}</AddInID>
<Description>Provides spell-check capability in ArcMap.</Description>
<Version>1.0</Version>
<Version>1.0.1</Version>
<Image>Images\SpellCheckAddIn.png</Image>
<Author>Jeff Jacobson</Author>
<Company>WSDOT</Company>
<Date>9/5/2017</Date>
<Date>9/25/2017</Date>
<Targets>
<Target name="Desktop" version="10.5" />
</Targets>
Expand Down
9 changes: 6 additions & 3 deletions SpellCheckAddIn/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Resources;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -32,5 +33,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: NeutralResourcesLanguage("en-US")]

1 change: 1 addition & 0 deletions SpellCheckAddIn/SpellCheckAddIn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
Expand Down
29 changes: 17 additions & 12 deletions SpellCheckAddIn/SpellCheckButton.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.ArcMapUI;
using ESRI.ArcGIS.ArcMapUI;
using ArcMapSpellCheck;
using System.Diagnostics;
using System.Windows.Forms;

namespace SpellCheckAddIn
{
Expand All @@ -15,14 +13,21 @@ public SpellCheckButton()

protected override void OnClick()
{
//
// TODO: Sample code showing how to access button host
//
////ArcMap.Application.CurrentTool = null;
IMxDocument doc = ArcMap.Application.Document as IMxDocument;
using (var spellchecker = new Spellchecker())
// Check to see if Word is already opened.
var processes = Process.GetProcessesByName("WINWORD");

if (processes.Length > 0)
{
string message = "The spell check operation needs to use Microsoft Word, which is already opened. Please close Word and try again.";
MessageBox.Show(message, "Word is already open", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, 0);
}
else
{
spellchecker.CheckDocument(doc);
IMxDocument doc = ArcMap.Application.Document as IMxDocument;
using (var spellchecker = new Spellchecker())
{
spellchecker.CheckDocument(doc);
}
}
}
protected override void OnUpdate()
Expand Down

0 comments on commit fbf1369

Please sign in to comment.