Beiträge von Green_flyer

    Zitat


    please note, MaileMerge does not "replace" fields, it inserts the data after the "insertpoint". (In WPTools 5 it inserts BETWEEN start and end tag)

    I hope you do not call MergeText for each field, such as MergeText('name'), MergeText('str') etc. That is not a perfect approach and can be the reson no field is merged since the field name ios not found.

    Use MergeText('') and check for property inspname in the event.

    As I said in a previous post, this is the code that will call the MergeText event, no data manipulation with inspname at this point.

    Code
    for i:= 0 to FEditor.HeaderFooter.Count - 1 do  begin    if not (FEditor.HeaderFooter.Items[i].Empty) then    begin     FEditor.HeaderFooter.Items[i].WorkOnText := True;     FEditor.MergeText;    end;  end;   FEditor.WorkOnText := wpBody;  FEditor.MergeText;

    As for this part of the code

    Code
    vFieldName := ParseNomChampsToAlias(dstMotsCles.FieldByName('NOMCHAMP').AsString);

    This is just to get the name of the field in the generic query that is associated with the inspname and will have the data that needs to be merged in that position.

    I know I'm not that far because when I debug I see that the right values are returned from the generic query, the part I still haven't figured out is why I can't see the values I have inserted in the document.

    Is there any options I should make sure are set ?

    Am I missing a key Refresh/ReformatAll/ or something else ?

    I could create a sample that doesn't involve a database to show you the entire code, so you can see where I make my mistake.

    The Little Green_Man

    the inspname is used to locate in a DataSet the map to the table-field pair that will contain the data to be inserted in the EditField.

    Once it is located it's set to a local var

    Code
    vFieldName := ParseNomChampsToAlias(dstMotsCles.FieldByName('NOMCHAMP').AsString); 
    
    
    ...
    
    
    Contents.StringValue := qryGeneric.FieldByName(vFieldName).AsString;


    qryGeneric, is a TQuery, that has been built dynamically from the list of merge fields found in the current document being asked to merge.

    I'm just trying to figure out what part I'm not doing right, because I can't see the values that were used to replace the MergeFields [inspname], but I see the values when debugging, that is returned by the query, but when looking at the end printed result I only see the static text that is in the document.... So that's why I think I'm just missing a small part for it to work ...


    I have tried a couple of things but I can't make it work so far...

    Any suggestions or questions are welcome.

    The little green man

    I've create an event that will handle the problem I had in th OP
    I can create a List of all the inspname EditFields for the document.

    My problem is with the MergeText, I can't seem to figure out what step I'm forgetting ....

    Code
    for i:= 0 to FEditor.HeaderFooter.Count - 1 do  begin    if not (FEditor.HeaderFooter.Items[i].Empty) then    begin     FEditor.HeaderFooter.Items[i].WorkOnText := True;     FEditor.MergeText;    end;  end;  FEditor.WorkOnText := wpBody;  FEditor.MergeText;

    I know I have seen a example on your site, but can't seem to find it, I just can't seem to make the Merge part work, this is the Merge Event


    TIA, for the help and suggestions...

    the Little green man

    using this instead of original code produced the desired result:

    Code
    ASetCharStyle(true, WPSTY_ITALIC);
        ASetCharStyle(true, WPSTY_BOLD);

    I would like to know however, if the other is possible or not ?

    Green_Flyer

    Hello again,

    I was working with tables and was trying to create an "Odd" and "Even" style for each row defined as such:

    Helas, I'm able to get the Odd rows text to be BOLD, but the Even rows are not in Italic in any way. I'm looking around trying to find if something was posted on this matter ... BTW, changing Italic to Bold in the Even style will work ....

    Green_Flyer

    Actually, I based my test code on that example, except I don't get the same results as you ....

    That's why I was wondering if there was any other options, parameters or whatever that needs to be set to obtain the same results as your demo.


    The only difference that I see, is that your text is already set, I have to get it from a database, but don't feel that should change anything ....

    And yes I can't erase the text in your EditField demo...

    Will keep on looking in your demo, I most have missed something.

    But if you think of something to check that is required to obtain the same results as you, well post it, if I find I'll tell you what I forgot

    TIA,
    Green_Flyer

    Is this the only property you have to set, to enable the protection of Form text that has form fields in it. I have tried a couple of combinations and either that I can't enter any text at all, with the property set like the title.

    If I comment out the line, then I can enter values for the FormFields, but I can erase the preformatted text and we don't want them to be able to do that

    Code
    FEditor.ProtectedProp := [ppAllExceptForEditFields];
    FEditor.EditOptionsEx := [wpTABMovesToNextEditField, wpRepaintOnFieldMove];
    FEditor.InsertPointAttr.Hidden := True;

    After more testing, the text on the form can be selected and deleted, which can't be allowed in the specs that I have, if the ProtectedProp was assigned the value or not.

    TIA,

    Green_Flyer

    I don't know why it wasn't straight forward as you say it should be, all I wanted to mention was the steps that I had to do to make it work.

    Although, I'm new here and the person that was responsible for Wptools is no longer here, so maybe they did change the runtime librairies, I don't know but there was clearly an issue of referencing obsolete files in the runtimes files that was causing the messages that I got, when trying to install the new version of WPTools.

    Zitat


    However, something doesn't seem right. You shouldn't have to do any of that hoop-jumping, at all. There should be no Version 4 dependencies, be it WPTools4D[x]_RT.dcp or anything else V4-related, either in the demo or the licensed version.

    I just think that there might have been references left towards the version 4 component in Delphi somewhere that was causing me problems.

    The important thing is that I can install the package to test ...


    Green_Flyer

    Finally, I got it to work ....

    The main problem was that WPTools5, needs the WPTools4D[x]_RT.dcp to compile and install. Except that, most files in the WPTools4D[x]_RT package are now obsolete, and will give the messages mentionned in previous posts.

    But before I needed to repackage the WPShared_D7_RT, and make sure it linked to the files in the version 5 folder.

    After Modify the WPTools4d[x]_RT.dpk so it contains only the following files and links to the new version of WPShared_D7_RT:

    => WPPrTab1
    => WPRTEDefs

    The other DCU's will get implicitly compiled. I didn't find that package in the zip install files from your site, it would be easier if it was included, with the right files in it already ...

    Green_Flyer

    I did in fact have the reference there, but alas it didn't change the end result. I reextracted the source files, opened the WPTools5_D7.dpk.

    First compile, only warnings, press ok.

    Dialogue box, for changes that are required for the package ... ok again, recompiles and then this message:

    WPTools4D7_RT, not found, so I add to the search path towards the location for that file, in the project options for WPTools[5].

    Then, well same trouble as original message.

    TIA,
    Green_Flyer

    Every time I try to install the demo for version 5 of WPTools, I receive a message that some files have to be included in the dpk, for it to install properly.

    Once, the files are added to the WPTools5_D7.dpk, I get this error message when trying to [install/compile] the package:

    Unit WPCtrRich was compiled with a different version of WPPrTab1.WPCreateTableForm....

    I have uninstalled the previous package(4) from the component/install new..


    Is there other steps that are required to install the version 5 of the WPTools component.


    TIA,
    Green_Flyer

    I can't seem to find why there is a delay between the end-user pressing a Key and for the Char to appear on the screen.

    Depending on the situation, we can get up to five chars behind what the user is typing. There is also lots of flickering while typing.

    I just started a new job and this is my first task, so if you're missing critical information to help me out, just ask ...

    TIA,

    Green_Flyer