New Line In Table Cell (Alt+Enter)

New Line In Table Cell (Alt+Enter)

DGCSCAD
Collaborator Collaborator
1,106 Views
4 Replies
Message 1 of 5

New Line In Table Cell (Alt+Enter)

DGCSCAD
Collaborator
Collaborator

I have a string of text to put into a table cell:

 

FIRST LINE SECOND LINE THIRD LINE

 

...but I need to "stack" it in the cell:

 

FIRST LINE

SECOND LINE

THIRD LINE

 

...all within the same cell.

 

I tried using "\n" at each point I need to break to the next line, but that's not working for table cells.

 

Any ideas?

AutoCad 2018 (full)
Win 11 Pro
0 Likes
Accepted solutions (1)
1,107 Views
4 Replies
Replies (4)
Message 2 of 5

pendean
Community Legend
Community Legend
0 Likes
Message 3 of 5

DGCSCAD
Collaborator
Collaborator

@pendean wrote:
Are you looking for this tip?
https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Entering-line-brea....

I'm trying to emulate that with LISP.

AutoCad 2018 (full)
Win 11 Pro
0 Likes
Message 4 of 5

CodeDing
Advisor
Advisor
Accepted solution

@DGCSCAD ,

 

you have to use the Paragraph character (same as would be for MText strings).

(defun c:TEST ( / table str)
  (setq table (vlax-ename->vla-object (car (entsel "\nSelect Table: "))))
  (setq str (strcat "First Line" "\\P" "Second Line"))
  (vlax-invoke-method
    table
    'SetCellValue
    0 ;<-- Row
    0 ;<-- Column
    str
  );vlax-invoke
  (alert (princ "\nTEST Complete."))
  (princ)
)

 

Best,

~DD

Message 5 of 5

DGCSCAD
Collaborator
Collaborator

@CodeDing wrote:

@DGCSCAD ,

 

you have to use the Paragraph character (same as would be for MText strings).

 

(defun c:TEST ( / table str)
  (setq table (vlax-ename->vla-object (car (entsel "\nSelect Table: "))))
  (setq str (strcat "First Line" "\\P" "Second Line"))
  (vlax-invoke-method
    table
    'SetCellValue
    0 ;<-- Row
    0 ;<-- Column
    str
  );vlax-invoke
  (alert (princ "\nTEST Complete."))
  (princ)
)

 

 

Best,

~DD


Just what the Dr. ordered! Thanks again, DD. Your help is always appreciated. I owe you many frosty beverages. 🙂

AutoCad 2018 (full)
Win 11 Pro
0 Likes