Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Perl: Общие вопросы > Как объединить 2 ячейки?


Автор: igorold 14.2.2007, 08:52
Создаю в скрипте файл в формате XLS, использую модуль Spreadsheet::WriteExcel,
но не нашел как объединить несколько ячеек, чтобы записать туда текст.
Читал man ... не узрел ... есть у кого опыт  smile 

Автор: nitr 14.2.2007, 11:58
Цитата

merge_range($first_row, $first_col, $last_row, $last_col, $token, $format, $encoding)


Добавлено @ 11:59 
Цитата

merge_range($first_row, $first_col, $last_row, $last_col, $token, $format, $encoding)

Merging cells can be achieved by setting the merge property of a Format object, see "CELL FORMATTING". However, this only allows simple Excel5 style horizontal merging which Excel refers to as "center across selection".

The merge_range() method allows you to do Excel97+ style formatting where the cells can contain other types of alignment in addition to the merging:
    my $format = $workbook->add_format(
                                        border  => 6,
                                        valign  => 'vcenter',
                                        align   => 'center',
                                      );

    $worksheet->merge_range('B3:D4', 'Vertical and horizontal', $format);

WARNING. The format object that is used with a merge_range() method call is marked internally as being associated with a merged range. It is a fatal error to use a merged format in a non-merged cell. Instead you should use separate formats for merged and non-merged cells. This restriction will be removed in a future release.

The $encoding parameter is optional, see below.


В общем в доке ;)

Автор: igorold 14.2.2007, 12:54
спасибо, пропустил я этот текст в мане ... заработало ...  smile 

Автор: nitr 14.2.2007, 13:18
igorold, всегда рады помочь, обращайтесь ещё.
Думаю тут просто с английским надо было ;)
Я работал с модулем, но нравится который в Excel(XML) именно XML, только нюанс smile там меньше возможностей, хотя тут уже приводил некоторые примеры доработок ;)

з.ы.: пожалуйста

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)