Help please: Print contents of styled Texture in color

Hello,

How can I print the contents of a styled text area as it appears 'WYSIWYG"? or as a single color other than black?

Thanks.

Lennox

You need to iterate thru the styleruns in the TextArea and parse the attributes from each one.
or use DRAWBLOCK

Please note, StyledTextPrinter is only available under macOS and Windows and since Xojo 2016r4 the method does not work under Windows anymore. So only under macOS.

but parsing styleruns, while more difficult will work on all desktop platforms

Thanks Dave,

All I want is one color and the text is already in that color, one text size, one Font.

I use this…
Dim stp As StyledTextPrinter
stp = TeaxtArea1.styledTextPrinter(g,MyAppprnPrinterSetup.Width - 48)
Do Until stp.EOF
stp.DrawBlock 126, 226+14, MyAppprnPrinterSetup.Height - 48
If Not stp.EOF then
g.NextPage
End if
Loop

How do I do that?

Thanks.

Lennox

Thanks, got it… https://documentation.xojo.com/api/text/styledtext.html

Lennox