**[[質問箱4/540]] [#z2a3c2c0]
|RIGHT:70|LEFT:410|c
|~サマリ|表組みの文字をtopにする|
|~バージョン|1.4.7|
|~投稿者|[[yataro]]|
|~状態|質問|
|~投稿日|&new{2009-12-22 (火) 20:31:22};|
***質問 [#x2ee240f]
表(テーブル)の中の文字を上に持っていく方法はありますでしょうか?
現時点では改行を使って上に持っていくしかないので、どうにかできるとうれしいのですが。

|文字列1&br;文字列2&br;文字列3&br;文字列4|文字列1|

となってしまうので、右側の表の文字を上にしたいのです。

***回答 [#f58e6561]
- [[質問箱3/343]] --  &new{2009-12-23 (水) 03:29:24};
- wiki 全体で固定するなら、CSS を設定すればできます。表やセルごとに変えたい場合は、改造しないとできません。&br;lib/convert_html.php 1.18基準で
--485行目あたり
  	var $rowspan = 1;
  	var $style; // is array('width'=>, 'align'=>...);
 +	var $valign = '';
  
  	function TableCell($text, $is_template = FALSE)
  	{
--490行目あたり
  		$this->style = $matches = array();
  
 -		while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)):(.*)$/',
 +		while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)|(TOP|MIDDLE|BOTTOM)):(.*)$/',
  		    $text, $matches)) {
  			if ($matches[1]) {
  				$this->style['align'] = 'text-align:' . strtolower($matches[1]) . ';';
 -				$text = $matches[5];
 +				$text = $matches[6];
  			} else if ($matches[3]) {
  				$name = $matches[2] ? 'background-color' : 'color';
  				$this->style[$name] = $name . ':' . htmlspecialchars($matches[3]) . ';';
 -  				$text = $matches[5];
 +				$text = $matches[6];
  			} else if ($matches[4]) {
  				$this->style['size'] = 'font-size:' . htmlspecialchars($matches[4]) . 'px;';
 -  				$text = $matches[5];
 +				$text = $matches[6];
 +			} else if ($matches[5]) {
 +				$this->valign = strtolower($matches[5]);
 +				$text = $matches[6];
  			}
  		}
  		if ($is_template && is_numeric($text))
  			$this->style['width'] = 'width:' . $text . 'px;';
--545行目あたり
  		if ($this->colspan > 1) {
  			$param .= ' colspan="' . $this->colspan . '"';
  			unset($this->style['width']);
  		}
 +		if (isset($this->valign != '') {
 +			$param .= ' valign="' . $this->valign . '"';
 +		}
  		if (! empty($this->style))
  			$param .= ' style="' . join(' ', $this->style) . '"';
- 
と改造すれば、TOP:, MIDDLE:, BOTTOM: のルールを追加できるはず。 --  &new{2009-12-23 (水) 03:58:41};

#comment


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Site admin: PukiWiki Development Team

PukiWiki 1.5.4+ © 2001-2022 PukiWiki Development Team. Powered by PHP 5.6.40-0+deb8u12. HTML convert time: 0.046 sec.

OSDN