RTF from aspose won't spell check in MS Word

Ok, this is a weird issue I am having. RTF text that goes through an aspose document and then gets run in MS Word’s spell checker is not bringing up any misspellings even if there are. I have attached a test project I have been using to check this out. Just type something simple like helllo should trigger a grammar to capitalize the ‘H’ and spell check to remove the ‘l’. The code should be pretty easy to understand. I am not sure what to think of this problem exactly. What are your thoughts?

Thanks

Hi,

Wow, what a cool project, thank you for that! However, it works on my side in both the cases for “helllo” as well as for other misspellings. May I know what have made you think about this problem? Are your documents processed by Aspose.Words ignored by MS Word’s spell checker or something?

Thanks.

Yes, they are randomly being ignored by the spell checker. I am glad you like the code. I ripped a lot of the fun stuff out to make it where you could get what it was doing pretty easily.

Basically we have an application that users fill in information into two rich text boxes. Part of our problem lately has been they write bits and pieces in MS Word and then paste it into the rich textbox on our application. When I see this has happened, I load the data into an aspose document so I can run code to make sure the whole document is in Arial 12pt. Beyond that we want to keep the bold/underline/bullets… that makes it really hard to do this from the windows control.

We also have a spell check option as part of our application that takes advantage of the MS Word spell checker and a huge medical dictionary. We have not had any problems with the spell checker runnning until they started testing this latest version with the Aspose stuff in action. I cannot say it always happens everytime. Some times copy and pasting seems to break it, or times just typeing.

For me, the ‘helllo’ sample breaks ever single time. Running through Aspose gives me:
"Evaluation Only. Created with Aspose.Words.
Copyright 2003-2006 Aspose Pty Ltd.

helllo

"
And just says spell check complete.

I have been able to duplicate this on two different machines, one running Office 2003 and one on 2007.

Even if I copy the text back over to the other box, delete, change, … the text will not spell check. It is like it has been banned from spell checking forever. The only text that will spell check is if I start typing after the vey last line break. Word will skip over all the other text and go directly to that last line.

Hopefully this is all making at least some sense. Let me know what you think.

Thank you for clarification. However, I need to reproduce it on my side to understand what is wrong. As I stated abovce, spell checking works for me for both rich text boxes. Hmm… A couple of additional questions then:

  1. What language do you see as “Dictionary language” in the spell checker’s window (in both the cases)?
  2. What language is set as default in Microsoft Office 2003 Language Settings?

Yeah, I understand it is hard when you can’t reproduce it. Stinks that I spent the time writing the app and it still doesn’t help.

The language is set as English US in all of those places.

I am tying to find another way I can get it to simply reproduce, but have not had any luck yet. Hopefully I will come up with something this afternoon, but you could be long gone by then. I am just at a loss.

I have uploaded a little screencast I recorded just so you can see what is happening to me exactly. Most likely it won’t help in any way but at least you can physically see it.

Thanks

Don’t worry, your test project is awesome and helpful. I will try more.

Where did you upload the screencast to? Sadly I can’t see anything attached.

Thank you so much for your efforts!

Huh, it did upload. I just went and dropped it on a webserver instead.

Great video. I can record the same showing spell checking works in both the cases if you want. Anyway, I will try to reproduce the issue on the weekend and get back to you shortly. Please let me know if you figure out something (for example, what about a dump of RTF data processed by Aspose that fails to be spell checked in Word - maybe it will help? Although now that simple “helllo” works to me and does not work to you, bigger documents may not make any sense…).

Na, I believe you that it is working ok for you. I just figured it would be easier to see what I ment about it jumping over the aspose text in the spell check and stuff. I will see if I can dump off a bunch of files along the way and find other ways to reproduce it. I also noticed a hotfix 4.2.5 has been released. I will install it to see if it happens to help. Have a good weekend!

Well, I upgraded versions and it didnlt have any effect. I have attached a zip full of rtf files and screenshots that were taken along the way folloing the same proceedure that was in the video file.
The files are named 1-4

1 - Just typed ‘helllo’ in the box and hit save.
2 - Ran the spell check against it going through the aspose code
3 - Copy/pasted it into the othe none aspose box and saved it.
4 - Ran the spell check again without the aspose code.

I also included screenshots just to make sure you could uderstand what was from where. There is also a file called Just Aspose.rtf that is a clean typing of ‘helllo’ in the box and just opening and closing in aspose, without any spellcheck. All saving of the text was simply done with the RichTB.SaveFile() function.

Maybe something here will help out.

Thanks,

Jon

Jon,

I still fail to replicate the issue, therefore I decided to use the same technique to try figure out what happens on your side. I have noticed that the RTF passed through RichTextBox greatly differs from that produced by Aspose.Words (immediately after you set Box.Rtf, its value differs from the original). So I wanted to ask you try the following. Attached is the “helllo” document saved to RTF by Aspose.Words. Each document is numbered from 1 to 5. In each subsequent document I cut out some suspicious data hoping that would allow to narrow down the cause of the issue. Please read each of the documents into a string and assign it to the Box.Rtf property to load into the RichTextBox. Then run spell checking and tell me what documents succeeded and what failed.

Thanks.

Well, looks like we have some results. 1 and 2 spellcheck ok. 3-5 do not spell check at all.

Here is another question for you. Do you know of a better rich textbox that I could replace the windows one with. It seems all my problems root cause have been the old version of the rtf spec that it supports. I am also going to start looking for an html style editor since aspose can import html. I am up for anything at this point.

Let me know if the document tests helps at all.

Thanks!

The results are a bit confusing actually. 1.rtf is an unedited output of Aspose.Words so if you did everything properly it’s should’ve failed to spell check Did you assign the RTF string to RichTextBox.Rtf first?

Well we are close anyway. It seems like RichTextBox is the cause indeed. Probably it loses some RTF control words specifying the language of text runs. Also, it emits a strange control word \fbidis at the beginning. I did not find it in the specs v1.8.

Did you try our Aspose.Editor? It seems to fit your requirements and it’s obviously much more powerful than standard RichTextBox. You can download an evaluation version and test it for spell checking feature.

Just came to my mind… You can try Aspose.Spell as an alternate approach of Word’s spell checking as well

Well, that doesn’t help us now does it. I went back and reran them all to confirm the results.

The Aspose.Editor does not support bullets and list, which is the number one reason we are using RTF. I didn’t even notice that you guys had a editor at first.

The Spell could be a future upgrade, but the client has been happy with using Word.

I think I might be able to code around this issue though by restructuring part of the program.

I am having another little issue. Can I change the font of an
entire aspose document to
Arial 12pt. and keep any bold/underline/italic… that are there?

More than easily:

NodeList runs = doc.SelectNodes("//Run");
foreach (Run run in runs)
{
    run.Font.Name = "Arial";
    run.Font.Size = 12.0;
}

One more thought about the spelling issue. We made clear that the RTF box mangles the RTF data produced by Aspose.Words making it unspellable (at least it seems to be that way). Is there any possibility to pass to the spell checker the RTF generated by Aspose.Words directly, not through RichTextBox?

Well, right now the data was being corrected on the client side, and then spell check run. That data was then saved to the database and later inserted into a larger document. I am just going to move the font corrections to the server side. That way the client will not need to use Aspose at all and in turn solve the problem. ::fingers crossed::

Edit: Thanks for the code snip!