Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create a table without merge cells

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
maikhanhmst
878 Views, 15 Replies

How to create a table without merge cells

Hi everyone,

 

The following routine creates a table with 7 rows and 5 colums. It automatically merges the first row. So the first row just has 1 cell. How can I unmerge this row to get 5 cells.

 

Here is the code:

 

(defun c:addMyTable () 
  (vl-load-com) 
  (setq ActiveDocument (vla-get-activedocument 
             (vlax-get-acad-object))) 
  (setq mSpace(vla-get-modelspace ActiveDocument)) 
  (setq pt (vlax-make-safearray vlax-vbDouble 
                                   '(0 . 2))) 
  ;insertion point for the table 
  (setq pt0 (getpoint "Select point"))
  (vlax-safearray-fill pt pt0)
  (setq myTable 
     (vla-addtable mSpace pt 7 5 10 30))
  );defun

 Many thanks.

15 REPLIES 15
Message 2 of 16
_Tharwat
in reply to: maikhanhmst

Add the following line of codes after the function of creating the table .

 

(vla-unMergeCells myTable 0 0 0 0)

 

Message 3 of 16
maikhanhmst
in reply to: _Tharwat

Thank you so much.
It works as I desire.
By the way, could you please suggest me some materials to learn about table properties such as vla-addtable, vla-settext, vla-textheight etc?
Message 4 of 16
_Tharwat
in reply to: maikhanhmst

You're welcome .

 

Assuming that you are using the Vlide program , so if you want to read more about the Active-X function , just highlight any function and press Ctrl+F1 and you should be directly go to the help document with the description of the function that you already chosen .

 

Or here is a link if you would like : http://entercad.ru/acadauto.en/

 

Best of luck .

Message 5 of 16
maikhanhmst
in reply to: _Tharwat

Many thanks.
Message 6 of 16
_Tharwat
in reply to: maikhanhmst


@maikhanhmst wrote:
Many thanks.

You're welcome Smiley Happy

And thanks for Kudos , highly appreciated .

Message 7 of 16
maikhanhmst
in reply to: _Tharwat

Could you tell me how to merge the cell in the table as the picture below? I tried but just get the first row merge into cell 1x1. table.png

Message 8 of 16
hmsilva
in reply to: maikhanhmst

Example:

 

(vla-MergeCells VlaObj minRow maxRow minCol maxCol )

 

try

 

(vla-MergeCells myTable 1 1 0 1)

 

to merge 2A 2B

 

Hope that helps

Henrique

EESignature

Message 9 of 16
maikhanhmst
in reply to: hmsilva

Thank you so much. It works perfectly.Smiley Very Happy

By the way, could I know how to set the color for the table (including text) and the text font? 

Message 10 of 16
_Tharwat
in reply to: maikhanhmst


@maikhanhmst wrote:

Thank you so much. It works perfectly.Smiley Very Happy

By the way, could I know how to set the color for the table (including text) and the text font? 


First of all , I am sorry I did not follow you with your last question and that was due to bad design of the forum that does not show users' subscritions to follow up and to notice if any new reply has been asked or any adds to the thread , so we should thank Henrique for the input and reply .

 

In regard to your question about the color of the text in a table , just wrap and text string like the following exaple .

 

(strcat "{\\C1;" Your_String_Here "}")

Note: The above codes color the text string to RED which represented by the number 1 which is after the C character .

 

 Good luck .

Tharwat

 

Message 11 of 16
hmsilva
in reply to: maikhanhmst


@maikhanhmst wrote:

Thank you so much. It works perfectly.Smiley Very Happy

...


You're welcome, maikhanhmst
Glad I could help. Smiley Very Happy

 

 

@_Tharwat 


@_Tharwat wrote:

... I am sorry I did not follow you with your last question and that was due to bad design of the forum that does not show users' subscritions to follow up and to notice if any new reply has been asked or any adds to the thread...


You are not alone in that one my fiend, let's hope that forum functionality be restored soon...
Cheers

Henrique

EESignature

Message 12 of 16
maikhanhmst
in reply to: _Tharwat

It's OK Smiley Happy. Thanks for your reply. 

I changed successfully the color of the text in the table. 

May I know how to choose the font of the text and to change color for all the line in the table?

I found that the color of the text and the table will be followed the current color layer.

So is there any way to choose the color of the layer I want?

 

Message 13 of 16
_Tharwat
in reply to: maikhanhmst

Use this routine to get all avaiable properties and methods of the selected object , then you can search for any function in the help document to collect and to get the proper use of the function .

 

Good luck .

 

(defun c:dump (/ e)
;; Tharwat 23.11.2014     ;;
  (if (setq e (car (entsel "\n Select any object :")))
    (progn (vlax-dump-object (vlax-ename->vla-object e) t)
           (textscr)
    )
  )
  (princ)
)(vl-load-com)

 

Message 14 of 16
maikhanhmst
in reply to: _Tharwat

Thanks.
Message 15 of 16
_Tharwat
in reply to: maikhanhmst


@maikhanhmst wrote:
Thanks.

You are welcome .

 

Happy coding .

Message 16 of 16
maikhanhmst
in reply to: _Tharwat

Hi Tharwat,
I'm trying to change the font text in the table. Could you please take your time to show me how to work with (vla-SetTextStyle)?
Thank you.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost