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... » Remove empty paragraphs
Remove empty paragraphs [message #57378] Sun, 25 July 2021 16:33 Go to next message
mubeta is currently offline  mubeta
Messages: 77
Registered: October 2006
Member
Hi all,
how I can remove the last empty paragraph, if there is, from a QTF source, prior to merge it with a second QTF text? For exemple:
  
  RichText rta, rtb;
  ParseQTF(rta, a);
  ParseQTF(rtb, b);
  rta.CatPick(pick(rtb));
  return AsQTF(rta, CHARSET_UTF8, options);


How can check if in rta the last paragraph is empty and remove it?
Re: Remove empty paragraphs [message #57579 is a reply to message #57378] Sat, 02 October 2021 09:28 Go to previous message
mirek is currently offline  mirek
Messages: 13463
Registered: November 2005
Ultimate Member
You will have to use RichText methods which are unfortunately undocumented ATM.

Anyway, the idea is that RichTxt is an array of "parts". Part can either be a paragraph or a table. If it is table, then each of cells is another RichTxt recursively. Difference between RichText and RichTxt is that RichText contains paragraph styles too, so that way they can be shared between top-level paragraphs and paragraphs in the table (RichText is derived from RichTxt).

Now for your needs, you will need

RichTxt::GetPartCount to get the index of the last paragraph (-1)
RichTxt::IsPara to check that it is a paragraph
RichTxt::GetPartLength to check that is empty
RichTxt::RemovePart to remove it

Mirek

Previous Topic: RichTextView::GetData() Method
Goto Forum:
  


Current Time: Fri Dec 03 15:11:46 CET 2021

Total time taken to generate the page: 0.01045 seconds