473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Getting the list of Autocorrect enties in word

I need to get the list of Autocorrect entries in word. Is there a way
to do it without connecting to Word? Is the list saved somewhere?
If I need to connect to Word, how can I detect if it's installed on
the user machine?
Thanks.
Andrea
Aug 20 '07 #1
6 6739
Hello Andrea,

From your post, my understanding on this issue is: you want to get the
auto-correct entries in Word. If I'm off base, please feel free to let me
know.

If you are using Office 2003/2002, please refer to the kb article:
http://support.microsoft.com/kb/826147 or
http://support.microsoft.com/kb/269006/EN-US/. Office 2002/2003 has a
'AutoCorrect Utility' in C:\Program Files\Microsoft
Office\Office\Macros\SUPPORT.DOT, which can help you export the
auto-correct entries. In Word 2000, the utility is located in C:\Program
Files\Microsoft Office\Office\Samples\Macros9.dot (see:
http://support.microsoft.com/kb/207748/EN-US/). As to Office Word 97 or 95,
please refer to http://support.microsoft.com/kb/186237/EN-US/ or
http://support.microsoft.com/default...&Product=wrd97
Aug 21 '07 #2
Hello Andrea,

Thank you for the quick reply. I notice that you once posted a same issue
in the queue: microsoft.public.word.programming on 2007-8-7
(http://msdn.microsoft.com/newsgroups...microsoft.publ
ic.word.programming&mid=5ea81601-1a30-4aec-ab55-a0c6a8dc89fb)
microsoft.public.word.programming is not a managed queue, thus we were not
notified about that post and we did not jump in. The following link refers
to a list of all the managed queues where the replies are ensured.
http://msdn2.microsoft.com/en-us/sub.../aa974230.aspx
1. I've attached to MS Word 2007. What should I do to get the autocorrect
from Office 2003?
In the post dated on 2007-8-7, I notice that your actual need is to export
the auto-correct entries of Office Word 2003 into a text file with a C#
program. If I'm off base, please feel free to let me know.
First, we need to find a computer installed with Office 2003 Word and
Office 2003 PIA. Add the reference to Microsoft Word 11.0 Object Library in
your C# project.
Secondly, try the following C# code list to export the Word 2003
autocorrect entries into a txt file:
using System;
using System.Collections.Generic;
using System.Text;
using Word = Microsoft.Office.Interop.Word;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
object missing = Type.Missing;
Word.Application application = new Word.Application();
int total = GetAutoCorrectEntries(application);
application.Quit(ref missing, ref missing, ref missing);
}
public static int GetAutoCorrectEntries(Word.Application
application)
{
StreamWriter writer = new StreamWriter(@"D:\entries.txt");
int TotalACEntries = application.AutoCorrect.Entries.Count;
string entry;
for (int x = 1; x <= TotalACEntries; x++)
{
object index = (object)x;
entry = application.AutoCorrect.Entries.get_Item(ref
index).Name;
entry += "\t";
entry += application.AutoCorrect.Entries.get_Item(ref
index).Value;
writer.WriteLine(entry);
}
writer.Close();
return TotalACEntries;
}
}
}
The code above will help you create a txt file containing all entries:
D:\entries.txt.
The format of the pairs is : name\tvalue. For instance, abbout about
Therefore, it is quite easy to parse this entry list of Word 2003 into a
hash table or dictionary from the txt file when you are using Office 2007.
StreamReader reader = new StreamReader(@"D:\entries.txt");
string line = reader.ReadLine();
Hashtable entries = new Hashtable();
while (line != null)
{
string[] parts = line.Split('\t');
entries.Add(parts[0], parts[1]);
line = reader.ReadLine();
}
reader.Close();
2. What files should I distribute with my application. I saw VS2005 added
a reference to Microsoft.Office.Core, Microsoft.Office.Interop.Word and
VBIDE.
They are components of Office PIA.
If you are using Office XP, please refer to the section "Distributing
Solutions That Reply On the Office XP PIAs" of the following MSDN article:
http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx

