<?php
session_start();
include("../../php_crud/my_class.php");
$obj = new my_class();




error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

require_once('../../asset/custom/PHPExcel_class/PHPExcel.php');
require_once('../../asset/custom/PHPExcel_class/PHPExcel/Calculation.php');
require_once('../../asset/custom/PHPExcel_class/PHPExcel/Cell.php');
//================================================================
extract($_POST);

echo $department_id;
echo  $section_id;
echo  $exam_term_id;
echo $exam_session;

$base_url= $_SESSION["BASE_URL"];

$det_in = $obj->Details_By_Cond("_int_institute_setup_vw","section_id='$section_id'");

$tch_id = $obj->Details_By_Cond("_r_class_routine","_section_id='$section_id' AND _teacher_type='CT' AND _teacher_id!='0' GROUP BY _teacher_type");
$teacher_id =  $tch_id['_teacher_id'];

$tch_det = $obj->Details_By_Cond("_pf_emp_personal_info","_id='$teacher_id'");

$total_row = $obj->subject_select_student_rows("sl._section_id='$section_id' AND sl._session='$exam_session'");



/* $det_in = $obj->Details_By_Cond("_int_institute_setup_vw","section_id='$section_id'");
extract($det_in);
$term_name = $obj->Details_By_Cond("_int_exam_term","_id='$exam_term_id'");
extract($term_name);
$sub_name = $obj->Details_By_Cond("_int_subject","_id='$subject_id'");
extract($sub_name);

$subject_det = $obj->Details_By_Cond("_int_subject","_id='$subject_id'");
$col_name = $subject_det['_subjective_asign_mark'];
$ob_name = $subject_det['_objective_asign_mark']; */



//if (is_file('subs_Excel_result/Subject_mark_entry_'.$det_in['class'].'_'.$det_in['department'].'_'.$det_in['student_type'].'_'.$det_in['section'].'_'.$sub_name['_subject_full_name'].'.xlsx')) unlink('subs_Excel_result/Subject_mark_entry_'.$det_in['class'].'_'.$det_in['department'].'_'.$det_in['student_type'].'_'.$det_in['section'].'_'.$sub_name['_subject_full_name'].'.xlsx');
if (is_file('subs_Excel_result/Subject_mark_entry_.xlsx')) unlink('subs_Excel_result/Subject_mark_entry_.xlsx');

//=======================================================================
$styleTitleArray = array(
    'font' => array(
        'bold' => true,
        'color' => array('rgb' => '000000'),
        'size' => 11
        // 'name'  => 'Verdana'
    ));

$stylesubTitleArray = array(
    'font' => array(
        'bold' => true,
        'color' => array('rgb' => '000000'),
        'size' => 10
        //  'name'  => 'Verdana'
    ));
	
	/* 
	$stylesubTitleArray->getStyle('A1')->applyFromArray(
    array(
        'fill' => array(
            'type' => PHPExcel_Style_Fill::FILL_SOLID,
            'color' => array('rgb' => 'FF0000')
        )
    )
    ); */




//========================================================================================
/* if($det_in['shift']!="-"){$title = '  SHIFT '.$det_in['shift'].' / ';}
if($det_in['medium']!="-"){$title .= '  MEDIUM :'.$det_in['medium'].' / ';}
if($det_in['class']!="-"){$title .= '  CLASS :'.$det_in['class'].' / ';}
if($det_in['department']!="-"){$title .= '  DEPARTMENT :'.$det_in['department'].' / ';}
if($det_in['student_type']!="-"){$title .= '  STUDENT TYPE :'.$det_in['student_type'].' / ';}
if($det_in['section']!="-"){$title .= '  SECTION :'.$det_in['section'];}


if($subject_det['_subjective_asign_mark'])
{$subj = 'Assign='.$subject_det['_subjective_asign_mark'].'   '.'Pass='.$subject_det['_subjective_pass_mark']; }
else{$subj = '-';}

if($subject_det['_objective_asign_mark'])
{$objeb = 'Assign='.$subject_det['_objective_asign_mark'].'  '.'Pass='.$subject_det['_objective_pass_mark']; }
else{$obj = '-';}

if($subject_det['_ct_asign_mark'])
{$ct = 'Assign='.$subject_det['_ct_asign_mark'].' '.'Pass='.$subject_det['_ct_pass_mark']; }
else{$ct = '-';}

if($subject_det['_practical_asign_mark'])
{$pct = 'Assign='.$subject_det['_practical_asign_mark'].'  '.'Pass='.$subject_det['_practical_pass_mark']; }
else{$pct =  '-';}

if($subject_det['_spot_asign_mark'])
{$spt =  'Assign='.$subject_det['_spot_asign_mark'].'</br>'.'Pass='.$subject_det['_spot_pass_mark']; }
else{$spt =   '-';}
if($subject_det['_subjective_asign_mark']){echo 'Assign='.$subject_det['_subjective_asign_mark'].'</br>'.'Pass='.$subject_det['_subjective_pass_mark']; }else{echo '-';}

 */
