Spreadsheet::ParseExcel::SaveParser::Workbook

TriggerTek Logo
abcdefghijklmnopqrstuvwxyz_
Spreadsheet::ParseExcUserSConSpreadsheet::ParseExcel::SaveParser::Workbook(3)



	    PageStart	 => $oWkS->{PageStart},		   # Page number for start
	    UsePage	 => $oWkS->{UsePage},		   # Use own start page number
	    NoColor	 => $oWkS->{NoColor},		    # Print in blcak-white
	    Draft	 => $oWkS->{Draft},		    # Print in draft mode
	    Notes	 => $oWkS->{Notes},		    # Print notes
	    LeftToRight	 => $oWkS->{LeftToRight},	    # Left to Right
=cut

	       for (
		   my $iC = $oWkS->{MinCol} ;
		   defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
		   $iC++
		 )
	       {
		   if ( defined $oWkS->{ColWidth}[$iC] ) {
		       if ( $oWkS->{ColWidth}[$iC] > 0 ) {
			   $oWrS->set_column( $iC, $iC, $oWkS->{ColWidth}[$iC] )
			     ;	  #, undef, 1) ;
		       }
		       else {
			   $oWrS->set_column( $iC, $iC, 0, undef, 1 );
		       }
		   }
	       }
	       for (
		   my $iR = $oWkS->{MinRow} ;
		   defined $oWkS->{MaxRow} && $iR <= $oWkS->{MaxRow} ;
		   $iR++
		 )
	       {
		   $oWrS->set_row( $iR, $oWkS->{RowHeight}[$iR] );
		   for (
		       my $iC = $oWkS->{MinCol} ;
		       defined $oWkS->{MaxCol} && $iC <= $oWkS->{MaxCol} ;
		       $iC++
		     )
		   {

		       my $oWkC = $oWkS->{Cells}[$iR][$iC];
		       if ($oWkC) {
			   if ( $oWkC->{Merged} ) {
			       my $oFmtN = $oWrEx->addformat();
			       $oFmtN->copy( $hFmt{ $oWkC->{FormatNo} } );
			       $oFmtN->set_merge(1);
			       $oWrS->write(
				   $iR,
				   $iC,
				   $oBook->{FmtClass}
				     ->TextFmt( $oWkC->{Val}, $oWkC->{Code} ),
				   $oFmtN
			       );
			   }
			   else {
			       $oWrS->write(
				   $iR,
				   $iC,
				   $oBook->{FmtClass}
				     ->TextFmt( $oWkC->{Val}, $oWkC->{Code} ),
				   $hFmt{ $oWkC->{FormatNo} }
			       );
			   }
		       }
		   }
	       }
	   }
	   return $oWrEx;
       }

       #------------------------------------------------------------------------------
       # AddWorksheet (for Spreadsheet::ParseExcel::SaveParser::Workbook)
       #------------------------------------------------------------------------------
       sub AddWorksheet {
	   my ( $oBook, $sName, %hAttr ) = @_;
	   $oBook->AddFormat if ( $#{ $oBook->{Format} } < 0 );
	   $hAttr{Name}		││= $sName;
	   $hAttr{LeftMargin}	││= 0;
	   $hAttr{RightMargin}	││= 0;
	   $hAttr{TopMargin}	││= 0;
	   $hAttr{BottomMargin} ││= 0;
	   $hAttr{HeaderMargin} ││= 0;
	   $hAttr{FooterMargin} ││= 0;
	   $hAttr{FitWidth}	││= 0;
	   $hAttr{FitHeight}	││= 0;
	   $hAttr{PrintGrid}	││= 0;
	   my $oWkS = Spreadsheet::ParseExcel::SaveParser::Work-
       sheet->new(%hAttr);
	   $oWkS->{_Book}			       = $oBook;
	   $oWkS->{_SheetNo}			       = $oBook->{Sheet-
       Count};
	   $oBook->{Worksheet}[ $oBook->{SheetCount} ] = $oWkS;
	   $oBook->{SheetCount}++;
	   return $oWkS;    #$oBook->{SheetCount} - 1; }

       #------------------------------------------------------------------------------
       # AddFont (for Spreadsheet::ParseExcel::SaveParser::Workbook)
       #------------------------------------------------------------------------------
       sub AddFont {
	   my ( $oBook, %hAttr ) = @_;
	   $hAttr{Name}	     ││= ’Arial’;
	   $hAttr{Height}    ││= 10;
	   $hAttr{Bold}	     ││= 0;
	   $hAttr{Italic}    ││= 0;
	   $hAttr{Underline} ││= 0;
	   $hAttr{Strikeout} ││= 0;
	   $hAttr{Super}     ││= 0;
	   push @{ $oBook->{Font} }, Spreadsheet::ParseEx-
       cel::Font->new(%hAttr);
	   return $#{ $oBook->{Font} }; }

       #------------------------------------------------------------------------------
       # AddFormat (for Spreadsheet::ParseExcel::SaveParser::Workbook)
       #------------------------------------------------------------------------------
       sub AddFormat {
	   my ( $oBook, %hAttr ) = @_;
	   $hAttr{Fill}	    ││= [ 0, 0, 0 ];
	   $hAttr{BdrStyle} ││= [ 0, 0, 0, 0 ];
	   $hAttr{BdrColor} ││= [ 0, 0, 0, 0 ];
	   $hAttr{AlignH}    ││= 0;
	   $hAttr{AlignV}    ││= 0;
	   $hAttr{Rotate}    ││= 0;
	   $hAttr{Landscape} ││= 0;
	   $hAttr{FmtIdx}    ││= 0;

	   if ( !defined( $hAttr{Font} ) ) {
	       my $oFont;
	       if ( defined $hAttr{FontNo} ) {
		   $oFont = $oBook->{Font}[ $hAttr{FontNo} ];
	       }
	       elsif ( !defined $oFont ) {
		   if ( $#{ $oBook->{Font} } >= 0 ) {
		       $oFont = $oBook->{Font}[0];
		   }
		   else {
		       my $iNo = $oBook->AddFont;
		       $oFont = $oBook->{Font}[$iNo];
		   }
	       }
	       $hAttr{Font} = $oFont;
	   }
	   push @{ $oBook->{Format} }, Spreadsheet::ParseExcel::Format->new(%hAttr);
	   return $#{ $oBook->{Format} };
       }

       #------------------------------------------------------------------------------
       # AddCell (for Spreadsheet::ParseExcel::SaveParser::Workbook)
       #------------------------------------------------------------------------------
       sub AddCell {
	   my ( $oBook, $iSheet, $iR, $iC, $sVal, $oCell, $sCode ) = @_;
	   my %rhKey;
	   $oCell ││= 0;
	   my $iFmt =
	     ( UNIVERSAL::isa( $oCell, ’Spreadsheet::ParseExcel::Cell’ ) )
	     ? $oCell->{FormatNo}
	     : ( ref($oCell) ) ? 0
	     :			 $oCell + 0;
	   $rhKey{FormatNo}    = $iFmt;
	   $rhKey{Format}      = $oBook->{Format}[$iFmt];
	   $rhKey{Val}	       = $sVal;
	   $rhKey{Code}	       = $sCode ││ ’_native_’;
	   $oBook->{_CurSheet} = $iSheet;
	   my $oNewCell =
	     Spreadsheet::ParseExcel::_NewCell( $oBook, $iR, $iC, %rhKey );
	   Spreadsheet::ParseExcel::_SetDimension( $oBook, $iR, $iC, $iC );
	   return $oNewCell; }

       1;

       __END__

NAME
       Spreadsheet::ParseExcel::SaveParser::Workbook - A class for SaveParser
       Workbooks.

SYNOPSIS
       See the documentation for Spreadsheet::ParseExcel.

DESCRIPTION
       This module is used in conjunction with Spreadsheet::ParseExcel. See
       the documentation for Spreadsheet::ParseExcel.

AUTHOR
       Maintainer 0.40+: John McNamara jmcnamara@cpan.org

       Maintainer 0.27-0.33: Gabor Szabo szabgab@cpan.org

       Original author: Kawai Takanori kwitknr@cpan.org

COPYRIGHT
       Copyright (c) 2009 John McNamara

       Copyright (c) 2006-2008 Gabor Szabo

       Copyright (c) 2000-2006 Kawai Takanori

       All rights reserved.

       You may distribute under the terms of either the GNU General Public
       License or the Artistic License, as specified in the Perl README file.



perl v5.8.8		     Spreadsheet::ParseExcel::SaveParser::Workbook(3)