=encoding euc-jp =head1 ̾Á° HTML::Table - HTML ¥Æ¡¼¥Ö¥ë¤òÀ¸À®¤¹¤ë =head1 ³µÍ× use HTML::Table; $table1 = new HTML::Table($rows, $cols); ¤Þ¤¿¤Ï¡¢ $table1 = new HTML::Table(-rows=>26, -cols=>2, -align=>'center', -rules=>'rows', -border=>0, -bgcolor=>'blue', -width=>'50%', -spacing=>0, -padding=>0, -style=>'color: blue', -class=>'myclass', -head=> ['head1', 'head2'], -data=> [ ['1:1', '1:2'], ['2:1', '2:2'] ] ); ¤Þ¤¿¤Ï¡¢ $table1 = new HTML::Table( [ ['1:1', '1:2'], ['2:1', '2:2'] ] ); $table1->setCell($cellrow, $cellcol, 'This is Cell 1'); $table1->setCellBGColor('blue'); $table1->setCellColSpan(1, 1, 2); $table1->setRowHead(1); $table1->setColHead(1); $table1->print; $table2 = new HTML::Table; $table2->addRow(@cell_values); $table2->addCol(@cell_values2); $table1->setCell(1,1, "$table2->getTable"); $table1->print; =head1 Æ°ºî¾ò·ï Perl5.002 =head1 ¥¨¥¯¥¹¥Ý¡¼¥È ¤Ê¤· =head1 ÀâÌÀ HTML::Table ¤Ï¡¢CGI ¥¹¥¯¥ê¥×¥È¤Ë¤ª¤¤¤Æ HTML ¥Æ¡¼¥Ö¥ë¤òºîÀ®¤¹¤ë¤¿¤á¤Ë»È¤¤¤Þ¤¹¡£Ä󶡤µ¤ì¤ë¥á¥½¥Ã¥É·²¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç¡¢Èó¾ï¤ËÊ£»¨¤Ê¥Æ¡¼¥Ö¥ë¤ÎÀ¸À®¡¢Áàºî¡¢¤½¤·¤Æ½ÐÎϤ¬ Perl ¥¹¥¯¥ê¥×¥È¤Ç²Äǽ¤È¤Ê¤ê¤Þ¤¹¡£¤³¤Î¥â¥¸¥å¡¼¥ë¤Ç¤Ï¡¢¥Æ¡¼¥Ö¥ëÃæ¤Ë¥Æ¡¼¥Ö¥ë¤òºîÀ®¤¹¤ëºî¶È¤â Perl ¤«¤éÈó¾ï¤Ë´Êñ¤Ë¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£HTML ¥¿¥°¤ò»ÈÍѤ¹¤ë¤³¤È¤Ê¤¯¡¢¤³¤Î¥â¥¸¥å¡¼¥ë¤ÇÄ󶡤µ¤ì¤ë¥á¥½¥Ã¥É·²¤ò»ÈÍѤ¹¤ë¤À¤±¤ÇÁ´¤Æ¤Îµ¡Ç½¤òÈ÷¤¨¤ë¥Æ¡¼¥Ö¥ë¤òÀ¸À®¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£ HTML::Table ¤Ï¡¢addRow ¤È addCol ¥á¥½¥Ã¥É¤ò»ÈÍѤ¹¤ë¤³¤È¤Ç¡¢Æ°Åª¤Ë¥µ¥¤¥º¤ÎÊѤï¤ë¥Æ¡¼¥Ö¥ë¤òºîÀ®¤¹¤ë¤³¤È¤â½ÐÍè¤Þ¤¹¡£¤Ä¤Þ¤ê¡¢¤½¤Î¤È¤¤Î¥Æ¡¼¥Ö¥ë¥»¥ë¿ô¤òĶ¤¨¤ëÃͤ¬ÅϤµ¤ì¤¿¾ì¹ç¤Ë¡¢¤³¤ì¤é¥á¥½¥Ã¥É¤Ï¤½¤ì¤ËŬ¹ç¤¹¤ë¤è¤¦¼«Æ°Åª¤Ë¥Æ¡¼¥Ö¥ë¤ò¥ê¥µ¥¤¥º¤·¤Þ¤¹¡£ HTML 3.0 ¤Çµ¬Äꤵ¤ì¤Æ¤¤¤ë¥Æ¡¼¥Ö¥ë¤Ë´Ø¤¹¤ë¤Û¤È¤ó¤ÉÁ´¤Æ¤Î¥¿¥°·²¤Ë¤Ä¤¤¤Æ¡¢Âбþ¤¹¤ë¥á¥½¥Ã¥É¤¬Ä󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡£ ¤³¤Îʸ¾Ï¤ÎÆüËܸìÌõ¤Ï¼¡¤ÇÍøÍѤǤ¤Þ¤¹¡§ http://member.nifty.ne.jp/hippo2000/perltips/html/table.htm ¡ÊÌõ¼Ô(2)Äɵ¡¨¤³¤Î¥Ú¡¼¥¸¤Ï¡¢¼¡¤Ë°ÜÆ°¤µ¤ì¤Æ¤ª¤ê¤Þ¤¹ http://homepage3.nifty.com/hippo2000/perltips/html/table.htm¡Ë =head1 ¥á¥½¥Ã¥É·² ³Ñ¤«¤Ã¤³ [ ] ¤Ï¡¢¥ª¥×¥·¥ç¥ó¤Î¥Ñ¥é¥á¡¼¥¿¤Ç¤¢¤ë¤³¤È¤ò¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£»ØÄꤵ¤ì¤Ê¤¤¾ì¹ç¤Ï¥Ç¥Õ¥©¥ë¥ÈÃͤ¬»È¤ï¤ì¤Þ¤¹¡£ row_num ¤Ï¡¢¹Ô¿ô¤¬É¬¿Ü¤Ç¤¢¤ë¤³¤È¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£¹Ô¤Ï1¤«¤é¿ô¤¨¤Þ¤¹¡£ºÇ¸å¤Î¹Ô¤ò»²¾È¤¹¤ë¤Ë¤Ï¡¢-1¤ò»ÈÍѤ·¤Þ¤¹¡£ col_num ¤Ï¡¢Îó¿ô¤¬É¬¿Ü¤Ç¤¢¤ë¤³¤È¤ò¼¨¤·¤Æ¤¤¤Þ¤¹¡£Îó¤Ï1¤«¤é¿ô¤¨¤Þ¤¹¡£ºÇ¸å¤ÎÎó¤ò»²¾È¤¹¤ë¤Ë¤Ï¡¢-1¤ò»ÈÍѤ·¤Þ¤¹¡£ =head2 À¸À® =over 4 =item new HTML::Table([num_rows, num_cols]) ¿·¤·¤¤HTML ¥Æ¡¼¥Ö¥ë ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤Þ¤¹¡£¹Ô¿ô¤ÈÎó¿ô¤¬»ØÄꤵ¤ì¤ì¤Ð¡¢¥Æ¡¼¥Ö¥ë¤Ï¤½¤Î¥µ¥¤¥º¤Ç½é´ü²½¤µ¤ì¤Þ¤¹¡£¹Ô¤ÈÎó¤Î¿ô¤Ï 1, 1 ¤«¤é»Ï¤Þ¤ê¤Þ¤¹¡£0, 0 ¤Ï¡¢¶õ¤Î¥Æ¡¼¥Ö¥ë¤È²ò¼á¤µ¤ì¤Þ¤¹¡£ =item new HTML::Table([ -rows=>num_rows, -cols=>num_cols, -border=>border_width, -align=>table_alignment, -style=>table_style, -class=>table_class, -bgcolor=>back_colour, -width=>table_width, -spacing=>cell_spacing, -padding=>cell_padding ]) ¿·¤·¤¤HTML ¥Æ¡¼¥Ö¥ë ¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¤Þ¤¹¡£¹Ô¿ô¤ÈÎó¿ô¤¬»ØÄꤵ¤ì¤ì¤Ð¡¢¥Æ¡¼¥Ö¥ë¤Ï¤½¤Î¥µ¥¤¥º¤Ç½é´ü²½¤µ¤ì¤Þ¤¹¡£¹Ô¤ÈÎó¤Î¿ô¤Ï 1, 1 ¤«¤é»Ï¤Þ¤ê¤Þ¤¹¡£0, 0 ¤Ï¡¢¶õ¤Î¥Æ¡¼¥Ö¥ë¤È²ò¼á¤µ¤ì¤Þ¤¹¡£ ¡ÊÌõ¼Ô(2)Äɵ¡§¼Ø¤Ǥ¹¤¬¡¢°ú¿ô¤ÎÌõ¤âÉÕ¤±¤Þ¤¹¡¨ -row => ¡ÊÎó¤Î¿ô¡Ë -cols => ¡Ê¹Ô¤Î¿ô¡Ë -border=> ¡ÊÏȤÎÂÀ¤µ¡Ë -align=> ¡Ê¥Æ¡¼¥Ö¥ë¼«ÂΤοåʿɽ¼¨°ÌÃÖ¡Ë -style=> ¡Ê¥¹¥¿¥¤¥ë¡Ë -class=> ¡Ê¥¯¥é¥¹¡Ë -bgcolor=> ¡ÊÇØ·Ê¿§¡Ë -width=> ¡Ê¥Æ¡¼¥Ö¥ë¤ÎÉý¡Ë -spacing=> ¡Ê¥»¥ëƱ»Î¤Î´Ö³Ö¡Ë -padding=> ¡Ê¥»¥ëÆâ¤Î;Çò¡Ë ¡Ë =back =head2 ¥Æ¡¼¥Ö¥ë¤Ë´Ø¤¹¤ë¥á¥½¥Ã¥É·² =over 4 =item setBorder([pixels]) ¥Æ¡¼¥Ö¥ëÏȤÎÂÀ¤µ¤òÀßÄꤷ¤Þ¤¹¡£ =item setWidth([pixels|percentofscreen]) ¥Æ¡¼¥Ö¥ë¤ÎÉý¤òÀßÄꤷ¤Þ¤¹¡£ $table->setWidth(500); ¤Þ¤¿¤Ï¡¢ $table->setWidth('100%'); =item setCellSpacing([pixels]) ¥Æ¡¼¥Ö¥ëÆ⥻¥ëƱ»Î¤Î´Ö³Ö¤òÀßÄꤷ¤Þ¤¹¡£ =item setCellPadding([pixels]) ¥»¥ëÆâ¤Î;Çò¤òÀßÄꤷ¤Þ¤¹¡£ =item setCaption("CaptionText" [, TOP|BOTTOM]) ¥Æ¡¼¥Ö¥ë¤Î¸«½Ð¤·¤òÀßÄꤷ¤Þ¤¹¡£ =item setBGColor([colorname|colortriplet]) ¥Æ¡¼¥Ö¥ë¤ÎÇØ·Ê¿§¤òÀßÄꤷ¤Þ¤¹¡£ =item autoGrow([1|true|on|anything|0|false|off|no|disable]) setCell ¤ÇÅϤµ¤ì¤¿¹Ô¿ô¤Þ¤¿¤ÏÎó¿ô¤¬¸½ºß¤Î¥Æ¡¼¥Ö¥ë¥µ¥¤¥º¤òĶ¤¨¤ë»þ¤Ë¡¢¥Æ¡¼¥Ö¥ë¤ò¼«Æ°Åª¤Ë³È¤²¤ëµ¡Ç½¤ò»ÈÍѤ¹¤ë¡Ê¥Ç¥Õ¥©¥ë¥È¡Ë¡¿»ÈÍѤ·¤Ê¤¤¤ÈÀÚ¤êÂؤ¨¤Þ¤¹¡£ =item setAlign ( [ LEFT , CENTER , RIGHT ] ) ¥Æ¡¼¥Ö¥ë¤Î¿åÊ¿Êý¸þɽ¼¨°ÌÃÖ¤òÀßÄꤷ¤Þ¤¹¡£ =item setRules ( [ ROWS , COLS , ALL, BOTH , GROUPS ] ) ¥Æ¡¼¥Ö¥ëÆâÏȤÎÍ̵¤òÀßÄꤷ¤Þ¤¹¡£ =item setStyle ( 'css style' ) ¥Æ¡¼¥Ö¥ë¤Î¥¹¥¿¥¤¥ë°À¤òÀßÄꤷ¤Þ¤¹¡£ =item setClass ( 'css class' ) ¥Æ¡¼¥Ö¥ë¤Î¥¯¥é¥¹Â°À¤òÀßÄꤷ¤Þ¤¹¡£ =item setAttr ( 'user attribute' ) ¥Æ¡¼¥Ö¥ë¤Ë¡¢¥æ¡¼¥¶¡¼ÄêµÁ¤Î°À¤òÀßÄꤷ¤Þ¤¹¡£HTML::Table ¤Ç̤¤ÀÄ󶡤µ¤ì¤Æ¤¤¤Ê¤¤Æüì¤Ê°À¤òÀßÄꤹ¤ë¤Î¤ËÍøÍѤǤ¤Þ¤¹¡£ =item sort ( [sort_col_num, sort_type, sort_order, num_rows_to_skip] ) ¤Þ¤¿¤Ï sort( -sort_col => sort_col_num, -sort_type => sort_type, -sort_order => sort_order, -skip_rows => num_rows_to_skip, -strip_html => strip_html, -strip_non_numeric => strip_non_numeric, -presort_func => €&filter_func ) sort_type ¤Ï¡¢ { ALPHA | NUMERIC }¤Ç»ØÄê¡Ê¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È½ç¡¿¿ô»ú½ç¡Ë¡¢ sort_order ¤Ï¡¢ { ASC | DESC }¤Ç»ØÄê¡Ê¾º½ç¡¿¹ß½ç¡Ë¡¢ strip_html ¤Ï¡¢ { 0 | 1 }¤Ç»ØÄê¡Ê¥Ç¥Õ¥©¥ë¥È¤Ï1¡Ë strip_non_numeric ¤Ï¡¢ { 0 | 1 },¡Ê¥Ç¥Õ¥©¥ë¥È¤Ï1¡Ë »ØÄꤵ¤ì¤¿¹Ô¤ÇÁ´¤Æ¤ÎÎó¤ò¥½¡¼¥È¤·¤Þ¤¹¡Ê¥ª¥×¥·¥ç¥ó¤È¤·¤Æ¡¢ num_rows_to_skip ¤Ç»ØÄꤵ¤ì¤¿¥Æ¡¼¥Ö¥ëÀèƬÎó¤Þ¤Ç¤Ï¥¹¥¥Ã¥×¤µ¤ì¤Þ¤¹¡Ë¡£ ¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤È¤·¤Æ¥½¡¼¥È¤Ç¤ÏHTML¥¿¥°¤È ¤ò̵»ë¤·¤Þ¤¹¤¬¡¢ strip_html ¥Ñ¥é¥á¡¼¥¿¡¼¤ò0¤Ë¤¹¤ë¤³¤È¤Ç¤³¤ÎÆ°ºî¤Ï̵¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£ ¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤È¤·¤Æ¿ôÃͤÎÂç¾®¤Ç¤Î¥½¡¼¥È¤Ï¿ô»ú°Ê³°¤Îʸ»ú¤ò̵»ë¤·¤Þ¤¹¤¬¡¢ strip_non_numeric ¥Ñ¥é¥á¡¼¥¿¡¼¤ò0¤Ë¤¹¤ë¤³¤È¤Ç¤³¤ÎÆ°ºî¤Ï̵¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£ ¥½¡¼¥ÈÁ°¤Ë´Ø¿ô¤òŬÍѤ¹¤ë¤³¤È¤¬¤Ç¤¡¢Î㤨¤ÐÆüÉÕÅù¤Ç¥½¡¼¥È¤¹¤ëÁ°¤Ë¥»¥ëÆâÍƤÎÁ°½èÍý¤ò¤¹¤ë¾ì¹ç¤ËÍøÍѤǤ¤Þ¤¹¡£ =item getTableRows ¥Æ¡¼¥Ö¥ë¤Î¹Ô¿ô¤òÊÖ¤·¤Þ¤¹¡£ =item getTableCols ¥Æ¡¼¥Ö¥ë¤ÎÎó¿ô¤òÊÖ¤·¤Þ¤¹¡£ =back =head2 ¥»¥ë¤Ë´Ø¤¹¤ë¥á¥½¥Ã¥É·² =over 4 =item setCell(row_num, col_num, "content") ¥»¥ë¤ÎÆâÍƤòÀßÄꤷ¤Þ¤¹¡£¤³¤Î¤³¤È¤Ë¤ÏǤ°Õ¤Îʸ»úÎó¡¢ getTable ¥á¥½¥Ã¥É·Ðͳ¤Ç¾¤Î¥Æ¡¼¥Ö¥ë¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¹¤é¤â¡¢²Äǽ¤Ç¤¹¡£»ØÄꤷ¤¿¹Ô¡¦Î󤬥ơ¼¥Ö¥ë¶³¦¤ò±Û¤¨¤Æ¤¤¤ë¾ì¹ç¡¢¼«Æ°Åª¤Ë¹Ô¡¦Î󤬳Ȥ²¤é¤ì¤Þ¤¹¡£ =item setCellAlign(row_num, col_num, [CENTER|RIGHT|LEFT]) ¥»¥ëÆâÍƤοåÊ¿°ÌÃÖ¤òÀßÄꤷ¤Þ¤¹¡£ =item setCellVAlign(row_num, col_num, [CENTER|TOP|BOTTOM|MIDDLE|BASELINE]) ¥»¥ëÆâÍƤοâľ°ÌÃÖ¤òÀßÄꤷ¤Þ¤¹¡£ =item setCellWidth(row_num, col_num, [pixels|percentoftable]) ¥»¥ë¤ÎÉý¤òÀßÄꤷ¤Þ¤¹¡£ =item setCellHeight(row_num, col_num, [pixels]) ¥»¥ë¤Î¹â¤µ¤òÀßÄꤷ¤Þ¤¹¡£ =item setCellHead(row_num, col_num) ¥»¥ë¤ò¸«½Ð¤·¹àÌܤˤ·¤Þ¤¹¡Ê¤¹¤Ê¤ï¤Á¡¢
Start
'; print $table->getTable; print 'End
'; °Ê²¼¤ÈƱÍͤνÐÎϤòÀ¸À®¤·¤Þ¤¹¡¨ $table = new HTML::Table(2, 2); print "Start
$tableEnd
"; =item print ¥Æ¡¼¥Ö¥ë¤ÎHTMLɽµ¤ò¡¢ STDOUT ¤Ë½ÐÎϤ·¤Þ¤¹¡£ =back =head1 ¥¯¥é¥¹ÊÑ¿ô =head1 HISTORY Îò»Ë This module was originally created in 1997 by Stacy Lacy and whose last version was uploaded to CPAN in 1998. The module was adopted in July 2000 by Anthony Peacock in order to distribute a revised version. This adoption took place without the explicit consent of Stacy Lacy as it proved impossible to contact them at the time. Explicit consent for the adoption has since been received. ¤³¤Î¥â¥¸¥å¡¼¥ë¤ÏºÇ½é Stacy Lacy ¤Ë¤è¤Ã¤Æ1997ǯ¤ËºîÀ®¤µ¤ì¡¢ºÇ¸å¤Î¥Ð¡¼¥¸¥ç¥ó¤Ï1998ǯ¤ËCPAN¤Ë¥¢¥Ã¥×¥í¡¼¥É¤µ¤ì¤Þ¤·¤¿¡£½¤Àµ¤µ¤ì¤¿¥Ð¡¼¥¸¥ç¥ó¤òÇÛÉÛ¤¹¤ë¤¿¤á¡¢¤³¤Î¥â¥¸¥å¡¼¥ë¤ò2000ǯ7·î¤Ë Anthony Peacockhe ¤¬°ú¤·Ñ¤®¤Þ¤·¤¿¡£¤³¤Î°ú·Ñ¤Ï Stacy Lacy ¤ÎÌÀ³Î¤ÊƱ°Õ̵¤·¤Ë¹Ô¤ï¤ì¤Þ¤·¤¿¡¢¤Ê¤¼¤Ê¤é¤½¤Î»þ¤ËÈà¤é¤ÈÏ¢Íí¤ò¤È¤ë¤³¤È¤¬ÉÔ²Äǽ¤Ç¤¢¤ë¤Èʬ¤«¤Ã¤¿¤«¤é¤Ç¤¹¡£¤³¤Î°ú·Ñ¤ËÂФ¹¤ëÌÀ³Î¤ÊƱ°Õ¤Ï¡¢Ì¤¤ÀÆÀ¤é¤ì¤Æ¤¤¤Þ¤»¤ó¡£ =head1 AUTHOR ºî¼Ô ¡Ê¸¶Ê¸¤Î¤Þ¤Þ¡Ë Anthony Peacock, a.peacock@chime.ucl.ac.uk Stacy Lacy (Original author) =head1 CONTRIBUTIONS ¶¨ÎÏ¼Ô ¡Ê¸¶Ê¸¤Î¤Þ¤Þ¡Ë Jay Flaherty, fty@mediapulse.com For ROW, COL & CELL HEAD methods. Modified the new method to allow hash of values. John Stumbles, john@uk.stumbles.org For autogrow behaviour of setCell, and allowing alignment specifications to be case insensitive Arno Teunisse, Arno.Teunisse@Simac.nl For the methods adding rules, styles and table alignment attributes. Ville Skytta, ville.skytta@iki.fi For general fixes Paul Vernaza, vernaza@stwing.upenn.edu For the setLast... methods David Link, dvlink@yahoo.com For the sort method Tommi Maekitalo, t.maekitalo@epgmbh.de For adding the 'head' parameter to the new method and for adding the initialisation from an array ref to the new method. =head1 COPYRIGHT Ãøºî¸¢ ¡Ê¸¶Ê¸¤Î¤Þ¤Þ¡Ë Copyright (c) 2000-2003 Anthony Peacock, CHIME. Copyright (c) 1997 Stacy Lacy This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO ´ØÏ¢¹àÌÜ perl(1), CGI(3) =head1 Translators into Japanese ËÝÌõ¼Ô 1) Previous ver.: oota (at itp.nec.co.jp) 2) Ver. 2.02: anahori (at users.sourceforge.jp) Japanized ?Perl?Resources? Project (http://sourceforge.jp/projects/perldocjp/) =cut