//==================================================================


$objPHPExcel = new PHPExcel();


$sheet = $objPHPExcel->getActiveSheet();
//->getActiveSheet();
//$sheet->cellColor('B4', 'F28A8C');
// For Page Title
//$sheet->setCellValueByColumnAndRow(0, 1, $title.'\n'.$term_name['_term_name']);
//======================

//$nline = 'Subject:'.$sub_name['_subject_full_name'].'         Exam:'.$term_name['_term_name'];
 //->setValue($title.$lfcr.$nline);
$lfcr = "\n";
$objPHPExcel->getActiveSheet()
    ->getCell('A1')
   ->setValue("ddhsdsdsd");
$objPHPExcel->getActiveSheet()
    ->getStyle('A1')
    ->getAlignment()
    ->setWrapText(true);


/* $objPHPExcel->getActiveSheet()->setCellValue('H5', "Hello\nWorld");
$objPHPExcel->getActiveSheet()->getStyle('H5')->getAlignment()->setWrapText(true);
 */
//============merge cells==============
$sheet->mergeCells('A1:AL2');
$sheet->mergeCells('A3:AL3');
$sheet->mergeCells('A4:A5');
$sheet->mergeCells('B4:B5');
$sheet->mergeCells('C4:C5');
$sheet->mergeCells('D4:D5');

$sheet->getStyle('A1:AL2')->applyFromArray($styleTitleArray)
    ->getAlignment()
    ->applyFromArray(array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,))
    ->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
	

        $sheet->getStyle('A1:AL2')
        ->getFill()
        ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
        ->getStartColor()
        ->setRGB('bfff00');
		$sheet->getStyle('A3:AL3')
        ->getFill()
        ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
        ->getStartColor()
        ->setRGB('0fff00');
		
		 $sheet->getStyle('A4:AL5')
        ->getFill()
        ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
        ->getStartColor()
        ->setRGB('ffbf00');


