Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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: 14258
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: Wed May 14 17:37:58 CEST 2025

Total time taken to generate the page: 0.00857 seconds