Jump to content

How to display LISP code in msword with formatting


jbreard

Recommended Posts

That HTML was just copied from Lee's website ( showing that copy paste of html displays fine in Word ). Perhaps he can chime in on the numbering.

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • Grrr

    6

  • jbreard

    5

  • ronjonp

    4

  • marko_ribar

    4

Top Posters In This Topic

That HTML was just copied from Lee's website ( showing that copy paste of html displays fine in Word ). Perhaps he can chime in on the numbering.

 

Ah, now everything is clear.. :thumbsup:

 

Maybe a simple row-numbering function for .lsp/txt files would help one:

 

; (NumPrefixRows (getfiled "Specify TXT file" (strcat (getenv "userprofile") "\\Desktop\\") "txt" 16))
(defun NumPrefixRows ( fpath / des i r L )
 (cond 
   ( (and fpath (eq (type (setq des (open fpath "R"))) 'FILE) )
     (setq i 0)
     (while (setq r (read-line des)) (setq L (cons r L)))
     (close des)
     (setq des (open fpath "W"))
     (foreach x (reverse L) (princ (strcat "\n" (itoa (setq i (1+ i))) ".  " x) des)) 
     (close des)
   )
 ); cond
); defun NumPrefixRows

 

Still thats doable with MS Word (just obtain the word application) but IMO then the routine wouldn't be so generic.

Link to comment
Share on other sites

I tried Lee Mac's formatting programm and managed to get an output in .html. The result is clearly correct (I mean it's proper html) as I can open it in Firefox but I have no color and no particular formatting.

 

After some research, it is my understanding that Lee's code refers to a separate .css file containing the description of all the styles. So if that's correct, I have to understand how to make such a .style to do wathever I want with the .html display. Is that right ?

 

Marko, I'm using MS Office 2013 Pro - and still not able to display correctly the code inside word (I tried various paste special options), it literally displays like this (sample code)

 

Maybe I got wrong html output from LSP2HTML, since inside the .html file the code looks exactly like the second one I posted: no color, no row indexing, just tabbing retained.

Thats why I asked Ron what arguments he used for Lee's LISPStyler. Else I would just blame my MS office 2013.

 

That HTML was just copied from Lee's website ( showing that copy paste of html displays fine in Word ). Perhaps he can chime in on the numbering.

 

I should begin by stating that the use of my LISP Styler application to yield an HTML file requires some prerequisite knowledge of HTML/CSS.

 

The example provided in the application encloses the various syntactic elements of the AutoLISP code with HTML tags referring to CSS classes defining the inline formatting.

 

The use of CSS classes to define the inline formatting has huge advantages over the use of HTML attributes (i.e. Ron's example) in that any redefiniton of the CSS class will automatically apply the changes to any HTML element referencing the CSS class (think Block Definition/Block Reference).

 

As an example of this flexibility, see this arbitrary HTML file representation of a program on my site, and observe that you can change the formatting of the code using the buttons at the top-left of the window ("Dark", "Light", "VLIDE").

 

The HTML code for these pages of my site were generated using an enhanced version of my LISP Styler application which I haven't published, but the page could equally be assembled manually using the output from my existing LISP Styler application.

 

Note that the output from my LISP Style application does not represent a complete HTML page, but only the important

[/font] element in which the code resides - you would need to include [font=Courier New][/font], [font=Courier New][/font] & [font=Courier New][/font] elements, and either define the CSS classes within the [font=Courier New][/font] element, or within a separately referenced CSS file.

 

And thanks a lot to Lee Mac too for his formatting programm : quite a useful (and impressive) piece of LISP !

 

You're most welcome!

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...