Table Rows and Cell Styles

<?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();
}
}

Comments

4 responses to “Table Rows and Cell Styles”

  1. table.Cells[row, -1].Style = “Data”
    not working => eNotApplicable
    yes, table is open “forwrite”

  2. Daniel Avi Avatar
    Daniel Avi

    Hi.
    I have a question.
    I want trans Table in AutoCAD to Excel, how to get value cell merged in table trans to Excel

  3. Hey,
    I have an E_commerce store affiliate with Amazon. I am listing quality product on my store. These products available on my store in very cheap price. If you want to visit my store.

  4. Your blog provides a comprehensive perspective. offering valuable insights and engaging content. I appreciate the depth of research evident throughout, which enhances the credibility of the information presented. If you’re looking to buy props, check out https://curatedbyphoenix.com/ for some fantastic options!”

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading