**[[質問箱3/510]] [#v5e2a71c]
#author("2018-03-11T23:22:05+09:00;2011-11-22T20:28:43+09:00","","")
**[[質問箱/3510]] [#v5e2a71c]
|RIGHT:70|LEFT:410|c
|~カテゴリ||
|~サマリ|表組みの枠の色を変更することはできませんでしょうか|
|~バージョン|1.4.7|
|~投稿者|[[summer]]|
|~状態|完了|
|~投稿日|&new{2006-10-08 (日) 18:50:18};|
***質問 [#vbc00ffe]
背景色の枠の表組みを作成して配置したい場合と、普通の色の枠の表組みを作成して配置したい場合があるのですが。&br;
色はCOLORで指定できますが、枠の色を変更する方法がありましたら教えていただけないでしょうか。
[[続・質問箱/251]]の方法だと1色しか使えませんので。
[[質問箱/2251]]の方法だと1色しか使えませんので。
どうぞよろしくお願い致します。

***回答 [#ec392c9d]
- どぞ。[[teanan:自作プラグイン/table_color]] -- [[teanan]] &new{2006-10-10 (火) 19:52:52};

***ありがとうございます [#q10041b8]
パッチまで作っていただいて、本当に本当にありがとうございます。
標準機能ではできないのですね。

早速、試してみたのですが出力されるHTMLが
<table class="style_table"
から変化しません。
何度見直しても、分からないのですが、アドバイスいただけませんでしょうか。
どうぞよろしくお願いします。
 cssは例題をそのまま使用しました
 (convert_htm.php)
 // '|'-separated table
 function & Factory_Table(& $root, $text)
 {
 //KM	if (! preg_match('/^\|(.+)\|([hHfFcC]?)$/', $text, $out)) {
	if (! preg_match('/^\|(.+)\|([hHfFcCsS]?)$/', $text, $out)) { //KM ADD
		return Factory_Inline($text);
	} else {
		return new Table($out);
	}
 }
 class Table extends Element
 {
	var $type;
	var $types;
	var $col; // number of column
	var $style; //KM ADD
 
	function Table($out)
	{
		parent::Element();
		$cells       = explode('|', $out[1]);
		$this->col   = count($cells);
		$this->type  = strtolower($out[2]);
		$this->types = array($this->type);
		$is_template = ($this->type == 'c');
		$row = array();
 //KM		foreach ($cells as $cell)
 //KM			$row[] = & new TableCell($cell, $is_template);
		$this->style = 'style_table'; 
		if($this->type == 's') {			
			$this->style = htmlspecialchars(array_shift($cells));
		} else {					
			foreach ($cells as $cell)		
				$row[] = & new TableCell($cell, $is_template);
		}						
		$this->elements[] = $row;
	}
 	function canContain(& $obj)
	{
		return is_a($obj, 'Table') && ($obj->col == $this->col);
	}
	function & insert(& $obj)
	{
		$this->elements[] = $obj->elements[0];
		$this->types[]    = $obj->type;
		return $this;
	}
	function toString()
	{
		static $parts = array('h'=>'thead', 'f'=>'tfoot', ''=>'tbody');
		// Set rowspan (from bottom, to top)
		for ($ncol = 0; $ncol < $this->col; $ncol++) {
			$rowspan = 1;
			foreach (array_reverse(array_keys($this->elements)) as $nrow) {
				$row = & $this->elements[$nrow];
				if ($row[$ncol]->rowspan == 0) {
					++$rowspan;
					continue;
				}
				$row[$ncol]->rowspan = $rowspan;
				// Inherits row type
				while (--$rowspan)
					$this->types[$nrow + $rowspan] = $this->types[$nrow];
				$rowspan = 1;
			}
		}
		// Set colspan and style
		$stylerow = NULL;
		foreach (array_keys($this->elements) as $nrow) {
			$row = & $this->elements[$nrow];
			if ($this->types[$nrow] == 'c')
				$stylerow = & $row;
			$colspan = 1;
			foreach (array_keys($row) as $ncol) {
				if ($row[$ncol]->colspan == 0) {
					++$colspan;
					continue;
				}
				$row[$ncol]->colspan = $colspan;
				if ($stylerow !== NULL) {
					$row[$ncol]->setStyle($stylerow[$ncol]->style);
					// Inherits column style
					while (--$colspan)
						$row[$ncol - $colspan]->setStyle($stylerow[$ncol]->style);
				}
				$colspan = 1;
			}
		}
		// toString
		$string = '';
		foreach ($parts as $type => $part)
		{
			$part_string = '';
			foreach (array_keys($this->elements) as $nrow) {
				if ($this->types[$nrow] != $type)
					continue;
				$row        = & $this->elements[$nrow];
				$row_string = '';
				foreach (array_keys($row) as $ncol)
					$row_string .= $row[$ncol]->toString();
				$part_string .= $this->wrap($row_string, 'tr');
			}
			$string .= $this->wrap($part_string, $part);
		}
 //KM		$string = $this->wrap($string, 'table', ' class="style_table" cellspacing="1" border="0"');
 //KM ADD
		$string = $this->wrap($string, 'table', ' class="' .
			htmlspecialchars($this->style) . '" cellspacing="1" border="0"');
		return $this->wrap($string, 'div', ' class="ie5"');
	}
 }
- すみません、wikiの書式例が間違っていました。パッチは合っていると思いますので、カラムを揃えてみてください。 -- [[teanan]] &new{2006-10-11 (水) 03:09:11};
 |style_table2|||s
 |hoge1|hoge2|hoge3|
 |A|B|B|
- 出来ました。本当にありがとうございました。&smile; -- [[summer]] &new{2006-10-11 (水) 19:56:47};
- 色々、使ってみました。
パッチありがとうございました。1つお聞きしたいのですが。SIZEが動作しません。簡単な修正で動くようにならないものでしょうか。
やりたいことは以下のようなことなのですが。
 |style_table2:SIZE(16):200|SIZE(16):200|SIZE(16):300|s
 |hoge1|hoge2|hoge3|
 |A|B|B|
作っていただき、本当にあつかましいのですが。これができると、何でも配置可能になりますので。アドバイスいただけませんでしょうか。 -- [[summer]] &new{2006-10-12 (木) 09:10:30};
- 装飾子 s では、スタイルの指定のみにしてください。その他は、装飾子 c で指定できると思います。 -- [[teanan]] &new{2006-10-12 (木) 12:44:02};
 |style_table2|||s
 |SIZE(16):200|SIZE(16):200|SIZE(16):300|c
 |hoge1|hoge2|hoge3|
 |A|B|B|
- なるほど、そういうことだったのですね。大変ありがとうございました。 -- [[summer]] &new{2006-10-12 (木) 12:58:01};

//#comment

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Site admin: PukiWiki Development Team

PukiWiki 1.5.4+ © 2001-2022 PukiWiki Development Team. Powered by PHP 8.2.12. HTML convert time: 0.160 sec.

SourceForge