本文主要是介绍C# ObjectArx 绘制表格并设置单元格合并,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
第一行默认是标题,可设置行【RowType】进行设置类型
Document doc = Application.DocumentManager.MdiActiveDocument;using (Transaction tr = doc.TransactionManager.StartOpenCloseTransaction()){BlockTable bt = tr.GetObject(doc.Database.BlockTableId, OpenMode.ForRead) as BlockTable;BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;Table table = new Table();//设置表格大小(必须先创建表格类型再设置表格属性)table.SetSize(5, 3);//设置行高table.SetRowHeight(50);table.SetColumnWidth(200);// 设置表格的行数和列数// 设置表格的位置和大小table.Position = new Autodesk.AutoCAD.Geometry.Point3d(0, 0, 0);//从(2,0)单元格合并至(2,1)单元格,行列下表从0开始var cellRange = CellRange.Create(table, 2, 0, 2, 1);table.MergeCells(cellRange);btr.AppendEntity(table);tr.AddNewlyCreatedDBObject(table,true);tr.Commit();}
这篇关于C# ObjectArx 绘制表格并设置单元格合并的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!