Spell check question - Ignoring merge fields

  • I am using WPTools 6.08 with Delphi 6 and Addict 3.5. I have everything installed (I believe) properly - spell check and thesaurus both work fine. However I am having an issue getting the spellcheck to ignore WPTools objects included in the SpellIgnoredForObj property - specifically, merge fields.
    The merge fields in my system are actually fields from one of several database tables. I create the merge fields using WPTools' InputMergeField command, passing it a calculated fieldname (consisting of the database name, table name, and column name of the merge variable) and the actual column name for the DisplayText parameter.
    For example, for a column named ADDR1 in my Patient table, my InputMergeField call looks something like:
    InputMergeField('MRG|DB:Client|TBL:Patient|COL:Addr1', 'ADDR1')
    Merging works correctly.
    However, when I try to use spellcheck, the display text of my merge variable "ADDR1" is flagged as being misspelled. The SpellIgnoredForObj property of the WPTools editor includes the [wpobjMergeField] option.

    What else do i need to do to skip these merge fields?

    • Offizieller Beitrag

    Hi,

    The Ignore option should disable the curly red underline for the field - that part is controlled by WPTools.

    The specllcheck itself happens in the Addict unit.

    WPSpell will use this code to skip the fields in future - hopefully You find the correct spot to put it in in Addicts unit.

    That should be in function TWPToolsControlParser.MoveNext:Boolean;

  • Okay, I found the spot to insert this code but I have a couple of questions I hope you can assist with.

    First, the body of the TWPToolsControlParser.MoveNext is:


    I believe I should be able to insert your code following the ENDIF directive. However I just want to make sure I am using the proper values.
    1. You used a variable named "pos" in your WHILE loop. I assume this value is the same as FEdit.CPPosition. Correct?
    2. You use an object named "par" in your code. I assume this is the active paragraph, or FEdit.ActiveParagraph. Correct?
    3. The third portion of your WHILE condition is "IsHidden". I can only find two references to anything named IsHidden is all of the source for WPTools. Both are properties of records, TWPPaintExtraParams and TWPFontCacheInput, not methods. Is this something new?

  • ok, just one more question about you latest post...

    your original code snippet contains the following segment on your WHILE loop...

    Code
    IsHidden(par, pos)


    What IS this? I don't have an IsHidden method in any of the WPTools source I purchased.

  • As a further followup, I tried simply commenting out the IsHidden method (not expecting that to be a good idea) and tested the spell check.
    The good news: Addict correctly skipped all of my merge fields!
    The bad news: Addict now flags EVERYTHING as being mispelled! It seems that all words on a line within a single data block are read without the spaces and analyzed as if they were a single word. :-(

    For example, the title of one of my documents is: Writing MTS and COM+ Components in Delphi. Note there is a single space between each word. When I run the spell check before adding the new code, everything is processed properly. However, with the new code Addict reads this sentence as if it was the single word WritingMTSandCOM+ComponentsinDelphi and flags it as being misspelled.

    I assume this is because of my commenting out the unknown IsHidden method. Correct?

  • Sorry to keep bringing this one up, but could you possibly shed some light on exactly what the IsHidden method you reference is? The only IsHidden I have anywhere in your source (I have the Premium edition) is properties of two records.