Generate tables in a new TMDX-document

Post Reply
User avatar
Michael Uplawski
Posts: 177
Joined: Thu Dec 11, 2014 11:43 pm
Location: Canton Magny (previously Canton Carrouges), Orne, Normandy (previously Lower Normandy)

Generate tables in a new TMDX-document

Post by Michael Uplawski »

This is the result of an endeavor already mentioned in https://forum.softmaker.com/viewtopic.php?f=306&t=18232

You can replace TMDX by OOXML in the subject-line of this post. Now I have a ruby-program which does the work for me: It generates a table and fills the first column with a sequence of dates (or numbers). Some variables are set by command-line arguments. I present you the complete usage-message:

Code: Select all

michael@paulo:~$ tm_gen_table -h
Usage:	/usr/local/bin/tm_gen_table <options>

Specific options:
    -w, --weeks                      Delimit weeks
        --highlight                  highlight week-ends
        --no-we                      Ignore week-ends
    -b, --begin=VALUE                Begin value
    -c, --cols=NUM                   Number of columns
    -e, --end=VALUE                  End value
    -t, --templates=TEMPLATE         Directory of templates
    -d, --date=FORMAT                Generate date-cells (default)
    -n, --number=WIDTH               Generate number-cells
    -f, --file=FILE                  Write output to file FILE

Common options:
    -h, --help                       Show this message
    -v, --version                    Show version and program information
**Why all this?**
I frequently need such a table for monthly resumes. The template option allows me to pre-define headers, footers and the general styling of the new document.

**Why here?**
The absence of a programming-interface is oftentimes lamented in the forum. However, with the choice of an OOXML file-format, everything which is possible with XML is possible with the SoftMaker file-formats like tmdx or pmdx.

Creating or manipulating the file directly, you are independent of all software-imposed constraints. The risks are minor, as a file which is processed, later, in a text-processor or spreadsheet-program, will be saved anew, from memory, and thus cleaned of useless or ill-chosen constructs.

For your inspiration or bewilderment I attach a current Ruby-gem (basically a tar-archive, remove the zip-extension, it is there only to make this forum accept the file) and the man-page for my above mentioned program. Being out of professional programming for years, I can only claim that it works for me. Use at your own risk or scrutinize the code after untaring (tar -xf) the gem.

The best that you can do is take it as an example for your own specific solutions.
Attachments
tm_gen_table.1.gz
(2.17 KiB) Downloaded 411 times
tm_gen_table-0.1.gem.zip
(13.5 KiB) Downloaded 429 times
Hindsight is in the eye of the beholder.
Post Reply

Return to “TextMaker 2018 for Linux”