Okay, I have an issue I've worked on for a bit. Essentially I'm producing an excel spreadsheet using Spreadsheet::WriteExcel. Several columns include long text fields, and I need to break these into separate lines. I've split the text into lines using Text::Wrap. The formula bar shows separate lines, but the cell itself doesn't unless I go in and select it and then tab out of it. It appears all as one line, completely ignoring the newline.

Here's a minimal code sample (certain variable names have been changed to protect those not provably guilty):
$Text::Wrap::columns = 35; my $q = wrap ('','',$qa{$isin}) if defined $qa{$_}; my $i = wrap ('','',$ib{$isin}) if defined $ib{$isin}; my $j = wrap ('','',$jk{$isin}) if defined $jk{$isin}; my $d = wrap ('','',$da{$isin}) if defined $da{$isin}; push @data, [$q, $i, $j, $d]; $row++; ## $dd is a "Delta_Days" value from Date::Calc $worksheet->set_row($row-1, undef, $new) if $dd <= 7; $worksheet->set_row($row-1, 60, $notnew) if $dd > 7 and $dd <=14; $worksheet->set_row($row-1, 60, $stale) if $dd > 14; $worksheet->write('A'.$row, \@data);
Does anyone know how to get these values to come out on separate lines, when first opening the spreadsheet? I'm just about ready to go and write this whole thing in html, then slap an xls extension on it -- except that file sizes seem to balloon ridiculously when that's done.

In reply to Excel single cell line breaks by SamCG

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.