public void AdskGreeting()
        {
            // Get the current document and database
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            // Start a transaction
            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                // Open the current text style for write
                TextStyleTableRecord acTextStyleTblRec;
                acTextStyleTblRec = acTrans.GetObject(acCurDb.Textstyle,OpenMode.ForWrite) as TextStyleTableRecord;

                // Get the current font settings
                Autodesk.AutoCAD.GraphicsInterface.FontDescriptor acFont;
                acFont = acTextStyleTblRec.Font;

                // Update the text style's typeface with "PlayBill"
                Autodesk.AutoCAD.GraphicsInterface.FontDescriptor acNewFont;
                acNewFont = new Autodesk.AutoCAD.GraphicsInterface.FontDescriptor("GOST type A", false,
                                                                    acFont.Italic,acFont.CharacterSet,
                                                                    acFont.PitchAndFamily);
                acTextStyleTblRec.Font = acNewFont;
                acDoc.Editor.Regen();

                // Open the Block table record for read
                BlockTable acBlkTbl;
                acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,OpenMode.ForRead) as BlockTable;
                // Open the Block table record Model space for write
                BlockTableRecord acBlkTblRec;
                acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],OpenMode.ForWrite) as BlockTableRecord;
                /* Creates a new MText object and assigns it a location,text value and text style */
                MText objText = new MText();
                // Set the default properties for the MText object
                objText.SetDatabaseDefaults();
                objText.Location = new Autodesk.AutoCAD.Geometry.Point3d(2, 2, 0);
                objText.Contents = "Greetings, Welcome to the AutoCAD .NET Developer's Guide";
                // Set the text style for the MText object
                objText.TextStyleId =  acCurDb.Textstyle;
                // Appends the new MText object to model space
                acBlkTblRec.AppendEntity(objText);
                // Appends to new MText object to the active transaction
                acTrans.AddNewlyCreatedDBObject(objText, true);

                // Save the changes and dispose of the transaction
                acTrans.Commit();
            }
        }
        private void ChangeTextStyle(string style)
        {
            // Get the current document and database
            Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            using (DocumentLock doclock = acDoc.LockDocument())
            {
                // Start a transaction
                using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
                {
                    // Open the current text style for write
                    TextStyleTableRecord acTextStyleTblRec;
                    acTextStyleTblRec = acTrans.GetObject(acCurDb.Textstyle, OpenMode.ForWrite) as TextStyleTableRecord;

                    // Get the current font settings
                    Autodesk.AutoCAD.GraphicsInterface.FontDescriptor acFont;
                    acFont = acTextStyleTblRec.Font;

                    // Update the text style's typeface with "PlayBill"
                    Autodesk.AutoCAD.GraphicsInterface.FontDescriptor acNewFont;
                    acNewFont = new
                    Autodesk.AutoCAD.GraphicsInterface.FontDescriptor(style,
                                                                        acFont.Bold,
                                                                        acFont.Italic,
                                                                        acFont.CharacterSet,
                                                                        acFont.PitchAndFamily);

                    acTextStyleTblRec.Font = acNewFont;

                    acDoc.Editor.Regen();

                    // Save the changes and dispose of the transaction
                    acTrans.Commit();
                }
            }
        }