Jump to content

Using LISP to generate a delta symbol in Excel


DavidGraham

Recommended Posts

I'm using a LISP routine to get some data from a drawing. I'm then writing the data to an Excel spreadsheet.

 

One of the fields should contain 'delta' with delta being the Greek letter in the shape of a triangle.

 

I found some code that will do this but it doesn't appear to work - the cell contains '\U+0647' rather than the required symbol.

 

The example below is for '?', once I get that to work I will change it for Delta  -  '\U+0184'.  

 

(setq delta (MT:Conv:Unichar->Char "\\U+0647"))    -- returns -->    "?"

(defun MT:Conv:Unichar->Char  
      (%unichar% / *ret*)
(command "_.TEXT" '(0 0) "0.3" "0" %unichar%)
(setq *ret* (cdr (assoc 1 (entget (entlast)))))
(entdel (entlast))
*ret*
)

  

Link to comment
Share on other sites

Hmm hold in excel pick a cell hold the Alt key down and type 0174 a ® should appear. Did you google excel and extended character set ? May give some clues of how to replicate keyboard typing with a text string.

 

If you use mtext or text and do hold Alt down then type 0178 you will get squared 2.

 


(setq obj (vlax-ename->vla-object (car (entsel "\nPick "))))

(setq ans (vla-get-textstring obj))

 

Try passing ans to a cell. I just copied from Autocad a ® to clipboard then pasted in excel and ® appeared.

Link to comment
Share on other sites

Thanks,

I found that typing =UNICHAR(916) into an Ecvel cell gave the Delta symbol, therefore using the following LISP code it gave a delta symbol in cell B2. 

 

 (setq cel (vlax-get-property sht 'Range "B2"))
 (vlax-put cel 'Value "=UNICHAR(916)")

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...