Editing allowed only on certain text

  • I've created an app which merges data into various documents very nicely.
    In addition to the merge fields, I'd like the user to be able to optionally edit only certain portions of the RTF- like filling in a form- but not allowing any other edits to surrounding text.

    So, the RTF consists of merge fields already filled in with a query, (working), but, the remaining blanks would be optionally editable by tabbing, and no other areas of the document could be edited. This document could be then saved. I know its possible, just don't know where to start to modify the existing docs/logic to support this type of partially editable form.

    Thanks in advance,

    John

  • Thanks Julian.
    I have the editing portion working- mostly.

    Here is a problem though.

    I have many merge fields that are populated from a query- working fine. Then I have a set of non-data "merge" fields in the same document that the client tabs through and enters data in. I can't get the data entered to save with the document, or is WPMMDataProvider1.ReadData is overwriting the editable fields data?

    Also, how do you get the document to open with the cursor at the first editable field? When I open the document for the first time, and click and tab, it goes to the first editable field and works nicely. Subsequent openings of the same document result in the cursor staying where it was last at.

    Ideally, it would be great if the cursor goes to the last field edited so that the user could begin where they left off. For the first time a document is opened, that would naturally be the first editable field. So, if the user is editing a document with 10 fields, finished entering data in field 4, closes the editor, works on the same document, but for a different record, comes back to that same document for that record, it would be ideal if the cursor automatically jumped to field 5.

    Sorry for my lack of understanding. I am getting closer though. The documentation very clear.

    Thanks in advance.

    John

    • Offizieller Beitrag

    Hi,

    The WPMMDataProvider is not required for mail merge - you can have similar functionality with just a few lines of code in the OnMailMergeGettext event.

    I assume the WPMMDataProvider1 is overwriting the data in DataSet.OnScroll - you will need to have your own handler to destinguish between fields which should be updated and edit fields which should remain unchanged. You also have more control when the mailmerge process is executed.

    To move to the first field use FieldLocate or MoveToField.

    You can save the current position, CPPosition, to goto after loading a document.

  • Thanks Julian.

    This helps.

    Yes, I guess I'm trying to build a hybrid that merges data from the Query utilizing the WPMMDataProvider for some fields, and having other fields which are only editable in a form style, but save their data at that point in the document itself- not in a table. As you have stated, I need do avoid having the DBWPRichText1MailMergeGetText event overwrite the editable fields- thinking that if I do something in that event to avoid changing any fields that are not part of the source query "if Query.FindField(inspname) <> nil then..." to skip these fields.

    John :wink:

  • I have documents with both merge and form fields.
    IT WORKS VERY NICELY!

    The merge fields are not editable which is desired.

    I populate a listbox with a list of fields which includes the merge fields.
    DBwprichtext1.FieldGetNames(ListBox1.Items);

    The user can navigate through the document by traversing the listbox. I would however like to identify in the listbox which fields are merge, (not editable) and which fields are form, (editable) with a boolean checkbox column so that the user knows to skip these fields in the listbox.

    Is there a way to derive that property? Alternately, is there a way to populate the listbox with only the editable form fields?

    Thanks in advance.

    John

  • Julian,

    Great!

    I have leveraged just a small portion of the great features of WPTools.

    I can't think of a better tool for applications to manage documents.
    In my case, real estate agents with all of their contracts, support documents.
    As mentioned, I've mixed merge fields- supported by a query that does all of the calculations, with edit/form fields to allow the agents to enter ad hoc information.
    Thanks for a fantastic tool!

    John