CellStyle Example |
Using Programming Languages other than VBA
Sub Example_CellStyle() ' This example creates a TableStyle object and sets values for ' the style name and formatting. Dim dictionaries As AcadDictionaries Set dictionaries = ThisDrawing.Database.dictionaries Dim dictObj As AcadDictionary Set dictObj = dictionaries.Item("acad_tablestyle") ' Create the custom TableStyle object in the dictionary Dim keyName As String Dim className As String Dim customObj As IAcadTableStyle2 keyName = "NewStyle" className = "AcDbTableStyle" Set customObj = dictObj.AddObject(keyName, className) customObj.Name = "NewStyle" customObj.Description = "New Style for My Tables" customObj.CreateCellStyle ("NewTestStyle") Dim cellTestFormat As String Call customObj.SetFormat2("NewTestStyle", "test format") Call customObj.GetFormat2("NewTestStyle", cellTestFormat) MsgBox "Cell Style Name = " & cellTestFormat Call customObj.RenameCellStyle("NewTestStyle", "NewTestStyle2") Call customObj.GetFormat2("NewTestStyle2", cellTestFormat) MsgBox "Cell Style Name = " & cellTestFormat Dim uniqueStyleName As String uniqueStyleName = customObj.GetUniqueCellStyleName("testbase") MsgBox "Cell Style Name = " & uniqueStyleName If customObj.GetIsCellStyleInUse("testbase") = False Then MsgBox "That cell style is not being used!" End If Call customObj.CreateCellStyleFromStyle("TestStyleFromStyle", "NewTestStyle2") Call customObj.DeleteCellStyle("NewTestStyle2") Dim numOfStyles As Long numOfStyles = customObj.NumCellStyles End Sub
Comments? |