473,387 Members | 1,517 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,387 software developers and data experts.

C# - Spell checking in RichTextBox - Image issue

Hello everyone. I've got the spell checking fully functioning for the RichTextBox, that's not the issue. The problem is that if there are images (which need to be able to be included), the spellchecking erases them.

I know it's because I'm passing only the text through the document I'm creating to do the spell checking, and when I replace the RTB contents with the updated document text, the images were never there.

I can get the images to stay if I pass the .rtf through, but then the spellchecker picks up the rtf formatting and that looks like butt.

Anyone have any suggestions for this?
Nov 1 '07 #1
1 2289
Here's the code I'm using which sends all the rtf formatting through to the Word document, and causes the rtf info to be spellchecked >_>.

Word.Application app = new Word.Application();
app.Visible = false;

object template = Missing.Value;
object newTemplate = Missing.Value;
object documentType = Missing.Value;
object visible = false;

Word._Document doc1 = app.Documents.Add(ref template, ref newTemplate, ref documentType, ref visible);
doc1.Words.First.InsertBefore(rtfReader.Rtf);

object optional = Missing.Value;

doc1.CheckSpelling(ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional, ref optional);
object first = 0;
object last = doc1.Characters.Count - 1;

rtfReader.Rtf = doc1.Range(ref first, ref last).Text;

object saveChanges = false;
object originalFormat = Missing.Value;
object routeDocument = Missing.Value;

app.Quit(ref saveChanges, ref originalFormat, ref routeDocument);
Nov 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Leo P. | last post by:
I am trying to write a spelling checker. Specifically the part that suggests words. From what I've read online, it seems like the preferred way to do this, is to find the double metaphone...
84
by: Andy Glew | last post by:
I am in search of any rigourous, scientific, academic or industrial studies comparing naming conventions in C++ or similar languages such as Ada: Specifically, are names formed with...
1
by: Lloyd Dupont | last post by:
I see that outlook express has some spell checking capacity. so I though maybe there is a spell checking feature available in windows. the only thing I found out requires word2003, which is to big...
0
by: Vincent | last post by:
Dear all, I have implemented a class to export the content of RichTextBox to image in WYSISYG mode so that line breaks on the screen are the same as exported. C# Code: public struct...
12
by: Ryan | last post by:
Is there anyway to enable spell-checking for user input in a Text Box? Either auto spell-check or create a spell-check button. Using VB 2005.
6
by: Neil | last post by:
Is there way to have control over the MS-Access spell checking (besides just launching it)? We want to tell it to check all records, but skip certain fields (or, alternatively, ONLY check certain...
5
by: Dean Slindee | last post by:
Anybody got any helpful suggestions on how to implement spell checking in a textbox. Perhaps solutions using Microsoft Word spell checker as a called routine? What has worked for you? Thanks,...
4
by: BillE | last post by:
I have found articles on line about using word interop for spell checking with visual studio applications. Most of the articles are several years old, though - VS2003, maybe 2005. I couldn't...
5
by: Andrus | last post by:
I use Winforms RichTextBox control to edit scripts. Scripts are plain ascii texts. When error occurs, script engine returns character position of error in code as integer. How to position...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.