if you are using Office 2003, The only supported redistribution method is
to use the Office 2003 Update: Redistributable Primary Interop Assemblies
http://www.microsoft.com/downloads/d...83a-ac14-4125-
8ba0-d36d67e0f4ad&displaylang=en. According to the Readme shipped with the
package, we have the following choice. To install the Office 2003 Primary
Interop Assemblies, follow one of the following methods:
1 Double-click the O2003PIA.msi file
2 Execute "msiexec.exe /i O2003pia.msi", or
3 Wrap the O2003pia.msi in another setup package through Visual Studio or
other Windows Installer aware setup editor.
Please note that the Office 2003 Primary Interop Assemblies setup does not
support the /a or /j options for MsiExec.
For the third option, I think you may try to take a look at the link below.
How To Create a Nested .msi Package http://support.microsoft.com/?id=306439

Also we have specified queue about setup project, if you still have any
concern ,please feel free to post there, so that experienced expert will
give you more idea.
microsoft.public.platformsdk.msi or microsoft.public.vstudio.setup

If you have any other concern or need anything else, please feel free to
let me know.

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 22 '07 #3
Thanks Jialang,

I tried your code and it works on both Word 2003 and Word 2007.
Before I tried the Office12 object model which offers the ability to
detect if the Autotext was in RichText format. Is there a way to
detect it in Office 2003?
Thanks,
Andrea
On Wed, 22 Aug 2007 04:25:44 GMT, ji****@online.microsoft.com
(Jialiang Ge [MSFT]) wrote:
>Hello Andrea,

Thank you for the quick reply. I notice that you once posted a same issue
in the queue: microsoft.public.word.programming on 2007-8-7
(http://msdn.microsoft.com/newsgroups...microsoft.publ
ic.word.programming&mid=5ea81601-1a30-4aec-ab55-a0c6a8dc89fb)
microsoft.public.word.programming is not a managed queue, thus we were not
notified about that post and we did not jump in. The following link refers
to a list of all the managed queues where the replies are ensured.
http://msdn2.microsoft.com/en-us/sub.../aa974230.aspx
>1. I've attached to MS Word 2007. What should I do to get the autocorrect
from Office 2003?
In the post dated on 2007-8-7, I notice that your actual need is to export
the auto-correct entries of Office Word 2003 into a text file with a C#
program. If I'm off base, please feel free to let me know.
First, we need to find a computer installed with Office 2003 Word and
Office 2003 PIA. Add the reference to Microsoft Word 11.0 Object Library in
your C# project.
Secondly, try the following C# code list to export the Word 2003
autocorrect entries into a txt file:
using System;
using System.Collections.Generic;
using System.Text;
using Word = Microsoft.Office.Interop.Word;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
object missing = Type.Missing;
Word.Application application = new Word.Application();
int total = GetAutoCorrectEntries(application);
application.Quit(ref missing, ref missing, ref missing);
}
public static int GetAutoCorrectEntries(Word.Application
application)
{
StreamWriter writer = new StreamWriter(@"D:\entries.txt");
int TotalACEntries = application.AutoCorrect.Entries.Count;
string entry;
for (int x = 1; x <= TotalACEntries; x++)
{
object index = (object)x;
entry = application.AutoCorrect.Entries.get_Item(ref
index).Name;
entry += "\t";
entry += application.AutoCorrect.Entries.get_Item(ref
index).Value;
writer.WriteLine(entry);
}
writer.Close();
return TotalACEntries;
}
}
}
The code above will help you create a txt file containing all entries:
D:\entries.txt.
The format of the pairs is : name\tvalue. For instance, abbout about
Therefore, it is quite easy to parse this entry list of Word 2003 into a
hash table or dictionary from the txt file when you are using Office 2007.
StreamReader reader = new StreamReader(@"D:\entries.txt");
string line = reader.ReadLine();
Hashtable entries = new Hashtable();
while (line != null)
{
string[] parts = line.Split('\t');
entries.Add(parts[0], parts[1]);
line = reader.ReadLine();
}
reader.Close();
>2. What files should I distribute with my application. I saw VS2005 added
a reference to Microsoft.Office.Core, Microsoft.Office.Interop.Word and
VBIDE.
They are components of Office PIA.
If you are using Office XP, please refer to the section "Distributing
Solutions That Reply On the Office XP PIAs" of the following MSDN article:
http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx

