通过Lisp的表格单元格样式
如何使lisp遍历所有单元格(行、列)并设置单元格样式?我有“(vla setcellstyle 0 1”数据”)“正在工作,但我不想单独编程超过100个单元格。
如何使lisp穿过所有单元格?
谢谢
乔纳森 你好
试试看。
(defun c:Test ( / sty tbl obj row col r c)
;; Tharwat - Date:11.Jul.2017 ;;
(setq sty "Standard") ;; Change the Text Style to suit your desired one.
(if (and (or (tblsearch "STYLE" sty)
(alert (strcat "Text style <" sty "> is not found in drawing <!>"))
)
(princ "\nPick on Table :")
(setq tbl (ssget "_+.:S:E:L" '((0 . "ACAD_TABLE"))))
(setq obj (vlax-ename->vla-object (ssname tbl 0))
row (vla-get-rows obj)
col (vla-get-columns obj)
r 0 c 0
)
)
(repeat row
(repeat col
(vla-setcelltextstyle obj r c sty) (setq c (1+ c))
)
(setq r (1+ r) c 0)
)
)
(princ)
) (vl-load-com)
好吧,我有点困惑:
[列表]
1.以下(wcmatch x“*Cell*”)方法是否仅适用于(0。“TABLESTYLE”),而不适用于(0。“ACAD\u TABLE”)?
[/列表]
; Methods supported:
; CreateCellStyle (1)
; CreateCellStyleFromStyle (2)
; DeleteCellStyle (1)
; GetCellClass (1)
; GetCellStyles (1)
; GetIsCellStyleInUse (1)
; GetUniqueCellStyleName (1)
; RenameCellStyle (2)
; SetCellClass (2)
[列表]
2.创建新的单元格样式后,通过调用(CreateCellStyle)方法,
我们将使用(wcmatch x“*2”)方法来调整单元样式的属性,就像操作普通表样式一样?
[/列表]
; Methods supported:
; GetAlignment2 (1)
; GetBackgroundColor2 (1)
; GetColor2 (1)
; GetDataType2 (3)
; GetFormat2 (2)
; GetGridColor2 (2)
; GetGridLineWeight2 (2)
; GetGridVisibility2 (2)
; GetTextHeight2 (1)
; SetAlignment2 (2)
; SetBackgroundColor2 (2)
; SetColor2 (2)
; SetDataType2 (3)
; SetFormat2 (2)
; SetGridColor2 (3)
; SetGridLineWeight2 (3)
; SetGridVisibility2 (3)
; SetTextHeight2 (2)
第2步对我来说有点愚蠢-获得一个“CellStyle”VLA-OBJECT(如果有)并像其他任何对象一样操作它会更方便。
页:
[1]