Fabricio28 发表于 2015-1-8 08:44:42

Export table to excel

Hi guys,
I have a table in my project in autocad, but that table is design by line and text. It isn't a table command from autocad.
My question is...
Can I export the texts to excel?
Thank in advance

mjfarrell 发表于 2015-1-8 08:53:29

use data exchange.....and export out only the text values...it should work as expected

Fabricio28 发表于 2015-1-8 09:13:40

I'm attaching a example...
I wanna put that information in excel file.
Regards

Fabricio28 发表于 2015-1-8 11:28:44

Thank mjfarrell,
Regards

ronjonp 发表于 2015-1-8 12:06:28

Here is another to export to CSV.
(defun c:txt2csv (/ _foo e el f file fo fz i l out ss tmp x y z)
;; ronjonp
(defun _foo (s) (vl-string-left-trim " " (strcat (vl-string-right-trim " " s) ",")))
(if (setq ss (ssget '((0 . "text"))))
    (progn (repeat (setq i (sslength ss))
      (setq e (ssname ss (setq i (1- i))))
      (setq el (entget e))
      (and (> (cdr (assoc 40 el)) fz) (setq fz (cdr (assoc 40 el))))
      (setq l (cons (list (cdr (assoc 10 el)) (cdr (assoc 1 el))) l))
      )
      (setq l (vl-sort l '(lambda (y1 y2) (> (cadar y1) (cadar y2)))))
      (while (setq y (cadr (caar l)))
      (setq tmp (vl-remove-if-not '(lambda (a) (equal y (cadr (car a)) fz)) l))
      (setq out (cons (vl-sort tmp '(lambda (x1 x2) (
      (mapcar '(lambda (x) (setq l (vl-remove x l))) tmp)
      )
      (setq file
      (mapcar '(lambda (x) (apply 'strcat (mapcar '(lambda (z) (_foo z)) (mapcar 'cadr x))))
         (reverse out)
      )
      )
      (setq f (strcat (getvar 'dwgprefix) "TXT2CSV.csv"))
      (setq fo (open f "w"))
      (mapcar '(lambda (x) (write-line (vl-string-right-trim "," x) fo)) file)
      (close fo)
      (alert f)
    )
)
(princ)
)

Fabricio28 发表于 2015-1-8 13:48:47


Thank you my friend ronjonp!!

ronjonp 发表于 2015-1-8 14:00:05

Glad to help
页: [1]
查看完整版本: Export table to excel