Author Topic: get vla Mtextobject of table cell  (Read 1367 times)

0 Members and 1 Guest are viewing this topic.

CADwiesel

  • Newt
  • Posts: 46
  • Wir machen das Mögliche unmöglich
get vla Mtextobject of table cell
« on: March 01, 2019, 02:01:22 AM »
Im looking for an way to get the vla-object of an Mtext of an acad_table object.
So at least eacht item in an Table is an own (most Mtext) object which i can get.
But till now i got the value of each cell, but not each as an object.
Maybe it's way is using the vla-getfieldid32 methode?
Gruß
CADwiesel
Besucht uns im CHAT

Grrr1337

  • Swamp Rat
  • Posts: 812
Re: get vla Mtextobject of table cell
« Reply #1 on: March 02, 2019, 02:08:30 AM »
Hi,
Unfortunately it doesn't work that way.. The GetContentType Method returns one of the following enumerables:
Code: [Select]
acCellContentTypeBlock
acCellContentTypeField
acCellContentTypeUnknown
acCellContentTypeValue
Which means that when you use GetCellValue Method you'll either get a vlax-vbString variant or a vlax-vbEmpty one.. but not a vlax-vbObject. (atleast thats the result from the quick test I did on a TypeField, TypeField and TypeBlock contenttype).

However for your case I'd suggest to use the SetCellTextStyle Method, meaning that you create and manipulate your own TextStyle Object, and in the end just apply it to the acad_table/AcDbTable object.
Another way would be to manipulate the cell itself via methods like: GetBackGroundColor GetContentColor GetTextHeight GetTextStyle GetCellStyle GetCellTextHeight.. and so on.

BTW You might find this sub useful, for dealing with table cells. :)
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

CADwiesel

  • Newt
  • Posts: 46
  • Wir machen das Mögliche unmöglich
Re: get vla Mtextobject of table cell
« Reply #2 on: March 03, 2019, 06:53:53 AM »
so this works for me...
Code: [Select]
(if
(setq vla-table(vlax-ename->vla-object(car(entsel))))
      (vlax-for item (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (cdr(assoc  2(entget(vlax-vla-object->ename vla-table)))))
        (if(=(strcase(vla-get-objectname item))"ACDBMTEXT")
..........

Gruß
CADwiesel
Besucht uns im CHAT