Perhaps you could try something like this ..
[CommandMethod("TestText")]
static public void TestDbText()
// CodeHimBelongaKbub@TheSwamp © Dec 2008
{
Database db = HostApplicationServices.WorkingDatabase;
string txtStr = "This is a DbText string.";
string txtStyle = "kbubsComicTextStyle";
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord CurrentSpaceBtr = tr.GetObject(db.CurrentSpaceId,
OpenMode.ForWrite) as BlockTableRecord ;
DBText textObj = new DBText();
textObj.TextString = txtStr;
textObj.Height = 500;
textObj.Position = new Point3d(0,0,0) ;
textObj.HorizontalMode = TextHorizontalMode.TextMid;
textObj.AlignmentPoint = textObj.Position;
TextStyleTable txtTbl = tr.GetObject(db.TextStyleTableId,
OpenMode.ForRead) as TextStyleTable ;
if (txtTbl.Has(txtStyle))
{
TextStyleTableRecord txtTbr = tr.GetObject(txtTbl[txtStyle],
OpenMode.ForRead) as TextStyleTableRecord;
textObj.TextStyle = txtTbr.ObjectId;
}
CurrentSpaceBtr.AppendEntity(textObj);
tr.AddNewlyCreatedDBObject(textObj, true);
tr.Commit();
}
}