TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: FELIX on August 14, 2016, 12:09:23 AM
-
How to create a table in MS Word with Lisp?
-
My autolisp can generate DOC files with tables:
The programe VLXC.exe can export lisp-generator.lsp from your-file.doc
Please you see my document exported by autocad && autolisp..(named auto1.doc)
You do not need MsWord-installed, or OpenOffice ... or
But the users need MsWord or OpenOffice to see the output.doc
Step0)You must make user account on
clickhere-my-html (http://www.puiubrat.3x.ro/carto5A/vlxc_codoc2lsp.html)
This programe is free&full_version, but if you need more support,
then you must pay-me or hire me for 3$/hour..
step3)You install the setup.exe
step2)User run "VLXC"
step3)User goto WinWord.doc->Compile .doc to lisp
step4)You run the lisp and you got the file.doc outside on the folder.
-
I use ConvertToTable method after write text in Word
I write text with:
(mswm-InsertAfter *range* "this is\ta table\tby tabs\n")
(mswm-InsertAfter *range* "other\trow\t\n")
*range* is a global variable (object) represent the range of msword. i use
(setq *msw* (vlax-get-or-create-object "Word.Application")
*docs* (vla-get-documents *msw*)
*doc* (mswm-add *docs* dot) ;dot its the template (string)
*paragraphs* (mswp-get-paragraphs *doc*)
*pg* (mswp-get-last *paragraphs*)
*range* (mswp-get-range *pg*)
)
After that i use:
(setq *tabla* (mswm-ConvertToTable *range* mswc-wdSeparateByTabs))
The text is separate by tabs
Then you can do many things
put borders:
(setq bordes (mswp-get-borders *tabla*))
(mswp-put-LineStyle (mswm-item bordes mswc-wdBorderBottom) mswc-wdLineStyleSingle)
(mswp-put-LineWidth (mswm-item bordes mswc-wdBorderBottom) mswc-wdLineWidth50pt))
Put column width:
(mswp-put-Width (mswm-item (mswp-get-columns *tabla*) 1) 92)))
Or even merge cells:
(mswm-merge (mswm-item (mswp-get-cells obj) n1) (mswm-item (mswp-get-cells obj) (1+ n1)))
sorry about my english.
-
Hi all
the method suggested by dgpuertas is very attractive!
But, if I have a .doc file that contains two tables how can I position VLISP on the first table to insert 2 rows and then, move to the second table to insert other rows under the header titles?
Thanx