Beiträge von rackerson

    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?

    Ok, I scanned the forums for possible solutions to this one and this is the best workaround solution I found someone report...

    1. When setting LayoutMode to wplayNormal, include wpfAlwaysFormatWithScreenRes in TWPRichText.FormatOptions
    2. When setting LayoutMode to wplayFullLayout, exclude wpfAlwaysFormatWithScreenRes from TWPRichText.FormatOptions
    3. When printing, exclude wpfAlwaysFormatWithScreenRes from TWPRichText.FormatOptions

    This seems to work reasonably well in most cases but it doesn't feel like a solution. Do you have a better suggestion?

    Thanks Julian,

    Just so I am clear then...
    I currently have the AutomaticTextAttr properties set as I described earlier. This properly handles one of the two "types" of merge fields I am dealing with (the ones from DB1). If I use the event handler you mention, should I expect the settings defined in AutomaticTextAttr to be handled as my default settings and only have to add code for my "other" merge fields (those from DB2)?

    Or should I have to add code to the event handler to handle all situations? Something like:

    Code
    if <merge field from DB1> then
      CharStyle.TextColor := clYellow
    else if <merge field from DB2> then
      CharStyle.TextColor := clBlue;

    WPTools 6, Delphi 6

    My app allows the user to predefine text "snippets" to be used for common text and insert them into a document during printing; for instance, for a common corporate greeting on a form letter or a closing argument, etc.

    When these snippets are merged into a document, I need for their contents to be displayed in the same font as the body of the document they are being merged into.

    Is there an easy way to control this?

    WPTools 6, Delphi 6
    This is an interesting one...
    In my app I have one form parenting a TWPRichText component that is used by the users to create document templates in RTF format. The user is able to save and load these templates to/from a SQL Server 2000 table. The document always appears correct and during printing, everything renders correctly to the printer. So far, so good.

    In another section of my application, there is another form parenting a TWPRichText component (actually, it is a form housing a frame that contains the TWPRichText). The template saved to the DB above is loaded from the table and displayed for editing and printing. When loaded from the table, some of my documents seem to lose the proper word spacing.

    Some words are missing the space between them, others appear to have an extra space between them. In one case, the period between two sentences was missing. Believing this to be a display problem, I tried printing the document (hoping that it would render correctly during printing) but alas, the printed output looked the same as what appeared on screen.

    I tried the obvious, thinking perhaps the document was corrupt, and loaded it back into the first TWPRichText component and it displayed CORRECTLY. So the problem is obviously not the document and not the fact that it comes from a database table. Could a difference in object properties between the original TWPRichText component and the second one be causing this problem?

    WPTools 6
    I create document templates with mail merge capabilities using your TWPRichText.InputMergeField method. I highlight these merge fields using the code such as:

    Code
    TWPRichText.AutomaticTextAttr.UseBackgroundColor := True;
    TWPRichText.AutomaticTextAttr.BackgroundColor := clYellow;


    I have a request to display different types of merge fields in different colors (basically, I use data from multiple databases in my mailmerge process-the request is for data from DB1 to appear one color & DB2 to appear in another).
    Is such a thing possible? Is so, how?

    WPTools 6, Delphi 6

    I have implemented Search functionality for WPTools using the standard WPASearch action. When the user attempts a search, the Search dialog displays and all search options seem to work correctly, except for one.

    If the user checks the "Whole Word" search option and chooses the direction "UP" nothing is ever found.

    Anyone else experience this problem?

    Just a couple of quick observations about my issue. First of all, it finally works - thank you for your help Julian.

    However, unless I was just doing something drastically wrong (which I will freely admit is very possible...) I found the following:

      1. The TWPRichText.LoadFromStream did NOT correctly read in my text from a stream (the beginning of it was always truncated); additionally, the name of my merge field remained displayed in the document.

      2. Within the OnMailMergeGetText event, the Contents property has a LoadTextFromStream method. This DID work correctly. It replaced the merge tag with the RTF content that I needed to merge.

      3. I think I misunderstood part of your suggestion about the use of:

    Code
    WPRichText1.TextCursor.ObjBeforeCP := 
       WPRichText1.TextCursor.ObjAtCP.EndTag


    Although I inserted this code in my OnMailMergeGetText event and verified I had a valid merge field, ObjAtCP was ALWAYS nil and resulted in an A/V error every time.


  • But as I said, what I needed to accomplish works so that is okay with me. I am just reporting the above in case I found a bug.

    Thanks for your help.

    I have a situation nearly identical to the one reported by "computech" on July 21, 2009. I have paragraphs of RTF Text stored in tables that I need to merge with my main RTF document.

    I know from that prior post I have the option of using LoadFromStream or SelectionAsString to insert my text. Since I need to keep the formatting, I plan to use LoadFromStream.

    I under I can set CPPosition to indicate where the text should be inserted. This is where my problem comes in. I don't know how to determine the correct location for insertion. The location where the RTF paragraphs need to go is set by the user when they define a document template - essentially, they create a merge field in the document and point it at a table containing RTF paragraphs.

    Thus, it is the location of this merge field where I need to insert the RTF paragraph. Originally, I tried using your Finder object to locate my RTF paragraph merge field but this did not work for me. Then I tried using the OnMailMergeGetText event. This allows me to trap my RTF paragraph tags but I cannot see how to determine their location. Or is the CPPosition value automatically set when a merge tag is found?

    Also, assuming I can determine the proper location to insert my RTF paragraph, I need for the inserted paragraph to replace the existing mailmerge tab. What is the best way to hide the tag once the merge occurs?

    Thanks for the tips on date handling.

    Would you be so kind as to direct me to where this InsertTextObjectName method might be located? The unit its in or the class to which it belongs?

    I have things basically working as I wanted using the other method I asked you about but I would prefer to do things the right way...

    I'm not quite sure how I managed to do this but somehow I have disabled the delete key in the WPTools editor. Pressing DEL triggers neither the OnKeyDown nor the OnKeyPress event.

    This was not something I intended to do and my users will need to have the delete key enabled. Can you tell me what property / combination of property settings would disable the Delete key?

    WPTools 6, Delphi 6. My editor is NOT in read only mode as I am able to type any other character without problem.

    I really hate to come across sounding dense, but I cannot find this method anywhere. Not in any of your source code and not in the docs.

    The closest name I can find is InputTextFieldName. Is this what you meant by any chance? If not, where can I find InsertTextObjectName?

    Also, InputTextFieldName seems to support an optional alias passed in a FieldMask property that gets mapped to the TextObj.Source property. By default, the field mask does not appear to be used. If I wanted to create a date on a document template that simply displayed the word DATE on screen until printed I assume I should be able to pass the word DATE to the FieldMask property. To make DATE appear, should I then be adding code to OnTextObjectGetText to read TextObj.Source and display that instead of the date value?

    I'm using WPTools to allow my users to define templates that they later use for printing in a mail merge process. When designing the templates, I need to allow the user to drop an object onto the document to represent the current date (not the date that the DATE object is created but one that can auto-update to reflect the current date when the user prints the template).

    Using code similar to the following:
    WPRichText1.ActivePar.InsertNewObject(0, wpobjTextObject, False, False, WPRichText1.WritingAttr.CharAttr).Name := WPTextFieldNames[wpoDate];

    I can create an object that immediately displays today's date (08/05/09).

    Question #1
    Since the date was created as a TextObject rather than as literal text, I assume that when I save my template and recall it next month (say on September 1st), the date object will report the value 09/01/09. Am I correct in this assumption?

    Question #2
    When I print the template, in addition to the document being sent to the printer, I have to archive it to a database table so the user can review it at a later date. For historical accuracy, I have to display the archived document EXACTLY as it was printed, thus I need the DATE object to retain the date it reported when it was initially printed. So essentially at this point I need the DATE object NOT to automatically update itself.
    What would be the best way for me to accomplish this? Is there some object type that reacts to an event, like a merge variable, that I could simply write an event handler for to control the date's display?

    I am using WPTools 6.04 with Delphi 6 and I allow my users to drop mailmerge tags created with InputMergeField into my document. Depending upon the type of data I will be merging into the tags, I set the IParam property using the Format parameter of the InputMergefield function.

    At all points during the save process, the values I set are correct. However after I save my RTF file as a blob to a SQL Server 2000 table and reload it into WPTools, all of my IParam values are reset to 0. Is there anything special I need to do to make sure these properties retain the values I have set?