WPCubed Product Support

Dragging TWPTextObj (wpobjImage) objects

Is there any way of preventing TWPTextObj (wpobjImage) objects with wpobjRelativeToPage or wpobjRelativeToParagraph from being moved to a different paragraph/position if the image is dragged to a new position?

This is causing problems on my mail merge document as the TWPTextObj is being moved outside its containing wpobjMergeField object pair and is missing when I merge in the next data item. As I can not locate this object, I do not know where the new image should be positioned on the page.

If there isn't currently a way of doing this, can we have one as it is critical to my application.

#1 ♥ 0
3.1k Views 2 users read 1 min
support

The TWPTextObj which reference an image object are always positioned atr the start of a paragraph.

If this is not a problem you can avoid the move outside of the field using this code in WPCtrMemo:

replace

TextObjects.MoveParObjectTo(
TWPTextObj(FFrameVar.WorkObj),
nil, RTFPageNr, RtfX, RtfY);

with

{$IFDEF DONT_ALLOW_IMAGE_LEAVE_FIELD}
par := TWPTextObj(FFrameVar.WorkObj).ParentPar;
if CodeInsideOf(par,TWPTextObj(FFrameVar.WorkObj).ParentPosInPar,wpobjMergeField)=nil then
{$ENDIF}
par := nil;
TextObjects.MoveParObjectTo(
TWPTextObj(FFrameVar.WorkObj),
par, RTFPageNr, RtfX, RtfY);

and $define DONT_ALLOW_IMAGE_LEAVE_FIELD

Julian

#2 ♥ 0
This category is archived. No new posts are possible.