perl操作excel使用Spreadsheet::WriteExcel::Format的函数库
发布时间:2020-12-15 23:55:20 所属栏目:大数据 来源:网络整理
导读:? ?$contentStyle-set_size( 8 ); ? ? $contentStyle-set_bold(); ? ? ? ? ? #设置字体为粗体 ? ? $contentStyle-set_align( 'center' );#设置单元格居中 ? ? $contentStyle-set_text_wrap(); ? ? ?#是否回车换行 ? ? $contentStyle-set_color('red'); ? ? #
? ?$contentStyle->set_size( 8 );
? ? $contentStyle->set_bold(); ? ? ? ? ? #设置字体为粗体 ? ? $contentStyle->set_align( 'center' );#设置单元格居中 ? ? $contentStyle->set_text_wrap(); ? ? ?#是否回车换行 ? ? $contentStyle->set_color('red'); ? ? #设置单元格前景色为红色 f_row = workbook.add_format(:color=>"black",:bold=>0,:italic=>false,:text_wrap=>true) SpreadSheet是支持单元格合并的,? http://rubyforge.org/forum/message.php?msg_id=64873 ? 把要合并的单元格的格式属性设置为:align => :merge就行了 http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel/lib/Spreadsheet/WriteExcel/Examples.pm https://metacpan.org/release/Spreadsheet-WriteExcel Format methods and Format propertiesThe following table shows the Excel format categories,the formatting properties that can be applied and the equivalent object method: Category Description Property Method Name -------- ----------- -------- ----------- Font Font type font set_font() Font size size set_size() Font color color set_color() Bold bold set_bold() Italic italic set_italic() Underline underline set_underline() Strikeout font_strikeout set_font_strikeout() Super/Subscript font_script set_font_script() Outline font_outline set_font_outline() Shadow font_shadow set_font_shadow() Number Numeric format num_format set_num_format() Protection Lock cells locked set_locked() Hide formulas hidden set_hidden() Alignment Horizontal align align set_align() Vertical align valign set_align() Rotation rotation set_rotation() Text wrap text_wrap set_text_wrap() Justify last text_justlast set_text_justlast() Center across center_across set_center_across() Indentation indent set_indent() Shrink to fit shrink set_shrink() Pattern Cell pattern pattern set_pattern() Background color bg_color set_bg_color() Foreground color fg_color set_fg_color() Border Cell border border set_border() Bottom border bottom set_bottom() Top border top set_top() Left border left set_left() Right border right set_right() Border color border_color set_border_color() Bottom color bottom_color set_bottom_color() Top color top_color set_top_color() Left color left_color set_left_color() Right color right_color set_right_color() http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.37/lib/Spreadsheet/WriteExcel.pm#CELL_FORMATTING (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |