05 April 2008

Add client-side Microsoft Office Word Spell Checker in CRM Email entity


There are many CRM spell checker add-ons on the Internet, most of those are free, but they are all server-side spell checkers.

Today let's introduce the new client-side Word Spell Checker which uses Microsoft Office Word spell check function. It does give users a familiar feeling and larger database. It also uses Word's spell check settings. So I think users will love it. It has been used for one of our clients live environment for half year, and it has great feedbacks.

As you can see, the client machine must have Microsoft Word installed for using this technique.(My clients are using Microsoft Office Word 2003, I'm not sure if it's compatible with Word 2007, please feel free to test this solution)

The file needs to be modified is: CRMWeb\Activities\email\edit.aspx

You may already recognized that it's an unsupported customization, so please make backups just in case your customization could damage the system and also could be overwrite by Hotfixs/Rollups.

Just simply add a function:


/*  Microsoft Office Word Spelling Check*/
 
function SpellCheck(field)
{
window.frames[field].document.execCommand("Copy");
 textRange = window.frames[field].document.body.createTextRange();
 textRange.execCommand("Copy");
 
 try
 {
   var oWord = new ActiveXObject("Word.Application");
   oWord.Visible = false;
   oWord.Documents.Add();
   oWord.Top = -2000;
   oWord.Selection.Paste();
   oWord.ActiveDocument.CheckSpelling();
   oWord.Selection.WholeStory();
   oWord.Selection.Copy();
   oWord.ActiveDocument.Close(0);
   window.frames[field].focus();
   window.frames[field].document.execCommand("SelectAll");
   window.frames[field].document.execCommand("Paste");
 }
 catch(err)
 {
   alert("Error loading Microsoft Word Spelling Check: " + err);
 }
 finally
 {
   oWord.Quit(0);
 }
 
 alert("Spelling Check Finished!");
 
}

You also need to modify the isv.config.xml fie to call this function:


<Entity name="email">
<ToolBar ValidForCreate="1" ValidForUpdate="1">
<Button Title="Spell Check" ToolTip="Spell Check" Icon="/_imgs/ico_18_home.gif" JavaScript="SpellCheck('descriptionIFrame');" />
</ToolBar>
</Entity>

What the function does is copy the text user typed in the Email body(descriptionIFrame), and paste it to a Word document, the document is unseenable because it has been moved out of the screen(oWord.Top = -2000) , then the function call Word.CheckSpelling() method to check the text just pasted. After correct all words, it will paste the whole text back to the Email body, and close the Word process.

17 comments:

Anonymous said...

Great site!!
Do you have the updated method for CRM 4.0. Thanks

Jim Wang said...

Thanks Kuven,
It should work in 4.0. But I havn't try it yet! :)

Cheers,
Jim

Darren.33 said...

Hi Jim,

What a great tool, i have integrated into my development environment and it works like a charm, but i have just entered it into my live area and when i click the spell check button i get the error "Error loading microsoft word spelling check: [object Error]"

Any suggestions?

Thanks
Darren

KendoWolf said...

I'll definately be giving this a try, but I'm wondering - will this work with (for example) the description field on an incident?

Jason said...

Hello,

Does your solution work when you only have MS Office / Word 2007 installed? I'm having a similar problem to darren.33. However, winword.exe actually opens (it is never displayed on the screen), but nothing happens after that.

I have to manually kill the winword.exe process because the JavaScript errors out.

Thanks for any insight and for the article.

Kamaldeep said...

Is this supported by Microsoft?? As i can see that we need to edit an .aspx page.. so just wanted to know before i can give this to the client

Alex said...

When my friend came to me and told about his problem,I decided to help him next program-how to recover word file in vista,software has many admissibilities,in addition tool is free to the best of my memory,it can try to open your report in Microsoft Word format, that you have been preparing for a week, but in vain,can work with .doc, .docx, .dot and .dotx files and with any version of Microsoft Word text editor,recover only plain text, it means, that text formatting, graphics and all other elements will be lost,can recover your data from corrupted *.doc files, located on corrupted media: floppy and CD disks, flash and zip drives, etc,export recovered content into a new document in Microsoft Word format or any other text file.

Unknown said...

Thanks Jim, this works great for CRM 4.0 and Word 2007, as long as you change the ISV.Config to include:
Title LCID="1033" Text="Spell Check"under the Titles Tag.

However, I would also like to spell check Tasks and Notes but this solution won't work due to the lack of IFrame on the fields I think, unlike the email description field.

Any suggestions?

Kind regards,

Martin

Alexis said...

Couple weeks ago I worked with my doc file and saved it.But yesterday I opened it and understood that it is absolutely empty.To my surprise I quickly found next tool-recover corrupt docx file.It solved my problem in seconds and without payment.Moreover I saw how it can help you and recover your damaged files in Microsoft Word format.

Unknown said...

Hi Jim,
i am quite new in CRm world.
would you mind giving me a step-by-step direction about setting up this functionality in CRM 4.0?

thanks in advance.

regards,

Unknown said...

Hi Jim,
i have used this awesome tool. it's really a great work. but i have doubt how to use it for entire form rather passing one by one?


your any advice wiould highly appreciated.

thanks
bidhan chakraborty

Unknown said...

hi jim,

can u tell me where does that spell checker function code go ?

in the onload event for the entity's form??


thanks

manoj said...

Hi Jim,

How can we add the same Client Side Microsoft Office word Spell Checker in CRM 2011?

If you have a solution, Please suggest me

Thanks

Alistair (MyCRM) said...

Hi All

You can have a supported solution that does a little more http://downloads.mycrmgroup.com/eSpell.aspx

Alistair

Unknown said...

I really appreciate spending some time to talk about that, I believe firmly regarding this and so really enjoy understanding more about this kind of subject.This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this. CRM Software || MLM Software in Mumbai || ERP Software || System Software in Mumbai

Unknown said...

Keep up the fantastic piece of work, I read few blog posts on this web site and I believe that your site is real interesting and has lots of great information. ERP Software in Mumbai || System Software || CRM Software in Mumbai || MLM Software

Quân Đào said...

học kế toán thực hành cấp tốc
học kế toán thực hành cấp tốc
học kế toán thực hành tại cầu giấy
học kế toán thực hành tại thanh xuân
]học kế toán thực hành tại hà đông
học kế toán thực hành tại long biên
học kế toán thực hành tại long biên
học kế toán thực hành tại hải phòng
học kế toán thực hành tại bắc ninh
học kế toán thực hành tại tphcm
học kế toán thực hành tại quận 3
học kế toán thực hành tại hải phòng
học kế toán thực hành tại bắc ninh
học kế toán thực hành tại bình dương
học kế toán thực hành tại biên hòa
học kế toán thực hành tại vinh
học kế toán thực hành tại vinh
học kế toán thực hành tại huế
học kế toán thực hành tại đà nẵng
học kế toán thực hành tại đà nẵng
học kế toán thực hành tại đà nẵng
học kế toán thực hành tại hải dương
học kế toán thực hành tại hưng yên
học chứng chỉ kế toán
học kế toán ở đâu tốt