Mara821 Posted February 27, 2017 Share Posted February 27, 2017 Hello, how can i set row style for any row in table via AutoLISP? I want to set header for second row too. I found function "vla-getrowtype" in refernce book, but there is no function for set row type. Thanks Quote Link to comment Share on other sites More sharing options...
Hippe013 Posted February 27, 2017 Share Posted February 27, 2017 You should dump the properties and methods of the table object. This will give more insight as to what you can do. (defun c:dmpobj () (setq sel (entsel "\nSelect Object: ")) (if sel (vlax-dump-object (vlax-ename->vla-object (car sel)) T) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 28, 2017 Share Posted February 28, 2017 Hi, Since there is not direct function to set the row with a specific text style, so here is my own function to get the job done as required. (defun vla-setrowtextstyle (tbl row sty / col) ;; Tharwat - Date: 28.Feb.2017 ;; (if (and (= (type tbl) 'VLA-OBJECT) (= (vla-get-objectname tbl) "AcDbTable") (>= (vla-get-rows tbl) row) (tblsearch "STYLE" sty) (setq col -1) ) (repeat (vla-get-columns tbl) (vla-setcelltextstyle tbl (1- row) (setq col (1+ col)) sty)) ) (princ) ) ;; eg: (vla-setrowtextstyle tbl 5 "Standard") Quote Link to comment Share on other sites More sharing options...
Grrr Posted February 28, 2017 Share Posted February 28, 2017 Nice one, Tharwat! One small suggestion: you could wrap all the evaluations in a single and function. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 28, 2017 Share Posted February 28, 2017 Nice one, Tharwat! Thank you. One small suggestion: you could wrap all the evaluations in a single and function. Many ways to skin the cat. Quote Link to comment Share on other sites More sharing options...
Mara821 Posted March 1, 2017 Author Share Posted March 1, 2017 Hi, Since there is not direct function to set the row with a specific text style, so here is my own function to get the job done as required. (defun vla-setrowtextstyle (tbl row sty / col) ;; Tharwat - Date: 28.Feb.2017 ;; (if (and (= (type tbl) 'VLA-OBJECT) (= (vla-get-objectname tbl) "AcDbTable") (>= (vla-get-rows tbl) row) (tblsearch "STYLE" sty) (setq col -1) ) (repeat (vla-get-columns tbl) (vla-setcelltextstyle tbl (1- row) (setq col (1+ col)) sty)) ) (princ) ) ;; eg: (vla-setrowtextstyle tbl 5 "Standard") This works with text style, but i would like to set row style with acDataRow, acHeaderRow or acTitleRow. It contains: background, text style, text height, alignment. Appearance of table should be depend on table style not text style. Although the result is the same in both ways. 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.