获取单元格样式的格式。 支持的平台:仅窗口 签名工 务 局: object.GetFormat2 StringCellStyle, pbstrFormat
返回值(RetVal)无返回值。 言论没有额外的评论。 例子工 务 局: 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 IAcadTableStyle
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
customObj.SetFormat2 "NewTestStyle", "test format"
customObj.GetFormat2 "NewTestStyle", cellTestFormat
MsgBox "Cell Style Name = " & cellTestFormat
customObj.RenameCellStyle "NewTestStyle", "NewTestStyle2"
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
customObj.CreateCellStyleFromStyle "TestStyleFromStyle", "NewTestStyle2"
customObj.DeleteCellStyle "NewTestStyle2"
Dim numOfStyles As Long
numOfStyles = customObj.NumCellStyles
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_CellStyle()
;; This example creates a TableStyle object and sets values for
;; the style name and formatting.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq dictionaries (vla-get-Dictionaries doc))
(setq dictObj (vla-Item dictionaries "acad_tablestyle"))
;; Create the custom TableStyle object in the dictionary
(setq keyName "NewStyle"
className "AcDbTableStyle")
(setq customObj (vla-AddObject dictObj keyName className))
(vla-put-Name customObj "NewStyle")
(vla-put-Description customObj "New Style for My Tables")
(vla-CreateCellStyle customObj "NewTestStyle")
(setq cellTestFormat "")
(vla-SetFormat2 customObj "NewTestStyle" "test format")
(vla-GetFormat2 customObj "NewTestStyle" 'cellTestFormat)
(alert (strcat "Cell Style Name = " cellTestFormat))
(vla-RenameCellStyle customObj "NewTestStyle" "NewTestStyle2")
(vla-GetFormat2 customObj "NewTestStyle2" 'cellTestFormat)
(alert (strcat "Cell Style Name = " cellTestFormat))
(setq uniqueStyleName (vla-GetUniqueCellStyleName customObj "testbase"))
(alert (strcat "Cell Style Name = " uniqueStyleName))
(if (= (vla-GetIsCellStyleInUse customObj "testbase") :vlax-false)
(alert "That cell style is not being used!")
)
(vla-CreateCellStyleFromStyle customObj "TestStyleFromStyle" "NewTestStyle2")
(vla-DeleteCellStyle customObj "NewTestStyle2")
(setq numOfStyles (vla-get-NumCellStyles customObj))
(alert (strcat "Number of Cell Styles = " (itoa numOfStyles)))
)X
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 05:57
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.