Jump to content

Can I insert values of text into Excel table


todorb2000

Recommended Posts

I have a some text's objects in the autocad drawing.

So I need a lisp or vba to read them into Excel table and use it to text items values. Can anybody help me?:)

Link to comment
Share on other sites

have a some text's objects in the autocad drawing.

So I need a lisp or vba to read them into Excel table and use it to text items values. Can anybody help me?:)

Link to comment
Share on other sites

have a some text's objects in the autocad drawing.

So I need a lisp or vba to read them into Excel table and use it to text items values. Can anybody help me?:)

 

I'm sure Lee Mac and co. will make light work of it :D .

 

A new thread may be better, though.

Link to comment
Share on other sites

Hi todorb2000,

 

I think that is very possible.

 

Just a few questions:

 

Are all the text objects on their own layer?

 

Do you want the user to select the text object him/herself - or have the program just select all text objects on a certain layer?

 

Is is just single-line (DTEXT) or MTEXT? or a mixture of the two?

 

Thanks

Link to comment
Share on other sites

Here:

 

(defun c:TE () (c:TEXT_EXTRACTOR)) ; Program Shortcut

(defun c:TEXT_EXTRACTOR    (/ file xfile ss index ents txtval)

   ;; File Selection

   (defun selfile ()
   (setq file (getfiled "Select/Create Excel File"
                "C:\\"
                "csv"
                9
          ) ;_  end getfiled
   ) ;_  end setq
   ) ;_  end defun
   (selfile)
   (if    file
   (progn
       (setq xfile (open file "w"))

       ;; Text Retrieval

       (while
       (not ss)
          (setq ss (ssget '((0 . "TEXT,MTEXT"))))
       ) ;_  end while

       (setq index    (1- (sslength ss))
         ents    0
       ) ;_  end setq
       (while (not (minusp index))
       (setq txtval (cdr (assoc 1 (entget (ssname ss index)))))
       (write-line txtval xfile)
       (setq index (1- index)
             ents  (1+ ents)
       ) ;_  end setq
       ) ;_  end while
       (close xfile)
       (princ (strcat "\n" (rtos ents) " Text Entities Written."))
   ) ;_  end progn
   (alert "No File Selected.")
   ) ;_  end if
   (princ)
) ;_  end defun

Link to comment
Share on other sites

Todorb, please don't post the same question multiple times. Ask your question once and then wait for replies. Also, start a new thread when you have a question. Please don't tack your question on to someone else's thread. I have deleted your other posts concerning this issue and merged everything here.

 

Lee Mac, I think I accidentally deleted your code from one of the other threads, but I see you have already re-posted it here. Sorry about that. :oops:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...