Making table style

Making table style

S_S_SS
Advocate Advocate
601 Views
4 Replies
Message 1 of 5

Making table style

S_S_SS
Advocate
Advocate

Hello every one ...
i have a lisp that make data extraction command but i use the standard table style and i need to make a table style in a code and add this to the lisp 
i need it to have title - head and data 
for title text height 8 and color is red 
for header text height is 5 and color is magenta 
for data text height is 5 and color is white 

mostafahisham62_0-1638340374715.png

I uploaded the lisp 
i wish that some one add what i need to the lisp 

and thanks in advance ...

Accepted solutions (2)
602 Views
4 Replies
Replies (4)
Message 2 of 5

Sea-Haven
Mentor
Mentor
Accepted solution
Message 3 of 5

S_S_SS
Advocate
Advocate
thanks my brother
you are great
0 Likes
Message 4 of 5

Sea-Haven
Mentor
Mentor
Accepted solution

For anyone else this is just a part of the code making a table style other factors like column widths are in other code.

 

(defun CreateTableStyle( / dicts dictobj key class custobj )
    
;; Get the Dictionaries collection and the TableStyle dictionary
(setq dicts (vla-get-Dictionaries (vla-get-ActiveDocument(vlax-get-acad-object))))
(setq dictObj (vla-Item dicts "acad_tablestyle"))

(setq txtht (getreal "\nEnter text height for table "))

(vlax-for dname dictobj
(if (=  (vla-get-name dname) "Mostafa" )
(princ) 
(progn

;; Create a custom table style
(setq key "Mostafa"
      class "AcDbTableStyle")
(setq custObj (vla-AddObject dictObj key class))

;; Set the name and description for the style
(vla-put-Name custObj "Mostafa")
(vla-put-Description custObj "Mostafa custom table style")

;; Sets the bit flag value for the style
(vla-put-BitFlags custObj 1)

;; Sets the direction of the table, top to bottom or bottom to top
(vla-put-FlowDirection custObj acTableTopToBottom)

;; Sets the horizontal margin for the table cells
(vla-put-HorzCellMargin custObj txtht )

;; Sets the vertical margin for the table cells
(vla-put-VertCellMargin custObj txtht )
;; Set the alignment for the Data, Header, and Title rows
(vla-SetAlignment custObj (+ acDataRow acHeaderRow acTitleRow) acMiddleCenter)

;; Set the text height for the Title, Header and Data rows
(vla-SetTextHeight custObj acDataRow txtht)
(vla-SetTextHeight custObj acHeaderRow (* txtht 1.2))
(vla-SetTextHeight custObj acTitleRow (* txtht 1.3))


;; Set the text height and style for the Title row
(vla-SetTextStyle custObj (+ acDataRow acHeaderRow acTitleRow) "Standard")
)
)
(setvar 'ctablestyle "Mostafa")
)
  (princ)
)

 

 

Message 5 of 5

S_S_SS
Advocate
Advocate

thanks sir .....

0 Likes