Add a space to rtf field

Questions, tips and tricks and techniques for scripting in Servoy

Add a space to rtf field

Postby Leendert » Mon Aug 03, 2009 10:10 am

I want to add a space to a rtf field. That space should have the font: Tahoma 11pt regular. So any character typed futher in that field has the font Tahoma regular 11.

The code should look something like this:

var a = ????? //<---- rtf string space Tahoma regular 11
forms[_form].rtffield += a;

Can anayone give me the code or a solution to my problem?
Leendert Plug

Servoy Developer
Version: 5.1.0 - build 956
Java version 1.6.0_17 (Windows 7)
db: Oracle 10GR2
User avatar
Leendert
 
Posts: 64
Joined: Tue Oct 02, 2007 1:44 pm
Location: Hengelo, Netherlands

Re: Add a space to rtf field

Postby Leendert » Tue Aug 04, 2009 2:55 pm

The rtf code for adding a space in the right font is:
{\rtf1\ansi{\fonttbl\f0\fnil Monospaced;\f1\fnil Tahoma;}\f1\fs22\i0\b0 }

But the following code doesn't work:
forms[_form].rtffield += '{\rtf1\ansi{\fonttbl\f0\fnil Monospaced;\f1\fnil Tahoma;}\f1\fs22\i0\b0 }';

The code doesn't give the space I want. When I display that same field as a normal textarea next to the rtf field, and I add the code manually in the normally displayed field, then the space is added.
Leendert Plug

Servoy Developer
Version: 5.1.0 - build 956
Java version 1.6.0_17 (Windows 7)
db: Oracle 10GR2
User avatar
Leendert
 
Posts: 64
Joined: Tue Oct 02, 2007 1:44 pm
Location: Hengelo, Netherlands

Re: Add a space to rtf field

Postby Leendert » Wed Aug 05, 2009 9:42 am

Solved the problem myself:

forms[_form].rtffield += '{\\rtf1\\ansi{\\fonttbl\\f0\\fnil Monospaced;\\f1\\fnil Tahoma;}\\f1\\fs22\\i0\\b0 }';
Leendert Plug

Servoy Developer
Version: 5.1.0 - build 956
Java version 1.6.0_17 (Windows 7)
db: Oracle 10GR2
User avatar
Leendert
 
Posts: 64
Joined: Tue Oct 02, 2007 1:44 pm
Location: Hengelo, Netherlands


Return to Methods

Who is online

Users browsing this forum: No registered users and 37 guests

cron