Lotus Script work exactly the document told.
Script logic is correct.
But is the
doc.Getfirstitem(fieldname)
return a richtextitem.
If not, of course, no style apply.
But why no error throw here