StyledText formatting issue

I’m working with several StyledText objects which are merged together and then will be either shown in a TextArea or printed by using the StyledTextPrinter. Under OS X everything is working fine, but on Windows (tested with Win 7 and Win Vista) I’m experiencing a very strange behaviour: While merging StyledText objects, each line is followed by an additional empty line. I cannot explain why this happens, so I hope for some help.

Example: I’m typing the following text into a TextArea:

{\rtf1\ansi\ansicpg256{\fonttbl{\f0\fnil Helvetica;}}{\colortbl\red0\green0\blue0;}\uc0 \ql\f0\fs24 Hello\par World.}

The final result (after merging this styled text with some pre-defined StyledText objects:


RTFData (snippet from the entire file):
{\rtf1\ansi\ansicpg256{\fonttbl{\f0\fnil Courier New;}}{\colortbl\red0\green0\blue0;}\uc0 \ql\f0\fs22 Neuer Datensatz\par\par\par\par Hello\par\par World.\par\par\par\par ----------------------------------------------------------------------\par\par - }

You can see that during concatenating these StyledText objects, all \par elements have been doubled. Why ? That’s the question.

Here is my code I’m using to merge the objects (shortened):

[code] Dim Output As New StyledText 'The merged output.
Dim RecordText As New StyledText '“Hello
World.” string.

Dim Separator1 As New StyledText
Separator1.Text = App.ConfigDetails.Value(“DefaultRecordSeparatorLine”) + EndOfLine 'The slashed line.

RecordText.RTFData = rs.Field(“Text”).StringValue 'The RTFData of “Hello
World.” taken out of my database.

For Element As Integer = 0 To RecordText.StyleRunCount-1
Next Element

For Element As Integer = 0 To Separator1.StyleRunCount-1
Next Element[/code]

There are other StyledText objects as well, but all are using the same method.

So any idea on how to solve this is highly appreciated. My last chance would be to search the RTFData for double \par\par entries on Windows platform and removing one. But it’s not very elegant. Furthermore, I would like to understand while this happens (not just fight on symptoms).

A side note: Pressing CTRL+Enter instead of Enter when typing “Hello
World.” makes anything working well. But for obvious reasons, this is definitively no solution. :wink:


Holy cow! I just asked this question and you asked 7 months ago to never get a response. … encouraging :-/

My current solution is:

Dim fixedStyledText as StyledText

fixedStyledText.RTFData = (nonFixedStyledText.RTFData,"\par\par","\par")

@Matthew Combatti : Yes, the StyledText class is poor and lacks of many common features. There is another workaround I used, but I would need to look in my documents for details (drop me a mail, if you need it).

The worst thing is, that these errors are all known to the developers since many years (checkout feedback app). But RS/Xojo decided to develop a new IDE with inefficient workflow instead of working on the language.