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)
)