Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Table Text Height Adjustment (Whole Table)

9 REPLIES 9
Reply
Message 1 of 10
ogonzalez
5819 Views, 9 Replies

Table Text Height Adjustment (Whole Table)

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.

9 REPLIES 9
Message 2 of 10
_Tharwat
in reply to: ogonzalez

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 .

 

Table.gif

Message 3 of 10
ogonzalez
in reply to: _Tharwat

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.

Message 4 of 10
_Tharwat
in reply to: ogonzalez

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)

 

Message 5 of 10
ogonzalez
in reply to: _Tharwat

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,

Message 6 of 10
MKWeb
in reply to: ogonzalez

This is modified a bit from another routine that was presented by Peter Jamtgaard at AU2006 (Tablemagic)

 

(vla-settextheight objTableStyle acDataRow "0.30")

Mark 'MKWeb' Hultgren
Message 7 of 10
jonathan.fulton
in reply to: _Tharwat

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.

Message 8 of 10
pbejse
in reply to: jonathan.fulton

Is there a question in there?

 

zombified.png

Message 9 of 10
Sea-Haven
in reply to: MKWeb

Like you

 

(vla-SetTextHeight objtable (+ acDataRow acHeaderRow acTitleRow) txtsz)

Message 10 of 10

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".......

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost