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? 
500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@entercad.forsenergy.ru to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.