[rdnzl-cvs] CVS RDNZL/doc

eweitz eweitz at common-lisp.net
Fri Aug 25 09:45:28 UTC 2006


Update of /project/rdnzl/cvsroot/RDNZL/doc
In directory clnet:/tmp/cvs-serv12875/doc

Modified Files:
	index.html 
Log Message:
sync with 0.10.3


--- /project/rdnzl/cvsroot/RDNZL/doc/index.html	2006/08/10 15:36:48	1.11
+++ /project/rdnzl/cvsroot/RDNZL/doc/index.html	2006/08/25 09:45:28	1.12
@@ -117,7 +117,7 @@
 Here's a short example session (using <a href="#implementations">AllegroCL</a>):
 
 <pre>
-<img alt="The Message Box" title="The Message Box" align=right border=0 vspace=10 hspace=10 width=185 height=100 src="box.png">CL-USER(1): <a class=noborder href="#download">(load "/home/lisp/RDNZL/load.lisp")</a>
+<img alt="The Message Box" title="The Message Box" align=right border=0 vspace=10 hspace=10 width=185 height=100 src="box.png">CL-USER 1 > <a class=noborder href="#download">(load "/home/lisp/RDNZL/load.lisp")</a>
 <font color=orange>; Loading C:\home\lisp\RDNZL\load.lisp
 ;   Fast loading C:\home\lisp\RDNZL\packages.fasl
 ;   Fast loading C:\home\lisp\RDNZL\specials.fasl
@@ -133,23 +133,23 @@
 ;   Fast loading C:\home\lisp\RDNZL\adapter.fasl
 ;   Fast loading C:\home\lisp\RDNZL\import.fasl</font>
 T
-CL-USER(2): (in-package :rdnzl-user)
+CL-USER 2 > (in-package :rdnzl-user)
 #<The RDNZL-USER package>
