1

組織モード テーブルの次の条件をどのように表現しますか?

for every cell between the 2nd and 3rd hline: 
  if the cell is empty, 
    set the contents of the cell to todays date.
  else
    leave the cells contents as they are.

したがって、次の表を考えると、空のセルに今日の日付を挿入したいと思います。

|------------------|
| date             |
|------------------|
| [2014-05-23 Fri] |
| [2014-05-24 Sat] |
|                  |
|------------------|
4

1 に答える 1

3

カスタム計算関数 appendToday は、あなたが望むことを行います。水平線の間のすべてのフィールドが空の場合も処理します。

(defmath appendToday (idx v)
  (let ((d (date (month (now)) (day (now))))
        (len (vlen v)))
    (if (<= idx len)
      (if (equal (cadr v) 0)
        d
        (nth idx v)
      )
      d
    )
  )
)

評価前のテーブルは次のようになります。

|------------------|
| <2014-05-26 Mon> |
|                  |
|                  |
|                  |
|                  |
|                  |
|------------------|
#+TBLFM: @I..@II$1=appendToday(@#,@I..@II$1)

評価後のテーブルは次のようになります。

|------------------|
| <2014-05-26 Mon> |
| <2014-05-28 Wed> |
| <2014-05-28 Wed> |
| <2014-05-28 Wed> |
| <2014-05-28 Wed> |
| <2014-05-28 Wed> |
|------------------|
#+TBLFM: @I..@II$1=appendToday(@#,@I..@II$1)
于 2014-05-28T23:39:13.017 に答える