<?xml encoding=”UTF-8″>By Virupaksha Aithal
Each row or cell in a table can have a specific style attached to it. You can get/set this style using “CellRange.Style” property. Refer below code
[CommandMethod("GetRowType")]
public void GetRowType()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptEntityOptions peo = new PromptEntityOptions("nSelect Table: ");
peo.SetRejectMessage("nInvalid selection...");
peo.AddAllowedClass(typeof(Table), true);
PromptEntityResult per = ed.GetEntity(peo);
if (per.Status != PromptStatus.OK)
return;
using (Transaction Tx = db.TransactionManager.StartTransaction())
{
Table table = Tx.GetObject(per.ObjectId, OpenMode.ForRead) as Table;
for (int row = 0; row < table.Rows.Count; row++)
{
ed.WriteMessage("nRow[{0}]: {1}", row, table.Cells[row, -1].Style);
}
Tx.Commit();
}
}

Leave a Reply