spread sheet issues | check and learn

Discussion in 'PHP' started by aniltc, Jun 7, 2010.

  1. #1
    hi all
    how can I get vertical text in Excel as shown in the attached image using pear spreadsheet package.

    thanks
     

    Attached Files:

    aniltc, Jun 7, 2010 IP
  2. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #2
    gapz101, Jun 7, 2010 IP
  3. aniltc

    aniltc Peon

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    But I need to display in Excel using spreadsheet package.I tried pear commands in the spreadsheet .but it doesn't get in vertical style
     
    aniltc, Jun 7, 2010 IP
  4. aniltc

    aniltc Peon

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I tried the below code but text is not getting in vertical style in Excel.please help me

    
    <?php 
    // Include PEAR::Spreadsheet_Excel_Writer 
    require_once "Writer.php"; 
    
    // Create an instance 
    $xls =& new Spreadsheet_Excel_Writer(); 
    $sheetTitleFormat =& $xls->addFormat(array('bold'=>1,
      'size'=>10));
    //$sheetTitleFormat=& $xls->addFormat(array('vAlign'=>'vcenter'));
    
    // Send HTTP headers to tell the browser what's coming 
    $xls->send("test.xls"); 
    
    // Add a worksheet to the file, returning an object to add data to 
    $sheet =& $xls->addWorksheet('Binary Count'); 
     $xls->addFormat(array('vAlign'=>'vcenter'));
    $sheet->write(0,0,'Name',$sheetTitleFormat); 
    $sheet->write(0,1,'Address',$sheetTitleFormat);
    $sheet->write(0,2,'Town',$sheetTitleFormat); 
    $sheet->write(0,3,'City',$sheetTitleFormat); 
    
    $col=0;
    $row=2;
    // Write some numbers 
    for ( $i=2;$i<11;$i++ ) { 
    if($col==4)
    {
    $col=0;
    $row= $row+1;
    }
    
     // Use PHP's decbin() function to convert integer to binary 
     $sheet->write($row,$col,decbin($i)); 
    $col=$col+1;
    } 
    
    // Finish the spreadsheet, dumping it to the browser 
    $xls->close(); 
    
    
    ?>
    
    
    
    
    PHP:
     
    aniltc, Jun 7, 2010 IP