Active Contributor
Posts: 30
Registered: ‎04-04-2006
Message 1 of 5 (296 Views)

syntax for setting a table cell type to blockcell

296 Views, 4 Replies
08-19-2010 07:12 AM

I have tried: 

Table.SetCellType(0, 0, TableCellType.BlockCell)




Warning 1 'Public Overridable Sub SetCellType(row As Integer, col As Integer, type As Autodesk.AutoCAD.DatabaseServices.TableCellType)' is obsolete: 'Use Cell functionality instead.'


Then i tried:


Tbl.Cells(0, 0).CellType(TableCellType.BlockCell)




Error 1 Property access must assign to the property or use its value.


Then I tried:


Table.Cells(0,0).CellType = TableCellType.BlockCell




Error 1 Property 'CellType' is 'ReadOnly'. 


Can anyone elighten me?



Valued Contributor
Posts: 74
Registered: ‎08-22-2013
Message 2 of 5 (122 Views)

Re: syntax for setting a table cell type to blockcell

08-22-2013 01:24 AM in reply to: pstarkey
i met this warning too, did u find the way?
Active Contributor
Posts: 30
Registered: ‎04-04-2006
Message 3 of 5 (116 Views)

Re: syntax for setting a table cell type to blockcell

08-22-2013 05:26 AM in reply to: pstarkey


ADN Support Specialist
Posts: 352
Registered: ‎07-24-2007
Message 4 of 5 (89 Views)

Re: syntax for setting a table cell type to blockcell

09-09-2013 11:40 AM in reply to: pstarkey

would you mind posting a small sample app so I can see what you need to acheive, then I'll fix it for you

Fenton Webb

Developer Technical Services

Autodesk Developer Network

Distinguished Contributor
Posts: 210
Registered: ‎10-03-2003
Message 5 of 5 (63 Views)

Re: syntax for setting a table cell type to blockcell

09-13-2013 01:55 PM in reply to: fenton.webb


Here's a quick example, not the same message but the same error with the set margins.


<CommandMethod("cadTable")> Public Sub cadTable()
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim dwgScale As Integer = db.Dimscale
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim ppr As PromptPointResult = ed.GetPoint("Pick upper left insertion point: ")
If ppr.Status = PromptStatus.OK Then
Dim colHeadNames As New Specialized.StringCollection()
Dim colCount As Integer = colHeadNames.Count - 1
Dim tb As New Autodesk.AutoCAD.DatabaseServices.Table()
tb.TableStyle = db.Tablestyle
tb.SetSize(2, colHeadNames.Count)
tb.Height = 0.125
tb.Columns(0).Width = 0.5 * dwgScale
tb.Columns(1).Width = 0.5 * dwgScale
tb.Columns(2).Width = 1.5625 * dwgScale
tb.Columns(3).Width = 2.0 * dwgScale
tb.Columns(4).Width = 1.4375 * dwgScale
tb.Color = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 256)
tb.Position = ppr.Value
tb.Cells(0, 0).TextString = "EXAMPLE"
tb.Height = 0.125
tb.SetMargin(0, 0, CellMargins.Top, 0.0625 * dwgScale)
tb.SetMargin(0, 0, CellMargins.Bottom, 0.0625 * dwgScale)
tb.Cells(0, 0).TextHeight = 0.15625 * dwgScale
For i As Integer = 0 To colCount
tb.SetMargin(1, i, CellMargins.Top, 0.0625 * dwgScale)
tb.SetMargin(1, i, CellMargins.Bottom, 0.0625 * dwgScale)
tb.Cells(1, i).Alignment = CellAlignment.TopCenter
tb.Cells(1, i).TextString = colHeadNames(i)
tb.Cells(1, i).TextHeight = 0.09375 * dwgScale
tb.BreakEnabled = True
tb.BreakFlowDirection = TableBreakFlowDirection.Right
tb.BreakOptions = TableBreakOptions.AllowManualHeights
tb.BreakOptions = TableBreakOptions.EnableBreaking
tb.BreakOptions = TableBreakOptions.RepeatTopLabels
tb.SetBreakSpacing(0.09375 * dwgScale)
Using doclok As DocumentLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument
Using t As Transaction = db.TransactionManager.StartTransaction()
Dim bt As BlockTable = CType(t.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
Dim btr As BlockTableRecord = CType(t.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
Dim TblId As ObjectId
TblId = btr.AppendEntity(tb)
t.AddNewlyCreatedDBObject(tb, True)
End Using
End Using
End If
End Sub

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you interested in helping shape the Autodesk Community?
We’re looking at a few different ways to improve the “All Forums” landing page and need your feedback! If interested, please take a few minutes to fill out the following Usability Study. Thank you for your time!

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community