.NET

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

syntax for setting a table cell type to blockcell

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

I have tried: 

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

 

result:

 

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)

 

result:

 

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

 

Then I tried:

 

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

 

result:

 

Error 1 Property 'CellType' is 'ReadOnly'. 

 

Can anyone elighten me?

 

 

Valued Contributor
swaywood
Posts: 91
Registered: ‎08-22-2013
Message 2 of 5 (150 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
pstarkey
Posts: 30
Registered: ‎04-04-2006
Message 3 of 5 (144 Views)

Re: syntax for setting a table cell type to blockcell

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

No

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 4 of 5 (117 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
Mikko
Posts: 212
Registered: ‎10-03-2003
Message 5 of 5 (91 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()
colHeadNames.Add("ABC")
colHeadNames.Add("DEF")
colHeadNames.Add("GHI")
colHeadNames.Add("JKL")
colHeadNames.Add("MNO")
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
Next
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)
tb.GenerateLayout()
Dim TblId As ObjectId
TblId = btr.AppendEntity(tb)
t.AddNewlyCreatedDBObject(tb, True)
t.Commit()
End Using
End Using
End If
End Sub

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!