表如何输出EXCEL
本帖最后由 aaacjh 于 2012-6-25 23:04 编辑(setq bbt (list ("P1588" . 1) ("P1589" . 2)
("P1594" . 1) ("P1595" . 1)))
★如何用lisp将上面bbt表内容的子表,依次输出到excel。
输出后,单元格内容为:A1=P1588, A2=1
B1=P1589, B2=2
C1=P1594, C2=1
……
sorry!
这句 少了个 ')
(setq fp (open (setq Tmp (vl-filename-mktemp "myapp.Csv")) "w")
==>
(setq fp (open (setq Tmp (vl-filename-mktemp "myapp.Csv")) "w"))
拆开亦可
(setq Tmp (vl-filename-mktemp "myapp.Csv")
fp (open Tmp "w")
) (setq bbt '(("P1588" . 1) ("P1589" . 2) ("P1594" . 1) ("P1595" . 1)))
(setq fp (open (setq Tmp (vl-filename-mktemp "myapp.Csv")) "w")
(foreach Dp bbt
(princ
(strcat
(car Dp)
","
(itoa (cdr Dp))
"\n"
)
fp
) ) )
(close fp)
;;(StartApp "Excel.exe" tmp)
(StartApp "Explorer.exe" tmp)
Andyhon 发表于 2012-6-26 09:36 static/image/common/back.gif
(setq bbt '(("P1588" . 1) ("P1589" . 2) ("P1594" . 1) ("P1595" . 1)))
(setq fp (open (setq Tmp (vl- ...
您的语句运行提示错误: SETQ 中参数太少: (SETQ FP (OPEN (VL-FILENAME-MKTEMP "myapp.Csv") "w") (FOREACH DP BBT (PRINC (STRCAT (CAR DP) "," (ITOA (CDR DP)) "\n") FP))) 好好学习,顶一个 同求大佬指点,谢谢分享啊。
好好学习,顶一个
页:
[1]