Beiträge von jac2

    I think I see now. I try to avoid digging around in components, but I can see the power that having these compiler options give.

    So general advice. For a company logo, would you recommend:
    COMPRESSBITMAPASJPEG
    PNGIMG
    GRAPHICEX

    And I am assuming I will need to download and install additional components to use
    PNGIMG or GRAPHICEX

    I have not used either library and would prefer not to have to unless required. Am I on the right track?

    Regards,

    I have sent you the test file.

    I can't remember how I embedded the image, probably edit copy and edit paste from a word document or a graphics package.

    Zitat

    assume the problem is a bitmap. If you use PNG images this will be also compatible. You can use PNGLib to use PNG images in WPTools.


    When I went Insert Image and selected a png file, gave me an exception.

    Zitat


    Please see the notes in unit WPObj_image.


    I have, but have always been reluctant to change 3rd party or VCL code. I did add the unit to the project WPOBJ_Image, but did not add any defines.

    Is the following correct:
    If I have an rtf with embedded images and want my program to do mailmerge and save compressed images I need to:
    Add WPObj_image to my application (although this on its own doesn't work with example program userdef....).
    --- Do I also need to add {$DEFINE something in my project file?

    Sorry for being dense.

    Julian,

    I have 5.23.6 standard and have rebuilt UserDefEditor.dpr with wpobj_image.pas added to teh uses of the project (i.e. in UserDefEditor.dpr).
    I have loaded my RTF and saved as and it is still 115KB for a doc header, which seems far too high.

    When you said

    Zitat

    In the altest wptools image unit

    Is this in your latest of the release that I have?

    Basically they we can't afford for all the documents to be 120+KB.

    Regards,
    Jason Chapman.

    I was hoping that I could just copy and paste some text and a graphic in from Word and when I save it, it would be a compressed image. I see my users wanting to do this a lot.

    The resulting image + text = 112KB.
    In Word the .dot with it in is about 30KB, so I am guessing it is being stored as an uncompressed bitmap.

    Is there something I can do before saving the text in userDefEditor.pas to convert to a png?

    Regards,

    Julian,
    So I have it working now. I search for special tokens before issuing
    WPRichMain.ReplaceTokens('<','>');
    i.e.
    found:=WPRichMain.Finder.Next('<'+cRepeatRowPrefix+'*>');
    & cCommandPrefix. Not as elegant as your options.

    I still feel a little in the dark about a lot of the tool, but thanks to you, this is up and running. I hope I have time to really learn the componentset.

    Thanks again.
    JAC.

    So I have templates with:
    <repeatrow><inv> <inv><inv>

    I used to delete the repeatrow token and then execute:

    vNoRows:=FCallBackTableRows(vTableName);
    WPRichMain.SelectThisRow;
    WPRichMain.selstart:=WPRichMain.selstart+Offset;
    vrowData:=WPRichMain.SelText;
    WPRichMain.CopyToClipboard;
    dec(vNoRows);
    while vNoRows >= 1 do
    begin
    WPRichMain.InsertRow;
    WPRichMain.SelLength:=0;
    WPRichMain.TableRowNumber:=WPRichMain.TableRowNumber+1;
    WPRichMain.TableColNumber:=0;
    WPRichMain.ShowCursor;
    WPRichMain.PasteFromClipboard;
    WPRichMain.ShowCursor;
    WPRichMain.CPPosition:=WPRichMain.CPPosition-1;
    dec(vNoRows);
    end;
    WPRichMain.SelLength:=0;

    which resulted in:
    <inv> <inv><inv>
    <inv> <inv><inv>
    <inv> <inv><inv>
    etc, which worked fine.

    Now, I end up with:
    repeatrow:invinv.longdescription inv.amountinv.next
    repeatrow:invinv.longdescription inv.amountinv.next
    repeatrow:invinv.longdescription inv.amountinv.next

    where each is infact a field, but none of them get replaced, so I have 2 problems:
    * WPRichMain.selstart:=WPRichMain.selstart+Offset;
    where offset is the token, still has the whole row selected, so I get n repeatRows, which will lead to an infinite loop if the fields got evaluated
    * The fields in the table don't get evaluated.

    So should I:
    1) Pre-parse the document looking for repeatrows and explode these before swapping for tokens (could see a problem with nesting, possibly)
    2) Am I doing the n-row duplication in a really stupid way?

    Cheers Julian - and don't lose faith, I will get there and start to help others!
    JAC.

    Julian,
    Thanks for taking the time to look at my stuff and post a memo. The demo demonstrates the subtle difference really well. I still have a lot to learn with the components.

    I am now using the replace tokens and mailmerge code. So far so good and it satisfies on of my main design goals, i.e. not to put proprietary stuff in the RTF's so they can edit them in whatever they want.

    So to see if you can see an elegant solution to the following. If I want a 1-> n relationship to be displayed in a document (e.g. one client with a list of their investments), I insert a table into the document and then have something like the following.

    Code
    <repeatrow><inv>	<inv><inv>


    My code used to be:

    Code
    if StrStartsWithLeftNoCase(cRepeatRowPrefix,theToken) then      begin        delete(theToken,1,length(cRepeatRowPrefix));        WPRichMain.seltext:='';        RepeatRow(theToken);      end

    Which basically deletes the token, works out which table is to be used and repeat the row for each record, then you have n rows.

    I haven't looked at this code for ages, but if it gets called in MergeGetText() it doesn't work, you only get the one row. Looking at the code, it would be nice if it didn't use the clipboard either. I guess I could use the AsString of the selection for this.

    So is it a no-no to mess with cursors and content in the MergeGetText() and if so, do you propose I pre-parse the text before replaceTokens it, or replaceTokens it and then search for fields starting with <repeatrow*?

    Thanks again, you have really speeded up the trouble shooting on this.
    [/quote]

    Again, this must be getting tedious for you, but it seems impossible for me to inject formatted text from on WPRTF into another - I am sure I am missing something.

    Zitat


    This depends on how you insert the text. If you use mail merge the format should not change. The inserted text should have the format of the text representing the "insert point"


    I specifically want the inserted text to have the format it had in the source WPRTF. I am substituting a token or in this case a block of text with paragrahs, tables, bold, etc. etc. So I want to basically take WPRTFSource and inject its contents into WPRTFDest at the "insert point" retaining formatting.


    The first bit does seem like typical mailmerge and you have suggested using replaceTokens, which I fully intend researching and am looking at the help for now. Unfortunately my original mailmerge code is written and working and deals with nRows e.g. main letter has customer with a table on it with one row per order. I have not seen how to do that without the reporting tool.

    I am not sure how I would deal with:


    Using mailmerge.

    Thank you for your time. My support will quieten down soon I am sure.

    Zitat


    WPRichText1.CPPosition := MaxInt;
    WPRichText1.SelectionAsString := WPRichText2.AsString


    That actually worked really well, which I was surprised about as I was expecting WPRichText2.AsString to return an unformatted string.

    But, my next problem is that some of the formatting is changing. I am sorry that this may seem confusing, but here goes.
    My original letter generation:
    - opened a rtf
    - searched for <*> and "asked" my system to provide data
    - It then replaced the selection with whatever the system returned or "unknown" if it couldn't find anything.
    -Repeat until no fields left.

    So I have enhanced this as I think I have described elsewhere to:
    - load RTF
    - Search for <selection>, if found, split the rtf into other rtf's to show the user and the user selects which bits they want included. The formatting looks fine in these.
    - Once the user it happy, they say OK and the RTF's are sucked back into the original RTF (the original RTF is cleared first).
    - Now back to the routine above to replace the fields.

    But when the rtf is finally saved, any field that started at the beginning of a line has had its format removed and changes back to Times New Roman. I tried adding a couple of chars at the start of the line and it is fine, only for fields at the start of the line. These fields are in the middle of the blocks that have been sliced and re-put back together.

    Does this make sense?


    I saved the RTF right before I start swapping field values and it still looks fine, it is just when the fields are substituted.

    Sorry for the long post

    JAC.

    Sorry for being so dense. I have pushed part of a WPRTF to overwrite a complete other RTF, but now I need to take a number of WPRTF's and push them back into one WPRTF. I am sure I am doing something stupid, but I just can't work out how to in one line of code.

    I have tried lots of things and the most successful was appendSection, but this did as it said and created a new page / section. I just want somethign like:

    WPRTF.APPEND(wprtfSource.AsAnsiStr()) or whatever.

    Cheers

    Julian,

    Thanks for that. In fact the pasting was just an example. I am actually using :
    wp.RTFData.SetANSIString(vWPStr);

    But I get the idea with the update. Will try.

    I actually create a bunch of TWPRichText's on the fly, lay them out with checkboxes, radiogroups alongside them and then display a form. the TWPRichText are greyed until I click in them. I think I need to issue and:
    UpdateEditBox or a ReformatAll on each one before they are shown is this correct?

    And finally again, I have the WPTools_Version_5.chm, WPTOOLS_VERSION_5.HLP & WPTools5Upgrade.pdf, apart from the demo's, is this the documentation set or am I missing a PDF manual.

    I think I need to spend a week on the component, trying to work out all it can do, but my project time won't really let me.

    Thanks again,

    JAC.

    Julian,
    Thanks for the reply, tantelising, but still out of reach.

    Test form, 1 WPRichText. Set EditBoxModes + wpemAutoSizeHeight.
    Also set an event handler on WPRichText1EditBoxChangeHeight.

    Run, change text, paste text, nothing happens, no changes & the event doesn't fire. I did look at the help and the WPTools5Upgrade (this is the main PDF for the components right?).

    Obviously doing something stupid.
    JAC.

    I have just upgraded to V5 from V4. I found the whole think pretty easy and already I like the new component better than V4.

    I am a novice with the component and have implemented my own mailmerge. Maybe I should use the supplied mailmerge, but mine has tables for repeating groups and additional functionality.....

    We have a syntax:
    <selection>
    <choice>
    </choice>
    <choice>
    </choice>
    </selection>

    These can contain one line or lots of lines of text or tables or whatever.
    I want to show these in a form, splitting the display into:
    Before the selection in a WPRTF
    Each choice in a WPRTF with a checkbox
    After the selection in a WPRTF

    To make it look good, I want to size the WPRTF as Min(someSize, size of text). Does this make sense. To do this, I need to work out how tall to make the WPRTF based on the contents and if is it greater than say 250 limit it to that.

    I hope this makes sense.

    I have the same thing. Just upgraded from 4.x to latest 5 and have the same thing on both the WPRTF's in my application:

    I cut them and pasted them bank in.
    I cut and pasted the component (and what a lot of properties it stores) into notepad.


    Seems the problem is with a line 146/147:
    WriteObjectMode =

    removed line and now it is fine.
    On re-copy and paste, seems to be replaced by: WriteObjectMode = wobRTF

    I have a simple set up at a clients. The printing requirement is minimal. I will upgrade to V5, but probably not until I have purchased D2006.
    I have
    TWPToolBar & TWPRichText;
    I am pretty sure the default printers default paper size is A4. But when they hit the print button it says it is Letter. Because I know so little about printing from the component set, I am not sure which properties to set to ensure it is A4.

    Sorry for being so dense. I have tried a few combinations and a few props.

    TIA