in reply to parsing excel with 5 levels of indentations

G'day leha,

Welcome to the monastery.

Your main problem is that you're not declaring $format. The code you want would look something like this:

my $format = ... ... $format->{Indent} ...

Without having a better idea of your code, I can't be more specific than that.

You appear to making reference to code in the Spreadsheet::ParseExcel::Format documentation: it doesn't contain any so perhaps you could clarify that.

For any follow-up questions, please use the guidelines in "How do I post a question effectively?".

-- Ken

Replies are listed 'Best First'.
Re^2: parsing excel with 5 levels of indentations
by leha (Novice) on Oct 03, 2013 at 08:49 UTC
    i know about declaring $format
    i just don't know how :\
    my code is like this:
    open(F,">$s{path}/perl.output"); my $parser = Spreadsheet::ParseExcel->new(); my $workbook = $parser->parse("$s{path}/$s{file}"); if ( !defined $workbook ) {die $parser->error(), ".\n"} for my $worksheet ( $workbook->worksheets() ) { my ( $row_min, $row_max ) = $worksheet->row_range(); my ( $col_min, $col_max ) = $worksheet->col_range(); for my $row ( $row_min .. $row_max ) { for my $col ( $col_min .. $col_max ) { my $cell = $worksheet->get_cell( $row, $col ); next unless $cell; print "Row, Col = ($row, $col) Value = ", $cell->value(),"\n"; } } } close F;
    and here i need to put indent somewhere somehow
    ParseExcel.pm have this explanation:
    The C<Spreadsheet::ParseExcel::Format> class has the following propert +ies: =head2 Format properties $format->{Font} $format->{AlignH} $format->{AlignV} $format->{Indent} $format->{Wrap} $format->{Shrink} $format->{Rotate} $format->{JustLast} $format->{ReadDir} $format->{BdrStyle} $format->{BdrColor} $format->{BdrDiag} $format->{Fill} $format->{Lock} $format->{Hidden} $format->{Style} These properties are generally only of interest to advanced users. Cas +ual users can skip this section.
    not much so i still seeking wisdom about parsing indentations levels from xls

      my $cell = $worksheet->get_cell( $row, $col );

      ...

      and here i need to put indent somewhere somehow

      I haven't tried any of this, but continuing with the documentation of Spreadsheet::ParseExcel::Cell you should be able to test what my $format = $cell->get_format(); print $format->{Indent}, "\n"; is returning and build on that information.

      Cheers, Sören

      Créateur des bugs mobiles - let loose once, run everywhere.
      (hooked on the Perl Programming language)

        yes, McNamara gave me the same solution
        and it works
        thanks