Create a new Table Style with modified Title, Header and Data values

Create a new Table Style with modified Title, Header and Data values

Anonymous
Not applicable
1,044 Views
1 Reply
Message 1 of 2

Create a new Table Style with modified Title, Header and Data values

Anonymous
Not applicable

I can create a new Table Style and change the following.

What I can't figure out is how to modify -

  Cell Styles (Title, Header, Data) and all their values (General, Text, Borders)

  Table Direction (up/down)

 

(defun C:MakeTableStyle ()
 (setq Table_Name "MyTable")
 (setq Acad_Obj (vla-get-activedocument (vlax-get-acad-object)))
 (setq Acad_Dict (vla-get-dictionaries Acad_Obj))
 (setq Table_Dict (vla-item Acad_Dict "ACAD_TABLESTYLE"))
 (setq TS_Obj (vla-addObject Table_Dict Table_Name "AcDbTableStyle"))
 (vla-put-HorzCellMargin TS_Obj 0.05)
 (vla-put-VertCellMargin TS_Obj 0.05)
 (vla-put-TitleSuppressed TS_Obj :vlax-false)
 (vla-put-HeaderSuppressed TS_Obj :vlax-false)
 (vla-put-Description TS_Obj (strcat "Table Style = " Table_Name))
 (if (and TS_Obj (not (vlax-object-released-p TS_Obj))) (vlax-release-object TS_Obj))
 (if (and Table_Dict (not (vlax-object-released-p Table_Dict))) (vlax-release-object Table_Dict))
 (if (and Acad_Dict (not (vlax-object-released-p Acad_Dict))) (vlax-release-object Acad_Dict))
 (if (and Acad_Obj (not (vlax-object-released-p Acad_Obj))) (vlax-release-object Acad_Obj))
 (princ)
)

 

 

0 Likes
1,045 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

To change the table direction

 

(setq obj (ssget "_:E:S+." (list (cons 0 "ACAD_TABLE"))))
(setq obj (vlax-ename->vla-object (ssname obj 0)))
(vla-put-FlowDirection obj acBottomToTop)

to change the cell borders use vla-setcellgridvisibility method.

to Enter or change the text value use vla-setcellvalue method.

to change the cell style use vla-setcellstyle method.

 

It may help you.

 

STM

0 Likes