土木在线论坛 \ 电气工程 \ 其他电气设计软件 \ 如何直接从acad直接读取excel数据

如何直接从acad直接读取excel数据

发布于:2022-08-10 10:50:10 来自:电气工程/其他电气设计软件 [复制转发]

 ;;新建工作表,用于导出数据。 (GetPy wb 39;sheets) 是工作表集合对象

  (setq sht (vlax-invoke-method (GetPy wb 39;sheets) 39;add))

  ;;得到工作表的 cells 对象,该对象与 range 对象的区别就是可以用行列定位

  (setq xcells (GetPy sht 39;cells)

    r      0

    c      0

  )

  (if (= (type Lit) 39;LIST)

    (repeat (length Lit)

      (setq d (nth r Lit)

        r (1 r)

      )

      (if (= (type d) 39;LIST)        ;如果lit的子项仍然是个表则继续循环取出

    (repeat (length d)

      (PutPy xcells 39;item r (1 c) (vl-princ-to-string (nth c d)))

      (setq c (1 c))

    )

    (PutPy xcells 39;item r 0 (vl-princ-to-string d))

                    ;修改了写入excel的顺序

      )

      (setq c 0)

    )

    (PutPy xcells 39;item 1 1 (vl-princ-to-string Lit))

  )

  (vla-put-visible *appxls* 1)

  ;;显示工作表

  (vlax-release-object xcells)

  ;;用完销毁

  (vlax-release-object sht)

  (vlax-release-object *appxls*)

)



全部回复(0 )

只看楼主 我来说两句抢沙发
这个家伙什么也没有留下。。。

其他电气设计软件

返回版块

18.08 万条内容 · 130 人订阅

猜你喜欢

阅读下一篇

求助2018CAD常青藤破解版软件

求助2018版cad能用的破解版或者带注册机常青藤

回帖成功

经验值 +10