U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » RichText,QTF,RTF... » Text wrapping in QTF Table
Re: Text wrapping in QTF Table [message #56538 is a reply to message #56537] Tue, 23 March 2021 08:53 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
Registered: November 2005
Ultimate Member
Pradip wrote on Tue, 23 March 2021 08:13
Yes, got your idea of checking the height. And the binary search would be very cool! For time being this code does the job for me:

void TrimQTFTextEllipsis(String& qtf, int width, const String& ellipsis) {
	String str = qtf;
	while(ParseQTF(qtf).GetWidth() > width) {
		str.TrimLast();
		qtf = str + ellipsis;
	}
}


It's not really elegant, will trim ending ']' from QTF if it's there, so that should be added after trimming. However with the width given correctly it works pretty good. Uploading image of output.

index.php?t=getfile&id=6395&private=0

Will try to implement the way you suggested when I can do some optimisation.


With GetHeight, you would not need to specify width...

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: search in Report
Next Topic: Bugfix: Report header/footer looks good in dark mode, not dark
Goto Forum:
  


Current Time: Fri May 15 07:14:28 GMT+2 2026

Total time taken to generate the page: 0.01185 seconds