Is there a way to set the text height for all cells in a table without adjusting it on each individual cell one by one?
What i currently have is this:
(setq TotalRowCount (vla-get-rows tbl)) ; sets text's and row's height (setq RowNumber 0) (while (< RowNumber TotalRowCount) (vla-setcelltextheight tbl RowNumber 0 1.5) ; sets text's height (vla-setcelltextheight tbl RowNumber 1 1.5) ; sets text's height (vla-setcelltextheight tbl RowNumber 2 1.5) ; sets text's height (vla-setcelltextheight tbl RowNumber 3 1.5) ; sets text's height
(vla-setrowheight tbl RowNumber 3.0) ; sets row's height (setq RowNumber (+ RowNumber 1)) );while
But I would like is to set the text height for all cells in the table without the implementation of a loop as I am currenlty doing it.
Thanks.
Manually it takes a few seconds .
make internal Selection of the table then right click and choose Properties and adjust the text height as best as you want .
I know how to do it manually. I have the processing of the table automatically done in visual lisp as part of other adjustments to the table. The visual lisp code I presented already takes care of it and is faster than manually doing it. However it still may take a few seconds if the table generated is long. Which just looks silly when waiting for the routine to finish. I want to know if there is a better way (faster way) of implementing the height change with lisp by changing the whole table at once.
Thanks.
Try this and let me know how things run with you .
(defun c:TesT (/ ss) ;; Tharwat 16.June.2014 ;; (princ "\n Select table objects to change the text height of all ceels to 1.5 ") (if (setq ss (ssget "_:L" '((0 . "ACAD_TABLE")))) ((lambda (i / sn col row r c tbl) (while (setq sn (ssname ss (setq i (1+ i)))) (setq tbl (vlax-ename->vla-object sn) col (vla-get-columns tbl) row (vla-get-rows tbl) r 0 c 0 ) (repeat (* col row) (if (eq r row) (progn (setq r 0) (setq c (1+ c)) ) ) (vla-setcelltextheight tbl r c 1.5) (setq r (1+ r)) ) ) ) -1 ) ) (princ) ) (vl-load-com)
Well, even though I have not found a way of changing the text height property for the whole table at once with a single isntruction through lisp coding. That is without the implementation of loops going through and adjusting each individual cells, which is the original intend of this post, I have been able to get a very fast execution of the lisp routing by suppressing table regeneration and re-enabling table regeneration before and after my code. Now the execution of the code is quite snappy. This is what you will need to add to the code for fast execution:
(vla-put-RegenerateTableSuppressed tbl :vlax-True) ; Suppress table regen code .... (vla-put-RegenerateTableSuppressed tbl :vlax-False) ; Re-enable table regen
Anyway, if someone knows how to change text height for the whole table with a single instruction, i would like to know.
Cheers,
This is modified a bit from another routine that was presented by Peter Jamtgaard at AU2006 (Tablemagic)
(vla-settextheight objTableStyle acDataRow "0.30")
This doesn't work for me since I have my right click set to repeat last command. I do, however, run with properties open on the left side of my screen. So when I window the cells I want to change, the text height is shown in the properties box and I can easily change it there.
Properties allows you to change the text height ONLY if you pick the individual cells, a group of cells or All of the cells, BUT you cannot just pick on the table and change all cell properties of the whole table- it does not appear as an option in the properties box. Undocumented "Feature".......