- 积分
- 409
- 明经币
- 个
- 注册时间
- 2007-1-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2007-12-31 17:41:00
|
显示全部楼层
<CommandMethod("creattable")> _ Public Sub ceattable() Try Dim prpointres As PromptPointResult = ed.GetPoint("选择插入点")
Dim blkTbl As BlockTable = CType(trans.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable) Dim blkTblRec As BlockTableRecord = CType(trans.GetObject(blkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord) 'Dim stId As ObjectId = AcadTableUtilities.makeTableStyle Dim ptable As New Table With ptable .Position = prpointres.Value .NumColumns = 5 '5列 .NumRows = 33 '33行
'初始化表格ptable .IsHeaderSuppressed = True '去掉页眉 .IsTitleSuppressed = True '去掉标题行 .SetColumnWidth(0, 900) .SetColumnWidth(1, 6400) .SetColumnWidth(2, 4400) .SetColumnWidth(3, 4400) .SetColumnWidth(4, 1900) .SetRowHeight(700) '行高700 For j = 0 To 32 .SetTextHeight(j, 0, 300) .SetAlignment(j, 0, CellAlignment.MiddleCenter) .SetTextHeight(j, 1, 400) .SetAlignment(j, 1, CellAlignment.MiddleLeft) .SetTextHeight(j, 2, 300) .SetAlignment(j, 2, CellAlignment.MiddleCenter) .SetTextHeight(j, 3, 400) .SetAlignment(j, 3, CellAlignment.MiddleCenter) .SetTextHeight(j, 4, 300) .SetAlignment(j, 4, CellAlignment.MiddleCenter) Next End With
blkTblRec.AppendEntity(ptable) trans.AddNewlyCreatedDBObject(ptable, True)
ptable.RecomputeTableBlock(True) 'ed.Regen() ptable.Dispose() blkTbl.Dispose() blkTblRec.Dispose() Catch ex As System.Exception MsgBox(ex.StackTrace) End Try trans.Commit() trans.Dispose() End Sub |
|