|
发表于 2015-12-12 08:39:00
|
显示全部楼层
public void ShowTextString ()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
//获得文本内容
using (Transaction trans = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction())
{
PromptEntityOptions optEnt=new PromptEntityOptions("\n请选取文本");
optEnt.SetRejectMessage("\n***Only Text***");
optEnt.AddAllowedClass(typeof(DBText),true);
PromptEntityResult resEnt=ed.GetEntity(optEnt);
if (resEnt.Status==PromptStatus.OK)
{
DBText ent = (DBText)trans.GetObject(resEnt.ObjectId, OpenMode.ForRead);
var xffl1 = ent.TextString;
ed.WriteMessage("\n读取的文本内容为:"+ xffl1);
}
trans.Commit();
}
} |
|