jonathann3891 Posted July 11, 2017 Share Posted July 11, 2017 How do make a lisp go through all cells (rows, columns) and set the cell style? I have "(vla-setcellstyle 0 1 "data")" working, but I dont want to have to program over 100 cells individually. How do I make the lisp go through all the cells? Thanks, Jonathan Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 11, 2017 Share Posted July 11, 2017 Hi, Give this a shot. (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 Quote Link to comment Share on other sites More sharing options...
Grrr Posted July 11, 2017 Share Posted July 11, 2017 Ok, I'm a bit confused: 1.Do the following (wcmatch x "*Cell*") methods apply only to the (0 . "TABLESTYLE") and not to the (0 . "ACAD_TABLE") ? ; Methods supported: ; CreateCellStyle (1) ; CreateCellStyleFromStyle (2) ; DeleteCellStyle (1) ; GetCellClass (1) ; GetCellStyles (1) ; GetIsCellStyleInUse (1) ; GetUniqueCellStyleName (1) ; RenameCellStyle (2) ; SetCellClass (2) 2.After creating our new cell style, by invoking the (CreateCellStyle) method, we shall use the (wcmatch x "*2") methods to adjust the CellStyle's properties, just like manipulating a normal TableStyle ? ; 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) Step 2 sounds kinda stupid for me - it would be more handy to obtain a "CellStyle" VLA-OBJECT (if there was such) and manipulate it like every other object. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.