ReMark 发表于 2022-7-6 06:56:03


快速测试结果。

Sweety 发表于 2022-7-6 07:00:18

卡米格
 
我看到你有VAV的水流,你在你居住或工作的国家用水给VAV供水吗?
 
它是在水上工作还是需要水来运行?

ReMark 发表于 2022-7-6 07:04:03

 
我看不出这与我们试图回答的问题有什么关系。

kamig 发表于 2022-7-6 07:07:11

现在我试试。csv文件,但有一些公式,我把一个没有出现在。csv文件,那么我该如何更新它呢??

kamig 发表于 2022-7-6 07:10:10

是的,亲爱的,我在沙特阿拉伯工作,我们有带热水器的变风量空调,工作正常吗?

kamig 发表于 2022-7-6 07:12:15

看这里,我附上了excel文件,只有我必须把信用证,然后其他将自动来,如果我想在CAD同样认为这是可能的???
书籍1.xls

ReMark 发表于 2022-7-6 07:14:55

您可能需要手动输入公式。

kamig 发表于 2022-7-6 07:19:54

我尝试了,但没有在附加的excel文件中的cad中工作

ReMark 发表于 2022-7-6 07:21:55

如何附加?它是OLE对象还是您创建了数据链路?

fixo 发表于 2022-7-6 07:26:20

尝试此代码读取Xl


(defun C:XLRD (/ *error* GetXlRangeByMatch address filename sheetname x xlapp
xlbook xldata xlrange)
(vl-load-com)
(defun *error*
(msg)
   
   (if xlbook
(vl-catch-all-apply 'vlax-invoke-method (list xlbook 'Close
:vlax-false)))
   (gc)
   (if xlapp
(vl-catch-all-apply 'vlax-invoke-method (list xlapp
'Quit)))
   (gc)
   (cond ((not
msg))                                                   
; Normal exit
         ((member
msg '("Function cancelled" "quit / exit abort")))    ;
<esc> or (quit)
         
((princ (strcat "\n---Error: " msg "---")))
   
)                                                                  
; Fatal error, display it
(princ)
   )
(defun
GetXlRangeByAddress(filename sheetname address / all_skvs xlbook xlrange xlsheet
xlapp skv_records)


   (setq
xlapp(vlax-get-or-create-object "Excel.Application"))
   
(vla-put-visible xlapp :vlax-false)
   (vlax-put-property
xlapp 'DisplayAlerts :vlax-false)
(if (zerop
(vlax-get-property(vlax-get-property xlapp 'workbooks)
'count))
    (setq xlbook
(vl-catch-all-apply
   
'vla-open
    (list (vlax-get-property xlapp 'WorkBooks)
fileName)
    )
   
)
(setq xlbook (vl-catch-all-apply 'vlax-get-property (list xlapp
'activeworkbook))))



(setq xlsheet (vl-catch-all-apply
   
'vlax-get-property
    (list (vlax-get-property xlbook
'Sheets)
   'Item
   1 ;|"Sheet1"
maybe|;;< --- sheet name or number
   
)
    )
   )


   (vlax-invoke-method xlsheet
'Activate)
   (setq xlrange (vlax-get-property
(vlax-get-property xlsheet 'Cells) 'Range address))
   (if
(eq :vlax-true (vlax-variant-value(vlax-get-property xlrange
'HasFormula)))
    (setq xldata (vlax-get-property
xlrange 'formulalocal))
    (setq
xldata(vlax-get-property xlrange 'value2)))


(setq xldata (mapcar '(lambda(x)(mapcar 'vlax-variant-value
x))
      
(vlax-safearray->list
   
(vlax-variant-value
   xldata))))



(vl-catch-all-apply 'vlax-invoke-method (list xlbook 'close
:vlax-false))
(vlax-put-property xlapp 'DisplayAlerts
:vlax-true)
(gc);; before QUIT
   
(vl-catch-all-apply 'vlax-invoke-method (list xlapp 'quit))
(mapcar
'(lambda(x)(if (and x (not (vlax-object-released-p
x)))
      
(progn(vlax-release-object x)(setq x nil))))
(list xlrange
xlsheet xlbook xlapp))

(gc);; after QUIT


   xldata
)


;;___________________________main part
_____________________________________________;;


;; e.g.:
(setq filename (findfile
"C:\\blah\\blah\\blah.xls")
sheetname 1
address
"A3:E18")
(setq xlData (GetXlRangeByAddress filename sheetname
address))
(print xlData)

;;;   
---   rest your mojo here   ---   ;;;


(*error* nil)
(princ)
)
(princ
"\n\t\t---\tStart command with XLRD\t---")
(prin1)
(or
(vl-load-com)(princ))
页: 1 [2]
查看完整版本: 如何将excel文件导出为