WPCubed Product Support

Text are placed under image

Hi ,

The document with images are loaded in TWPRichText component. Sometimes for some images alone, the text are placed under the image. How to avoid this behavior. The images are loaded through TWPTextObj in WPRichTextRequestHTTPImage method. Tried TTextObjWrap, TTextObjAlign property of TWPTextObj but still couldn't able to get the desired behavior. Kindly provide us some inputs to proceed further.

#1 ♥ 0
6.9k Views 2 users read 2 min
wpsupport

You provided not enough input to answer the question. So you didn't say in which format the text was loaded. Further more it is important to check the properties used by the image.

#2 ♥ 0

// Document is loaded as follows

WPRichText.TextSaveFormat := 'WPT';

WPRichText.TextLoadFormat := 'WPT'; WPRichText.CPPosition := 0;

wprichtext2.TextSaveFormat := 'WPT';

wprichtext2.TextLoadFormat := 'AUTO';

wprichtext2.CPPosition := 0;

// populating the text

WPRichText.AsString; // Header, Details are populated

wprichtext2.AsString; // other details are populated

WPRichText.SelectionAsString := wprichtext2.AsString;

// Margin is set

WPRichText.Header.LeftMargin

WPRichText.Header.RightMargin

WPRichText.Header.bottomMarginc

WPRichText.Header.topMargin

// Return the complete document

result := WPRichText.AsString;

In WPRichTextRequestHTTPImage method

Graphic := TMemoryStream.Create;

//Graphic is loaded from database i.e SaveBlobDataToStream(TBlobField(qryGraphic.fieldbyname('graphic')), Graphic);.

TextObject.LoadObjFromStream('jpg',Graphic); //

TextObject.width := intWidth;

TextObject.Height := intHeight;

strGUID := URL;

TextObject.ObjRef.StreamName := strGUID;

TextObject.ObjRef.Extra := Document_GUID;

Let me know if i need to provide further inputs

#3 ♥ 0
wpsupport

Instead of this

WPRichText.SelectionAsString := wprichtext2.AsString;

I would use a memory stream. You have conversions to strings here which can have unwanted effects and loss in performance.

When you do

TextObject.LoadObjFromStream('jpg',Graphic); //

you can also modify the ObjModes to make the image character dependent or you can change the wrap mode.

Of course the event will be only called for linked images which do not embed data. Usually they are used by RTF or HTML code.

#4 ♥ 0

Instead of SelectionAsString used memory stream and also tried setting the wrap and Mode(objmode) properties but still text are under images in some cases.

#5 ♥ 0
wpsupport

This is a bit vague - if you have a demo project using WPTools 8 which shows the unwanted effect I check it out.

Maybe you use tables - I could imagine text can be under an image if it is linked in a different cell - but this is more a problem with the document than a wptools issue.

You can send example files and demo projects (sourcecode, no binary) to

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