-RDNZL-USER(3): (<a class=noborder href="#enable-rdnzl-syntax">enable-rdnzl-syntax</a>)
-RDNZL-USER(4): (<a class=noborder href="#import-types">import-types</a> "System.Windows.Forms"
+RDNZL-USER 3 > (<a class=noborder href="#enable-rdnzl-syntax">enable-rdnzl-syntax</a>)
+RDNZL-USER 4 > (<a class=noborder href="#import-types">import-types</a> "System.Windows.Forms"
                              "MessageBox" "MessageBoxButtons" "DialogResult")
 NIL
-RDNZL-USER(5): (<a class=noborder href="#use-namespace">use-namespace</a> "System.Windows.Forms")
-RDNZL-USER(6): (defun message-box (text &optional (caption "RDNZL"))
+RDNZL-USER 5 > (<a class=noborder href="#use-namespace">use-namespace</a> "System.Windows.Forms")
+RDNZL-USER 6 > (defun message-box (text &optional (caption "RDNZL"))
                  <font color=orange>;; check if the "OK" button was pressed</font>
                  [Equals [MessageBox.Show text caption
                                           <font color=orange>;; we want the message box to have "OK" and "Cancel" buttons</font>
                                           [$MessageBoxButtons.OKCancel]]
                          [$DialogResult.OK]])
 MESSAGE-BOX
-RDNZL-USER(7): (message-box "Hello World!") <font color=orange>;; user presses "OK" button</font>
+RDNZL-USER 7 > (message-box "Hello World!") <font color=orange>;; user presses "OK" button</font>
 T
-RDNZL-USER(8): (message-box "Hello World!") <font color=orange>;; user presses "Cancel" button</font>
+RDNZL-USER 8 > (message-box "Hello World!") <font color=orange>;; user presses "Cancel" button</font>
 NIL
 </pre>
 
@@ -271,7 +271,7 @@
 (let (message-shown)
   (defun fill-list-box (object event)
     (when (char= [%KeyChar event] #\Return)
-      (cast object "TextBox")
+      (<a class=noborder href="#cast">cast</a> object "TextBox")
       (let* ((input-string [%Text object])
              (input-length (length input-string)))
         (when (plusp input-length)
@@ -313,18 +313,18 @@
 (mp:process-run-function "apropos" #+:lispworks nil #'run-apropos-form)
 </pre>
 
-The last example shows how easy it is to access web pages using the
+The next example shows how easy it is to access web pages using the
 .NET standard library:
 
 <pre>
-RDNZL-USER(9): (<a class=noborder href="#import-types">import-types</a> "System" "Net.WebClient")
+RDNZL-USER 9 > (<a class=noborder href="#import-types">import-types</a> "System" "Net.WebClient")
 NIL
-RDNZL-USER(10): (defun download-url (url)
+RDNZL-USER 10 > (defun download-url (url)
                   (let ((web-client (new "System.Net.WebClient")))
                     [GetString (new "System.Text.ASCIIEncoding")
                                [DownloadData web-client url]]))
 DOWNLOAD-URL
-RDNZL-USER(11): (download-url "http://nanook.agharta.de/")
+RDNZL-USER 11 > (download-url "http://nanook.agharta.de/")
 "<HTML>
 <HEAD>
 <META HTTP-EQUIV=\"refresh\" CONTENT=\"5;URL=http://www.weitz.de/\">
@@ -347,10 +347,10 @@
 A bit more evolved:
 
 <pre>
-RDNZL-USER(12): (<a class=noborder href="#import-types">import-types</a> "System" "Net.WebException")
+RDNZL-USER 12 > (<a class=noborder href="#import-types">import-types</a> "System" "Net.WebException")
 NIL
-RDNZL-USER(13): (<a class=noborder href="#use-namespace">use-namespace</a> "System.Net")
-RDNZL-USER(14): (defun download-url (url)
+RDNZL-USER 13 > (<a class=noborder href="#use-namespace">use-namespace</a> "System.Net")
+RDNZL-USER 14 > (defun download-url (url)
                   (<a class=noborder href="#rdnzl-handler-case">rdnzl-handler-case</a>
                      (let ((web-client (new "WebClient")))
                        [GetString (new "System.Text.ASCIIEncoding")
@@ -359,20 +359,73 @@
                       (warn "Ooops, probably a typo: ~A" [%Message e])
                       nil)))
 DOWNLOAD-URL
-RDNZL-USER(15): (download-url "http://nanook.aharta.de/")
+RDNZL-USER 15 > (download-url "http://nanook.aharta.de/")
 Warning: Ooops, probably a typo:
          The underlying connection was closed: The remote name could not be resolved.
 NIL
 </pre>
 
 This'll also work with https URLs.
+<p>
+The last example
+shows <a href="http://office.microsoft.com/">Microsoft Office</a>
+automation - it extracts values from an Excel spreadsheet.  (You'll
+obviously need to have a copy of Office on your machine if you want to
+try this yourself.)
+
+<pre>
+RDNZL-USER 16 > (<a class=noborder href="#import-types">import-types</a> "Microsoft.Office.Interop.Excel" "ApplicationClass" "WorkbookClass" "Worksheet")
+NIL
 
+RDNZL-USER 17 > (<a class=noborder href="#use-namespace">use-namespace</a> "Microsoft.Office.Interop.Excel")
+
+RDNZL-USER 18 > (defconstant +missing+ [$System.Reflection.Missing.Value])
++MISSING+
+
+RDNZL-USER 19 > (defun get-excel-range (file-name range)
+                  (let* ((app (new "ApplicationClass"))
+                         (workbooks [%Workbooks app])
+                         (workbook (<a class=noborder href="#cast">cast</a> [Open workbooks file-name
+                                               +missing+ nil +missing+
+                                               +missing+ +missing+ +missing+
+                                               +missing+ +missing+ +missing+
+                                               +missing+ +missing+ +missing+
+                                               +missing+ +missing+]
+                                         "WorkbookClass"))
+                         (worksheets [%Worksheets workbook])
+                         (sheet (cast [get_Item worksheets 1] "Worksheet"))
+                         (range [get_Range sheet range +missing+]))
+                    (cast [%Value2 [%Cells range]] "System.Array")))
+GET-EXCEL-RANGE
+
+RDNZL-USER 20 > (defun convert-range-array-to-lists (range-array)
+                  (loop for row from 1 to [GetLength range-array 0]
+                        collect (loop for col from 1 to [GetLength range-array 1]
+                                      collect [ToString (<a class=noborder href="#aref*">aref*</a> range-array row col)])))
+CONVERT-RANGE-ARRAY-TO-LISTS
+
+RDNZL-USER 21 > (defun range-contents (&key (range "A1:C4")
+                                            <font color=orange>;; see "examples" folder for a definition of PROMPT-FOR-FILE</font>
+                                            (file-name (prompt-for-file "Select an Excel file")))
+                  (convert-range-array-to-lists
+                   (get-excel-range file-name range)))
+RANGE-CONTENTS
+
+RDNZL-USER 22 > (pprint
+                 (range-contents :file-name "c:\\home\\lisp\\RDNZL\\examples\\example.xls"))
+
+(("Last name" "First name" "Superhero")
+ ("Kent" "Clark" "Superman")
+ ("Wayne" "Bruce" "Batman")
+ ("Parker" "Peter" "Spiderman"))
+</pre>
 
+(This is an adapted version of a <a href="http://www.c-sharpcorner.com/winforms/ExcelReadMG.asp">C# example from Michael Gold</a>.)
 
 <br> <br><h3><a class=none name="download">Download and installation</a></h3>
 
 RDNZL together with this documentation can be downloaded from
-<a href="http://weitz.de/files/RDNZL.tar.gz">http://weitz.de/files/RDNZL.tar.gz</a>, the current version is 0.10.2.  It
+<a href="http://weitz.de/files/RDNZL.tar.gz">http://weitz.de/files/RDNZL.tar.gz</a>, the current version is 0.10.3.  It
 doesn't depend on any other Lisp libraries.  The C++ source for the
 shared library <code>RDNZL.dll</code> can be downloaded separately from
 <a
@@ -401,9 +454,12 @@
 all.  (Or alternatively use <a href="http://www.cliki.net/asdf">ASDF</a> if you like - RDNZL comes with a
 system definition for ASDF.)
 <p>
-Oh, and - for the moment - <em>don't</em> use <a
-href="http://common-lisp.net/project/slime/">SLIME</a> together with
-LispWorks when loading RDNZL - see <a href="http://common-lisp.net/pipermail/slime-devel/2004-December/002877.html">this message</a> for an explanation.
+Oh, and - for the moment - <em>don't</em>
+use <a href="http://common-lisp.net/project/slime/">SLIME</a> together
+with LispWorks when loading RDNZL -
+see <a
+href="http://common-lisp.net/pipermail/slime-devel/2004-December/002876.html">this
+message</a> for an explanation.
 
 
 <br> <br><h3><a name="mail" class=none>Support and mailing lists</a></h3>
@@ -1108,7 +1164,7 @@
 port.  Thanks to Franz Inc. (and particularly Jans Aasman) for
 supporting the development of RDNZL.
 <p>
-$Header: /project/rdnzl/cvsroot/RDNZL/doc/index.html,v 1.11 2006/08/10 15:36:48 eweitz Exp $
+$Header: /project/rdnzl/cvsroot/RDNZL/doc/index.html,v 1.12 2006/08/25 09:45:28 eweitz Exp $
 <p><a href="http://weitz.de/index.html">BACK TO MY HOMEPAGE</a>
 
 </body>




More information about the Rdnzl-cvs mailing list