Results 1 to 6 of 6

Thread: Advanced Text Editor

Threaded View

  1. #1

    Thread Starter
    Banned ScriptKing1's Avatar
    Join Date
    May 2007
    Location
    idk
    Posts
    4

    Question Advanced Text Editor

    Hey,

    I'm scriptking1 and recently I've started a project, and it is an advanced text editor. This text editor won first in the TSA(Technology Student Association)2007 State Level Conference. I would be going to the national level, but apparently they don't have that competition available to middle school students. Anyway, I continued working on the project, adding better features like Spell Check, and Find... I also fixed bugs like an unchecked word wrap which led you to believe that it was off. I ran into a dillemma though, all the posts for the spell check feature aren't what I initially wanted. I wanted spell check to be like Word where as soon as you made the error, it underlined it (_______) kinda like that, and gave you options as how to fix it. Can anyone please help me with this. Also, being wrapped up in the spell check dillemma, won't let me concetrate, and I can't think of any extra-features to add-in. If you download my installer of Programmer's Editor v.1.1.0.3 down below, you can see what I have so far in this developing project. Thanks in advance for anyone who can help me, or anyone who tries.
    P.S I had to learn VB.NET in a couple of days for the TSA Competition, so please explain how to do any of your sugestions, for I guess you can say I'm a Noob.
    Note: I promise to add Images and stuff later as soon as I set them up.
    I got this code from RobDog888, and I changed it around to fix the errors showing on my pc.
    The Spell Check Code I'm Currently Using.

    vb Code:
    1. Option Explicit On
    2. Option Strict On
    3. 'Copyright © 2005 by RobDog888 (VB/Office Guru™). All Rights reserved.''Distribution: You can freely use this code in your own'              applications provided that this copyright'              is left unchanged, but you may not reproduce'              or publish this code on any web site, online'              service, or distribute as source on any'              media without express permission.
    4. Imports Microsoft.Office.Interop
    5. Public Class SpellCheck
    6.     Friend moApp As Word.Application
    7.     Private mbKillMe As Boolean
    8.     Friend Property KillMe() As Boolean
    9.         Get
    10.             InitializeMe()
    11.             KillMe = mbKillMe
    12.         End Get
    13.         Set(ByVal Value As Boolean)
    14.             mbKillMe = Value
    15.         End Set
    16.     End Property
    17.     Friend Sub InitializeMe()
    18.         Try
    19.             '<INITIALIZE WORD>            
    20.             moApp = DirectCast(GetObject(, "Word.Application"), Word.Application)
    21.         Catch ex As Exception
    22.             If TypeName(moApp) = "Nothing" Then
    23.                 moApp = DirectCast(CreateObject("Word.Application"), Word.Application)
    24.                 mbKillMe = True
    25.             Else
    26.                 MessageBox.Show(ex.Message, "VB/Office Guru™ SpellChecker™.NET", _
    27.                 MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    28.             End If
    29.         End Try
    30.     End Sub
    31.     Friend Function SpellMe(ByVal msSpell As String) As String
    32.         Dim oDoc As Word.Document
    33.         Dim iWSE As Integer
    34.         Dim iWGE As Integer
    35.         Dim iResp As Integer
    36.         Dim sReplace As String
    37.         If msSpell = String.Empty Then Exit Function
    38.         Try
    39.             InitializeMe()
    40.             Select Case moApp.Version
    41.                 Case "9.0", "10.0", "11.0"
    42.                     oDoc = moApp.Documents.Add(, , 1, True)
    43.                 Case "8.0"
    44.                     oDoc = moApp.Documents.Add
    45.                 Case Else
    46.                     MessageBox.Show("Unsupported Version of Word.", "VB/Office Guru™ SpellChecker™.NET", _
    47.                     MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    48.                     Exit Function
    49.             End Select
    50.             oDoc.Words.First.InsertBefore(msSpell)
    51.             iWSE = oDoc.SpellingErrors.Count
    52.             iWGE = oDoc.GrammaticalErrors.Count
    53.             '<CHECK SPELLING AND GRAMMER DIALOG BOX>            
    54.             If iWSE > 0 Or iWGE > 0 Then
    55.                 '<HIDE MAIN WORD WINDOW>                
    56.                 moApp.Visible = False
    57.                 If (moApp.WindowState = Word.WdWindowState.wdWindowStateNormal) Or _
    58.                 (moApp.WindowState = Word.WdWindowState.wdWindowStateMaximize) Then
    59.                     moApp.WindowState = Word.WdWindowState.wdWindowStateMinimize
    60.                 Else
    61.                     moApp.WindowState = Word.WdWindowState.wdWindowStateMinimize
    62.                 End If
    63.                 '</HIDE MAIN WORD WINDOW>                
    64.                 '<PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>                
    65.                 moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.CheckGrammarWithSpelling = True
    66.                 moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.SuggestSpellingCorrections = True
    67.                 moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreUppercase = True
    68.                 moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreInternetAndFileAddresses = True
    69.                 moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.IgnoreMixedDigits = False
    70.                 moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Application.Options.ShowReadabilityStatistics = False
    71.                 '</PREP CHECK SPELLING OPTIONS DIALOG BOX (MODIFY TO YOUR PREFERENCES)>                
    72.                 '<DO ACTUAL SPELL CHECKING>                
    73.                 moApp.Visible = True
    74.                 moApp.Activate()
    75.                 iResp = moApp.Dialogs(Word.WdWordDialog.wdDialogToolsSpellingAndGrammar).Display
    76.                 '</DO ACTUAL SPELL CHECKING>                
    77.                 If iResp < 0 Then
    78.                     moApp.Visible = True
    79.                     MessageBox.Show("Corrections Being Updated!", "VB/Office Guru™ SpellChecker™", _
    80.                     MessageBoxButtons.OK, MessageBoxIcon.Information)
    81.                     oDoc.Select()
    82.                     oDoc.Range.Copy()
    83.                     sReplace = DirectCast(Clipboard.GetDataObject.GetData("System.String", True), String)
    84.                     '<FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>                    
    85.                     If (InStrRev(sReplace, Chr(13) & Chr(10))) = (Len(sReplace) - 1) Then
    86.                         sReplace = Mid$(sReplace, 1, Len(sReplace) - 2)
    87.                     End If
    88.                     '</FIX FOR POSSIBLE EXTRA LINE BREAK AT END OF TEXT>                    
    89.                     SpellMe = sReplace
    90.                 ElseIf iResp = 0 Then
    91.                     MessageBox.Show("Spelling Corrections Have Been Canceled!", "VB/Office Guru™ SpellChecker™.NET", _
    92.                     MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    93.                     SpellMe = msSpell
    94.                 End If
    95.             Else
    96.                 MessageBox.Show("No Spelling Errors Found" & Environment.NewLine & "Or No Suggestions Available!", _
    97.                 "VB/Office Guru™ SpellChecker™.NET", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    98.                 SpellMe = msSpell
    99.             End If
    100.             '</CHECK SPELLING AND GRAMMER DIALOG BOX>            
    101.             oDoc.Close(False)
    102.             oDoc = Nothing
    103.             '<HIDE WORD IF THERE ARE NO OTHER INSTANCES>            
    104.             If KillMe = True Then
    105.                 moApp.Visible = False
    106.             End If
    107.             '</HIDE WORD IF THERE ARE NO OTHER INSTANCES>        
    108.         Catch ex As Exception
    109.             MessageBox.Show(ex.Message, "Welcome To Programmer's Editor Spell Check", _
    110.             MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
    111.         End Try
    112.     End Function
    113. End Class
    If RobDog888 Reads This: The Exit Function on line 37 is giving me a warning.
    Download this .zip file to get the installer, and source code.
    Last edited by ScriptKing1; May 3rd, 2007 at 06:47 PM. Reason: I'm leaving

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width