Author Topic: Table in MSWord  (Read 1850 times)

0 Members and 1 Guest are viewing this topic.

FELIX

  • Bull Frog
  • Posts: 241
Table in MSWord
« on: August 14, 2016, 12:09:23 AM »
How to create a table in MS Word with Lisp?
OK.

d2010

  • Bull Frog
  • Posts: 326
Re: Table in MSWord
« Reply #1 on: August 14, 2016, 06:49:34 AM »
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
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.
« Last Edit: August 19, 2016, 02:43:23 PM by d2010 »

dgpuertas

  • Newt
  • Posts: 80
Re: Table in MSWord
« Reply #2 on: August 16, 2016, 03:10:14 AM »
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.


Vandyck

  • Newt
  • Posts: 24
Re: Table in MSWord
« Reply #3 on: February 10, 2017, 05:59:32 AM »
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