help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatically make a table with 16 columns


From: Jean Louis
Subject: Re: Automatically make a table with 16 columns
Date: Fri, 16 Sep 2022 10:26:26 +0300
User-agent: Mutt/+ () (2022-06-11)

* uzibalqa <uzibalqa@proton.me> [2022-09-16 03:17]:
> How can I automatically make a table with 16 columns in the current buffer?  
> The first row has numbers from 1 to 15, the second row from 16 to 31.  
> Followed
> by an additional two rows with entries that are empty.
> 
> Would need it to like like this
> 
> 1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 
> 
> 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
> 
> [16 empty entries]
> 
> [16 empty entries]

(table-insert COLUMNS ROWS &optional CELL-WIDTH CELL-HEIGHT)

C-h f table-insert RET

or user Hyperbole package to invoke following link:

{C-h f table-insert RET}

(progn (insert "\n")
       (table-insert 3 3 4 1))
+----+----+----+
|    |    |    |
+----+----+----+
|    |    |    |
+----+----+----+
|    |    |    |
+----+----+----+

Once you generate your table, populate it:

+----+----+----+
| 1  | 2  | 3  |
+----+----+----+
| 4  | 5  | 6  |
+----+----+----+
|    |    |    |
+----+----+----+

once you have populated it, make function to insert it:

(defun my-table ()
  (interactive)
  (insert "
+----+----+----+
| 1  | 2  | 3  |
+----+----+----+
| 4  | 5  | 6  |
+----+----+----+
|    |    |    |
+----+----+----+
"))

invoke the function:

{M-x my-table RET}

+----+----+----+
| 1  | 2  | 3  |
+----+----+----+
| 4  | 5  | 6  |
+----+----+----+
|    |    |    |
+----+----+----+


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]