if you are using Office 2003, The only supported redistribution method is
to use the Office 2003 Update: Redistributable Primary Interop Assemblies
http://www.microsoft.com/downloads/d...83a-ac14-4125-
8ba0-d36d67e0f4ad&displaylang=en. According to the Readme shipped with the
package, we have the following choice. To install the Office 2003 Primary
Interop Assemblies, follow one of the following methods:
1 Double-click the O2003PIA.msi file
2 Execute "msiexec.exe /i O2003pia.msi", or
3 Wrap the O2003pia.msi in another setup package through Visual Studio or
other Windows Installer aware setup editor.
Please note that the Office 2003 Primary Interop Assemblies setup does not
support the /a or /j options for MsiExec.
For the third option, I think you may try to take a look at the link below.
How To Create a Nested .msi Package http://support.microsoft.com/?id=306439

Also we have specified queue about setup project, if you still have any
concern ,please feel free to post there, so that experienced expert will
give you more idea.
microsoft.public.platformsdk.msi or microsoft.public.vstudio.setup

If you have any other concern or need anything else, please feel free to
let me know.

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=============================================== ==
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=============================================== ==
This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 23 '07 #4
Hello Andrea,

Yes, Office 2003 can also detect rich text format by using the property
'RichText' of AutoCorrectEntry object. For instance:

if (application.AutoCorrect.Entries.get_Item(ref index).RichText)
application.AutoCorrect.Entries.get_Item(ref
index).Apply(application.Selection.Range);

Both Office 2007 and Office 2003 support this property.

Please feel free to let me know if you have any other concern.

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 23 '07 #5
Thanks.
One more thing. I noticed that if the entry is in RichTextFormat I get
an * symbol in the string (the Value property). Is there a way to get
properly formatted text?
Thanks,
Andrea

On Thu, 23 Aug 2007 10:24:21 GMT, ji****@online.microsoft.com
(Jialiang Ge [MSFT]) wrote:
>Hello Andrea,

Yes, Office 2003 can also detect rich text format by using the property
'RichText' of AutoCorrectEntry object. For instance:

if (application.AutoCorrect.Entries.get_Item(ref index).RichText)
application.AutoCorrect.Entries.get_Item(ref
index).Apply(application.Selection.Range);

Both Office 2007 and Office 2003 support this property.

Please feel free to let me know if you have any other concern.

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=============================================== ==
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=============================================== ==
This posting is provided "AS IS" with no warranties, and confers no rights.
Aug 23 '07 #6
Hi Andrea,

Would you mind letting me know the result of the suggestions? If you need
further assistance, feel free to let me know. I will be more than happy to
be of assistance.

Have a great day!

Sincerely,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 28 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
2
by: Jim Andersen | last post by:
Hi there, After compacting/repairing a db, I was getting duplicate autonumbers. According to MS KB article http://support.microsoft.com/default.aspx?kbid=257408 This should be fixed with a...
4
by: pippo | last post by:
Hello, I searched all over, and couldn't find code to change the Application's autocorrect options through VBA. Is this possible? I'm not talking about the Allow AutoCorrect of txt boxes or cbo...
4
by: Jim M | last post by:
Just got my copy of Access 2003. Is the 'Name Autocorrect' feature in Access 2003 fixed yet, or is it still 'Name Autocorrupt', as many in this newsgroup reported in the past. I would like to...
3
by: sajin | last post by:
Hi All, I developed a windows form application which shows initial form which contain many labels , datagridview and List View etc . I show the thumbnail view of the word templates in the list...
2
by: Spawn666948 | last post by:
Hey, do you guys know how to set the Name Autocorrect to unchecked by default. Name Autocorrect is more trouble than its worth. I know I can go to Tools/General, but, I'd rather have it unchecked...
1
by: ApexData | last post by:
WatchOut for "Allow AutoCorrect" in your unbound combobox lookups. I am building a personnel database, and the last name of Ballance was causing the following message to popup, prohibiting me from...
3
by: rhobson2 | last post by:
Hello, I wrote a database applicaiton using Access XP (2002) and everything has been working good for the client until they purchased a couple of new computers with Access 2003. The meetings...
0
by: =?Utf-8?B?TG92ZSBCdXp6?= | last post by:
Good day all. I am trying to set up MS Access to replace data in a cell using the AutoCorrect feature in Access. However, when I import a text file (.csv), it doesn't replace the cell as I have...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.