Google 网上论坛不再支持新的 Usenet 帖子或订阅项。历史内容仍可供查看。

passing an array of values to an Excel range with vlisp

已查看 40 次
跳至第一个未读帖子

Marc'Antonio Alessi

未读,
2003年8月12日 13:33:342003/8/12
收件人
search: autodesk.autocad.customization

Excel Quit: new behaviour - Excel: multi range - Excel quit

--
________________________________________________

Marc'Antonio Alessi (TV) Italy
(strcat "NOT a " (substr (ver) 8 4) " guru.")

O.S. = XP Pro 2002 - Sp.1 - Ita
AutoCAD = 2002 Ita - Sp.1
_VERNUM = "K.0.44"
ACADVER = "15.06s (LMS Tech)"
(ver) = "Visual LISP 2000 (it)"
________________________________________________

Mark

未读,
2003年8月13日 10:14:342003/8/13
收件人
i am passing a two dimensional safe-array, and works fine,
this is a snipset from my code...
using :properties-prefix "xlp-"
xlas = the active sheet object

(setq mmls '((5.5 4 33 "O")(nil 6.6 44 "K")(7 nil 7.7 "MM")))
(xlp-put-value (xlp-get-range xlas "A1:D3")
(vlax-safearray-fill
(vlax-make-safearray vlax-vbVariant (cons 0 (1- (length mmls)))
(cons 0 (1- (length (car mmls)))))
(mapcar '(lambda (itm) (mapcar 'vlax-make-variant itm)) mmls)))

HTH

"PeterSCiganek" <peter....@schuster-pechtold.de> wrote in message
news:f17ff...@WebX.maYIadrTaRb...
> I am trying to pass a single dimension safe-array to a range in Excel. For some reason - the range
only accepts the first atom of the array. This is how the code excecutes:
> (setq range_object (vlax-get-property worksheet_object 'Range "A1:A6"))
>
> (vlax-put-property range_object 'Value2 safe_array)
>
> The safe array is correctly typed and does contain separate values.
>
> I am currently passing each value individually to a cell - and am hoping to speed up the transfer
of data by passing arrays. What am I doing wrong?
>
> Thanks for any help,
>
> Peter
>
>


Marc'Antonio Alessi

未读,
2003年8月13日 21:16:222003/8/13
收件人
Search on Google:
Excel Quit: new behaviour
autodesk.autocad.customization - 2003-04-29 , Marc'Antonio Alessi

and
Search: Visual LISP ActiveX API for Excel - reposted
on autodesk.autocad.customer-files 2003-05-22

HTH

Marco

Marc'Antonio Alessi

未读,
2003年8月13日 22:19:142003/8/13
收件人
Reading Mark post:

;
; ALEax_Make2DimSafeArray (original by Mark)
; Argument: a list
; Examples:
; (ALEax_Make2DimSafeArray '((5.5 4 33 "O")(nil 6.6 44 "K")(7 nil 7.7
"MM")))
;
(defun ALEax_Make2DimSafeArray (ImpLst)
(vlax-safearray-fill
(vlax-make-safearray vlax-vbVariant
(cons 0 (1- (length ImpLst))) (cons 0 (1- (length (car ImpLst))))
)
(mapcar '(lambda (x) (mapcar 'vlax-make-variant x)) ImpLst)
)
)
(defun C:XlNew ( )
(vl-load-com)
(setq
*ExcelApp* (vlax-get-or-create-object "Excel.Application")
*ActiveWbk*
(vlax-invoke-method
(vlax-get-property *ExcelApp* 'WorkBooks) 'Add
)
*ActiveSht* (vlax-get-property *ExcelApp* 'ActiveSheet)
*ActiveCls* (vlax-get-property *ActiveSht* 'Cells)
)
(vla-put-visible *ExcelApp* 1)
(setq
RngObj
(vlax-get-property
*ActiveSht* 'Range
"A1:D3"
)
)
(vlax-put-property RngObj 'Value2
(ALEax_Make2DimSafeArray


'((5.5 4 33 "O")(nil 6.6 44 "K")(7 nil 7.7 "MM"))
)

)
)
(defun C:XlClose ( )
(vlax-release-object RngObj) ;<<
(vlax-release-object *ActiveCls*)
(vlax-release-object *ActiveSht*)
(vlax-invoke-method *ActiveWbk* 'Close 0)
(vlax-release-object *ActiveWbk*)
(vlax-invoke-method *ExcelApp* 'QUIT)
(vlax-release-object *ExcelApp*)
(setq
*ExcelApp* nil *ActiveWbk* nil *ActiveSht* nil *ActiveCls* nil
RngObj nil
)
(gc)
)

Mark

未读,
2003年8月14日 08:22:232003/8/14
收件人
hi Marco,

any luck on the nested rectangles...

very much interested to know what

algorithm others are using.

Mark

BTW

Peter also should know that

the list and the range string should

be in sync, othewise the result will

be incorrect, i.e.

"A1:D3" and

'((A1 B1 C1 D1)(A2 B2 C2 D2)(A3 B3 C3 D3))

or

"A1:A5" and

'((A1)( A2 )(A3)( A4 )(A5))


"Marc'Antonio Alessi" <maalessi at tin dot it> wrote in message
news:CE1ACFD7B660AE93...@in.WebX.maYIadrTaRb...

Marc'Antonio Alessi

未读,
2003年8月14日 12:52:132003/8/14
收件人
Hi Mark,

no news, I have given a glance to

www.techno-sys.com www.nirvanatec.com

but I have not tried any more.

Cheers.

Marco

0 个新帖子