// For Content Column Title
//foreach($obj->View_std_trabulation("sub_s._section_id='$section_id' AND sub_s._session='$exam_session' AND sub_s._status='A' GROUP BY sub_s._main_sub_ids") as $value){
foreach($obj->View_std_trabulation("sub_s._section_id='$section_id' AND sub_s._session='$exam_session' AND sub_s._status='A' ORDER BY std._section_roll") as $value){
					
$sheet->getStyle('A3:P4')->applyFromArray($stylesubTitleArray);
// write header
$sheet->getCell('A4')->setValue('Serial');
$sheet->getCell('B4')->setValue('ID');
$sheet->getCell('C4')->setValue('Name');
$sheet->getCell('D4')->setValue('Roll');

//================
$row = 4;
$row2 = 5;
//$col = 4;
$col = 4;

foreach($obj->View_All_By_Cond("_int_subject","_id IN (".$value['_main_cmb_sub_ids'].")") AS $value_m){
				if($value_m['_subjective_asign_mark']!='0'){$m_val1 ='1';}else{$m_val1 ='0';}
				if($value_m['_objective_asign_mark']!='0'){$m_val2 ='1';}else{$m_val2 ='0';}
				if($value_m['_practical_asign_mark']!='0'){$m_val3 ='1';}else{$m_val3 ='0';}
				if($value_m['_ct_asign_mark']!='0'){$m_val4 ='1';}else{$m_val4 ='0';}
				if($value_m['_spot_asign_mark']!='0'){$m_val5 ='1';}else{$m_val5 ='0';}
				$total_m_val = $m_val1+$m_val2+$m_val3+$m_val4+$m_val5;
				//==
				$m=$col;
				$m1=$col+1;
				$m2=$col+2;
				$m3=$col+3;
				$m3=$col+4;
				//=============
				if($value_m['_subjective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'sub');} 
				else if($value_m['_objective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'Obj');} 
				else if($value_m['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'PC');} 
				else if($value_m['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'CT');} 
				else if($value_m['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'ST');} 
				//=============
				if($value_m['_objective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'Obj');  } 
				else if($value_m['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'PC');} 
				else if($value_m['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'CT');} 
				else if($value_m['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'ST');} 
				//=============
				if($value_m['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'PC' ); } 
				else if($value_m['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'CT');} 
				else if($value_m['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'ST');} 
				
				
				//=============
				if($value_m['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m3, $row2, 'CT' ); } 
				else if($value_m['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m3, $row2, 'ST');} 
				
				
				if($value_m['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m4, $row2, 'ST');  }  
				
				
				//===========
				
				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value_m['_subject_full_name']);
						$col=$col+$total_m_val;
						//$col++;
						//$total_m_val++;
					
					
				
						
				
			
				//$sheet->mergeCells("E".$total_m_val.":I".$total_m_val);
              // $sheet->getCell('E4')->setValue($value_m['_subject_full_name']);
}
//foreach($obj->View_All_By_Cond("_int_subject","_id IN (".$value['_3rd_sub_id'].")") AS $value_3){
foreach($obj->View_All_By_Cond("_int_subject","_id IN (".$value['_3rd_sub_id'].")") AS $value_3){
				if($value_3['_subjective_asign_mark']!='0'){$m3_val1 ='1';}else{$m3_val1 ='0';}
				if($value_3['_objective_asign_mark']!='0'){$m3_val2 ='1';}else{$m3_val2 ='0';}
				if($value_3['_practical_asign_mark']!='0'){$m3_val3 ='1';}else{$m3_val3 ='0';}
				if($value_3['_ct_asign_mark']!='0'){$m3_val4 ='1';}else{$m3_val4 ='0';}
				if($value_3['_spot_asign_mark']!='0'){$m3_val5 ='1';}else{$m3_val5 ='0';}
				$total_m3_val = $m3_val1+$m3_val2+$m3_val3+$m3_val4+$m3_val5;
				//==================
				$m=$col;
				$m1=$col+1;
				$m2=$col+2;
				$m3=$col+3;
				$m3=$col+4;
				//=============
				if($value_3['_subjective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'sub');} 
				else if($value_3['_objective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'Obj');} 
				else if($value_3['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'PC');} 
				else if($value_3['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'CT');} 
				else if($value_3['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'ST');} 
				//=============
				if($value_3['_objective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'Obj');  } 
				else if($value_3['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'PC');} 
				else if($value_3['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'CT');} 
				else if($value_3['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'ST');} 
				//=============
				if($value_3['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'PC' ); } 
				else if($value_3['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'CT');} 
				else if($value_3['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'ST');} 
				
				
				//=============
				if($value_3['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m3, $row2, 'CT' ); } 
				else if($value_3['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m3, $row2, 'ST');} 
				
				
				if($value_3['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m4, $row2, 'ST');  }  
				
				
				
				//==================
				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value_3['_subject_full_name']);
				$col=$col+$total_m3_val;
				
}

foreach($obj->View_All_By_Cond("_int_subject","_id IN (".$value['_4th_sub_id'].")") AS $value_4){
				if($value_4['_subjective_asign_mark']!='0'){$m4_val1 ='1';}else{$m4_val1 ='0';}
				if($value_4['_objective_asign_mark']!='0'){$m4_val2 ='1';}else{$m4_val2 ='0';}
				if($value_4['_practical_asign_mark']!='0'){$m4_val3 ='1';}else{$m4_val3 ='0';}
				if($value_4['_ct_asign_mark']!='0'){$m4_val4 ='1';}else{$m4_val4 ='0';}
				if($value_4['_spot_asign_mark']!='0'){$m4_val5 ='1';}else{$m4_val5 ='0';}
				$total_m4_val = $m4_val1+$m4_val2+$m4_val3+$m4_val4+$m4_val5;
				
				
				//==================
				$m=$col;
				$m1=$col+1;
				$m2=$col+2;
				$m3=$col+3;
				$m3=$col+4;
				//=============
				if($value_4['_subjective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'sub');} 
				else if($value_4['_objective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'Obj');} 
				else if($value_4['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'PC');} 
				else if($value_4['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'CT');} 
				else if($value_4['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m, $row2, 'ST');} 
				//=============
				if($value_4['_objective_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'Obj');  } 
				else if($value_4['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'PC');} 
				else if($value_4['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'CT');} 
				else if($value_4['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m1, $row2, 'ST');} 
				//=============
				if($value_4['_practical_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'PC' ); } 
				else if($value_4['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'CT');} 
				else if($value_4['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m2, $row2, 'ST');} 
				
				
				//=============
				if($value_4['_ct_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m3, $row2, 'CT' ); } 
				else if($value_4['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m3, $row2, 'ST');} 
				
				
				if($value_4['_spot_asign_mark']!='0'){$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($m4, $row2, 'ST');  }  
				
				
				
				//==================
				
				
				
				$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value_4['_subject_full_name']);
				$col=$col+$total_m4_val;
}

//=================

				



//$row++;
/* 
$column = "A";
$row = 1;
foreach($array_to_print as $details)
{

$column = getColumn($column); // product next column B
$Excelobj->getActiveSheet()->setCellValue($column.$row, $details);
$column = getColumn($column);// product next column C
$Excelobj->setActiveSheetIndex(0)->mergeCells($from_cell.':'.$to_cell);// now this will  work till A-ZZ column in excel
} */

//==============

//$sheet->getCell('E4')->setValue('Subjective');
//$sheet->getCell('E4')->setValue($subj);
//$sheet->getCell('F4')->setValue('Objective');
//$sheet->getCell('F4')->setValue($objeb);
//$sheet->getCell('G4')->setValue('Class Test');
//$sheet->getCell('G4')->setValue($ct);
//$sheet->getCell('H4')->setValue('Practical');

//$sheet->getCell('H4')->setValue($pct);
//$sheet->getCell('I4')->setValue('Spot Test');
//$sheet->getCell('I4')->setValue($spt);

/* $column = 'A';
$lastRow = $worksheet->getHighestRow();
for ($row = 1; $row <= $lastRow; $row++) {
  $cell = $worksheet->getCell($column.$row);
    //  Do what you want with the cell
	$sheet->getCell('A4')->setValue('Serial');
}
 */

}
/* $char = 74;
$NumberOfRows=0;
$sheet->getCell(chr($char).'5')->setValue($col_name);
} */
/* $subject_det = $obj->Details_By_Cond("_int_subject","_id='$subject_id'");
$col_name = $subject_det['_subjective_asign_mark'];
$ob_name = $subject_det['_objective_asign_mark']; */



// Main work
$data = array();

$i='1';
	foreach($obj->View_std_trabulation("sub_s._section_id='$section_id' AND sub_s._session='$exam_session' AND sub_s._status='A' ORDER BY std._section_roll") as $value){
	//$i++;
	
	
	extract($value);
	
	 $data[] = array(
	'Serial' => $i++,
	'Id' => $value['_uniq_id'],
	'Name' => $value['_full_name'],
	'Roll' => $value['_section_roll'],
	'' => '',
	'Late Time' => '');
	}





// Format cell width According to content
$cellIterator = $sheet->getRowIterator()->current()->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(true);


// Autosize on manual single cell
// Set AutoSize for name and email fields
//$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
//$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
//$data="sdjshdshdjshdjsdhj";

// Fill worksheet from values in array
$objPHPExcel->getActiveSheet()->fromArray($data, null, 'A6');
$rows = count($data)+5; 

//$objPHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(12);
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(40);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
// Formating Left Alignment for printing, cell A4 to last, B4 to last and D4 to last 


/*  $style = array(
        'alignment' => array(
            'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
        )
    );

    $sheet->getDefaultStyle()->applyFromArray($style);
 */

//==========================
/* $objPHPExcel->getActiveSheet()->getStyle('A3:A'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);  
				
$objPHPExcel->getActiveSheet()->getStyle('B3:B'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);  

$objPHPExcel->getActiveSheet()->getStyle('C3:C'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); 
$objPHPExcel->getActiveSheet()->getStyle('D3:D'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('E3:E'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('F3:F'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('G3:G'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('H3:H'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('I3:I'.$rows)
                 ->getAlignment()
    			->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); 	 */			
				
// Rename worksheet
//$objPHPExcel->getActiveSheet()->setTitle('Section ' . ucwords($section_name));
$objPHPExcel->getActiveSheet()->setTitle('Section ' . ucwords("dfdfdff"));







// Save Excel 2007 file
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');

//$objWriter->save('subs_Excel_result/Subject_mark_entry_'.$det_in['class'].'_'.$det_in['department'].'_'.$det_in['student_type'].'_'.$det_in['section'].'_'.$sub_name['_subject_full_name'].'.xlsx');
$objWriter->save('subs_Excel_result/Subject_mark_entry_.xlsx');

echo 'Subject_mark_entry_.xlsx' ;

?>