Beiträge von ehimmer

    OK... I see what you did, but unfortunately, it is not enough.

    If the KeepN's are more than one page apart, it works, but here is where it fails...

    If you have two paragraphs marked with KeepN, the first paragraph is on page one, and the 2nd par is on page two. The first par gets pushed to the 2nd page, but the 2nd paragraph is still on page two, but now at the bottom of the page and needing to be moved to page 3. The 2nd par's keepN is not honored unless that par is moved so that is is at the bottom of page 3, which would move it to page 4.

    I'll send you the example.

    Eric

    This is still broken in 5.18.8. Only the *first* keepn is honored no matter how many reformats or refreshes you do. Was my example not clear enough? What can i do to help resolve this? I cannot have a heading all by itself at the end of a page.

    BTW, it has nothing to do with AppendAsSection or merge as previously thought, creating my example cleared that up... and it shows that adding multiple KeepN's do nothing... when the doc is reformatted, only the first keepN is honored... the other keepNs act like they are being ignored. If you delete the first KeepN, then the second one suddenly works since it is now the first one.

    Eric

    Thanks... the quick fix about using AsANSIString seems to work.

    As for why it worked before...

    That might be possible that they were not linked images before. While I start off using linked images throughout, I had a "LoadImages" routine which resolved paths and loaded the linked images when I generated my document for printing. With a recent WPTOOLS change that required me to resolve my image link paths at a different point in my app, I found I no longer needed to call the LoadImages routine, letting WPTools do it all.

    By your comment, it sounds like my old routine was making all the linked images into embedded images, but not anymore since I no longer had to do that. Hence the reason it probably worked before as you suspect.

    Sorry... apparently it works fine for embedded image, but fails with linked images (I only use linked images, so I forgot to mention that).

    I've sent you an example. Here are the instructions:

    The example shows three panels, the upper left is the main WPRichText which has an embedded image to illustrate the difference between embedded and linked images after a merge, the upper right is the template, and the lower panel is the merge result.

    1. Run the app
    2. Position the text cursor in the main panel (upper left)
    3. Click the Image menu and chose to insert a linked image.
    4. Pick the image I supplied which is alrady resized, or pick your own.
    5. Right click the image and select to position the image relative to the paragraph with autowrap left AND right.
    6. Click the File menu and select Merge
    7. View the results in the lower panel.

    This worked with 5.17.4 and maybe 5.18.3 (I'll have to backtrack to confirm), but fails with 5.18.6 and 5.18.7

    Please advise, thanks
    Eric

    But it does... simple test will confirm.

    -Create a new D7 app.
    - Add a WPToolbar and a WPRichText (don't forget to link the toolbar to the Richtext
    - enable the SelParKeep property in the sel_OutlineIcons group
    - Add a button, and in the OnClick event do this:

    Code
    WPRichText1.SaveToFile( 'c:\keep.rtf' );
      WPRichText1.ActivePar.ASet(WPAT_ParKeepN, 1);
      WPRichText1.SaveToFile( 'c:\keepn.rtf' );


    - Run the app
    - Type in some text and slect to keep par together using the toolbar
    - click on the button, so that it will write two RTF files, one is the before, and the other is the after the keepN is applied.

    Before (keep.rtf file):

    Zitat

    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset1 WingDings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.18;}{\keep\plain\f0\fs22 Now is the time to keep this par together\par
    }}

    After (keepN.rtf file):

    Zitat

    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset1 WingDings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.18;}{\keepn\plain\f0\fs22 Now is the time to keep this par together\par
    }}

    Examine the two files (results should be as above)... the KeepN.rtf file will show that the \keep was replaced by the \keepn. What happened to the \keep????

    Eric

    In 5.17.4, images that were marked as "position relative to paragraph" maintained their position even if brought into a WPRichtext via a mailmerge.

    However, since then (5.18.6 and even the brand new 5.18.7, maybe earlier versions too), those images get aligned at the beginning of the paragraph after the mailmerge.

    I had also used 5.18.3, but not sure if the problem was in that version or not... I can backtrack if you'd like me to.

    This is critical!!!! I wish I noticed this two weeks ago!

    If I use ASet( WPAT_ParKeepN, 1 ) to keep the current paragraph with the next, it seems to work fine UNLESS the paragraph is part of a merge field from a mail merge.

    In other words, if the keepn comes before a paragraph that was added due to a mailmerge, or even if the keepn is within the mail merged paragraph, a page break does not then honor the keepn.

    WPTools 5.18.5, D7

    Example:

    In the above, if the page break occurs after the "This is a test 3" paragraph, the "This is a test 3" text appears on the next page as it should, keeping it with "This is a test 4".

    However, if this same RTF code is added to a document via a mail merge, the "This is a test 3" does not stay with "This is a test 4". See the RTF below...

    Zitat

    {\field{\*\fldinst{MERGEFIELD $caption}}{\fldrslt{Microwave Cooking Equipment}}}\line\fs20\b0\i\tab\tab\tab\tab\tab Comments:\par'#$D#$A'\pard\li2880\plain\fs22{\field{\*\fldinst{MERGEFIELD $document}}{\fldrslt{This is a test 1\par'#$D#$A'\plain\fs22 This is a test 2\par'#$D#$A'\keepn\plain\fs22 This is a test 3\par'#$D#$A'\pard\li2880\plain\fs22 This is a test 4\par'#$D#$A'\plain\fs22 This is a test 5\par'#$D#$A'\plain\fs22 This is a test 6}}}\par'#$D#$A'\pard\plain\li2880\par'#$D#$A'}}'

    Hope it is something simple... even on my end... since this is critical in my report creation.

    Thanks,
    Eric

    I noticed that if I had a paragraph with the \keep attribute, and then use "ASet( WPAT_ParKeepN, 1 )" or "ASetAdd( WPAT_ParKeepN, 1 )" to add the KeepN property, the \keep was replace by \keepn in the RTF instead of having both. I would have expected both to be there because they seem to be mutually exclusive attributes; however, it still seems to act like the \keep is still there.

    I was using D7's debug to view the RTF using WPRichText1.AsString.

    WpTools 5.18.5

    I just used the toolbar. Note that "Paragragh color" white-on-black is fine... it is "character background color" that doesn't reload if black...

    Here is a simple sequence:

    - Start a new app

    - Add a WPToolBar and WPRichText, and assign the WPToolbar prop of the WPRichText to the toolbar

    - Add two buttons, one to WPRichText1.SaveToFile, and the other to WPRichText.LoadFromFile

    - Enable the "SelBackgroundColor" property in the sel_ListBoxes property of the WPToolBar

    - Run the app

    - type in some text, then select it and change the "background character color" (not paragraph color) to black and the forground character color to white using the toolbar to give you white on black text.

    - Note that it looks fine (white on black).

    - Click the Save button...(look at the results... the RTF looks good)

    - Click the Load button

    - Note that if you didn't clear out the WPRichText before the load, you will now have duplicate text... one still being white on black since nothing has been done to it, but the appended text from the RTF file is white on white (or white on neutral?... simply hightlight it to see that it is there).


    I see that when Word also loads that RTF, it produces white on white... so perhaps cb15 for a background color needs to be revisited. How do you set a bacground color in Word? I used the hightlight color to get a background color, and it uses the "hightlight" RTF code... then I tried shading, and it used yet another RTF code. Couldn't find how to get the cb RTF code using Word.

    I think perhaps you misunderstood... I believe the reader is changing the black background to a white background...

    Original RTF (saved to disk using SaveToFile method):

    Zitat

    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset0 Arial;}{\f2\fnil\fcharset1 WingDings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl3600\margr720\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.18;}{\plain\f1\fs22\cf12\cb15 this is white on black\par
    }}

    RTF after reloading (using LoadFromFile method):

    Zitat

    {\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset0 Arial;}{\f2\fnil\fcharset1 WingDings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl3600\margr720\margt1440\margb1440\headery720\footery720\endnhere\sectdefaultcl{\*\generator WPTools_5.18;}{\plain\fs22\cf12\cb0 this is white on black\par
    }}

    Notice the background color changed from cb15 to cb0 (black to white) simply by using the SaveToFile and LoadFromFile methods.

    It looks like in your color table, neutral and black are the same (cb0=cb15, i.e. \red0\green0\blue0)... seems not-so-good.

    Eric

    Try this sequence... I used WPTools 5.18.5

    1. start a new Delphi 7 app

    2. slap a WPRichText onto the form

    3. double click the RTFText property to launch the WPTools editor

    4. Click View + Manage Header and Footer menu sequence

    5. Click Add Header - All Pages

    6. Click Add Header - First Page Only

    7. Now select "Header all pages" from the manager's list of headers available which should then show a shorten page height just encompassing the header

    8. Add three or four lines of text

    9. Select two or three lines by highlighting them and press CTRL+C to copy them to the clipboard

    10. place text cursor in the home position of the header (cursor doesn't have to be in the home position, just somewhere other than the last line)

    11. press CTRL+V to paste the clipboard

    Note the overlapping text, which I call "double vision"