+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Jul 2011
    Posts
    20

    Default Names and properties of all Cell Styles in a Table Style

    Registered forum members do not see this ad.

    Good evening, everyone.

    When manually creating table styles you can create custom cell styles and set, for each of them, a horizontal and a vertical margin.

    I'm trying to change an existing table style via LISP. I need to check each cell style, extract the values of its horizontal and vertical margins, multiply those values by a factor and then set these new products as the horizontal and vertical margins of that cell style.

    My problem is that I don't seem to find reference to cell styles anywhere. I can't find them using entget and I can't find them listed in vlax-dump-object.

    Is there a way to get the names of all the cell styles defined in a table style? And then is there a way to change the properties of such cell styles (namely the horizontal and vertical cell margins)?

    The most promising thing I've found so far is the GetCellStyles method (which is supposed to list by name the defined cell styles), but I can't seem to be able to use it correctly. No matter which arguments I supply to it I always get nil. Does anyone know how to use the GetCellStyles method?

    I thank you all in advance.

    PS.: there are a HorzCellMargin and a VertCellMargin methods (40 and 41 groups in the tablestyle entity list), but the values there apply only to the standard cell styles ("Data", "Header" and "Title").

  2. #2
    Junior Member
    Using
    AutoCAD 2010
    Join Date
    Jul 2011
    Posts
    20

    Default

    Bump.

    (sorry!)

    No ideas?

  3. #3
    Senior Member Jef!'s Avatar
    Using
    AutoCAD 2008
    Join Date
    Sep 2010
    Posts
    236

    Default

    Hi Jackstone


    For your first question, I'd be curious to know why there isn't any example into Active-x Reference guide regarding vla-getCellStyles beside "object.GetCellStyles cellStylesArray", and when I try using it with dictobj bound to the table style dictionnary...


    Code:
    (vlax-for eachentry dictObj
    (princ (vla-get-name(vla-GetCellStyles eachentry))))
    I get the following message..; error: too few actual parameters
    After looking at the Signature in the reference "object.GetCellStyles cellStylesArray " it seems that it requires an array so I tried this...

    Command: (vla-GetCellStyles dictObj)
    ; error: ActiveX Server returned the error: unknown name: GetCellStyles
    So vlide see vla-GetCellStyles as a valid function, but yet the error it returns make me think otherwise. I'm rather new to active-X so maybe just like you I'm just trying to use it the wrong way, or maybe I just have a bad interpretation of the error message.


    In the other hand, for your other question, you can easily get the margins using vla-get-HorzCellMargin and vla-put-VertCellMargin, store them, multiply them, and then change them with vla-put-HorzCellMargin and vla-put-VertCellMargin. You also can use some values directly. Please take a look at the following example to change the values...
    Code:
    (defun c:Example_CellMargin_by_Jef()
       (setq acadObj (vlax-get-acad-object))
       (setq doc (vla-get-ActiveDocument acadObj))
       (setq dictionaries (vla-get-Dictionaries doc))
       (setq dictObj (vla-Item dictionaries "acad_tablestyle"))
       (setq keyName "Copy of Standard");name of table style to be changed
       (setq tempObj (vla-GetObject dictObj keyName))
       (vla-put-HorzCellMargin tempObj 0.22)
       (vla-put-VertCellMargin tempObj 0.25)
       )
    The only thing I couldn't figure out on the fly, is if there is any way to target any specific cell styles, because with this example it modify the margins of all the cell styles of the said Table style... maybe it could still suit your needs...


    I have to leave for now, i'll try to sleep on that, perhaps ill vla-get-an-illumination in my sleep. Hoping I gave you some food for thoughts,
    Cheers
    Different goal also quite often means different path...

  4. #4
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,738

    Default

    Registered forum members do not see this ad.

    You should be able to get a individual row height if thats what you want this is column (vla-setcolumnwidth objtable 0 15) ; 0 is first column I thinks it Vla-setrowheight, trying to find example.

    Code:
    (setq objtabl (vlax-ename->vla-object (car (entsel)))) ; pick table
    (vla-getrowheight objtable 12) ; this is the 12th row change to test.
    A man who never made mistakes never made anything

Similar Threads

  1. Split cell in table
    By RRS1987 in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 16th Feb 2012, 07:22 pm
  2. table cell resizing
    By sebastionable in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 0
    Last Post: 21st Jul 2009, 07:05 pm
  3. Cell Styles for Tables
    By ziemerd in forum AutoCAD Beginners' Area
    Replies: 8
    Last Post: 30th Mar 2009, 06:18 pm
  4. Table Cell Highlight
    By ziemerd in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 30th Mar 2009, 02:36 pm
  5. AutoCAD tutorial: Create a cell style for a table
    By AutoCAD Tips Blog in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 7th Jan 2009, 04:20 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts