Page 1 of 1

Cannot apply text style

Posted: Mon Jun 14, 2010 5:11 pm
by Jeff
Hello - I am using the following code to add some text to a document:
rve.Clear;
rve.ApplyTextStyle(6); // a style
rve.ApplyParaStyle(1); // a paragraph style
rve.InsertText('Here is a line of text');

The text is inserted, but not in the font and font size I specified in the text style (6) above. I have also tried

rve.Clear;
rve.AddNL('Here is a line of text'',6,1);
rve.Format;

No doubt I am missing something simple? I searched help and forums with not much success.

Thanks

Posted: Mon Jun 14, 2010 7:45 pm
by Sergey Tkachenko
Both these code samples must work. You only need to add rve.Format after rve.Clear in the first example (because editing method require formatted document):
rve.Clear;
rve.Format;
rve.ApplyTextStyle(6); // a style
rve.ApplyParaStyle(1); // a paragraph style
rve.InsertText('Here is a line of text');

If it does not work, please create a simple example reproducing this problem and send it to me by email.

Posted: Wed Jun 16, 2010 3:47 pm
by Jeff
I put together an example and the code worked correctly.
I fixed the problem in my project, but I am not sure as to the root cause.
The RVE field is populated from a database. If I would Null the database field out, the code would work correctly.
I also noticed that when I cleared a document and saved it to the database field, the field was in fact not empty, some information was there (binary format) and so it had something to do with this. Thanks

Posted: Wed Jun 16, 2010 6:50 pm
by Sergey Tkachenko
Sorry, I do not understand how empty/not empty data in the field can affect this problem.

And yes, even empty document contains some data (for example, collections of styles, background, etc.)