PHP Classes

File: insertValues.php

Recommend this page to a friend!
  Classes of Prashant Bhavsar   Create Multiple spreadsheet xls file   insertValues.php   Download  
File: insertValues.php
Role: Example script
Content type: text/plain
Description: In this file you pass the values to functions to create the multiple sheet xls file.While creating it will create the xml file .but open that file with openoffice or xls option ..it will work perfect
Class: Create Multiple spreadsheet xls file
Create Multiple spreadsheet xls file
Author: By
Last change: Corrected included xls file generated class name.
Date: 11 years ago
Size: 1,981 bytes
 

Contents

Class file image Download
<?php
########################Master Block################
#Created by Prashant Bhavsar
#mail me:prashantmbhavsar@gmail.com
#contact no:+91 - 09975589046

include("xmlFileCreation.php");

#put the xls file header names here. if two spreadsheet then use two headervalues..
$headerValues = "Flavor External ID, Preview Content File,Preview Descriptor File, Target Device Groups,Preview Type,Preview Media Format Name,Delivery Method";

#put name of xls spreadsheet
$worksheetName = "ContentItem";

#this creating the xls files header,and style of xls file
$xmlObject = new ExcelWriter;
$xmlPart1 = "";
$xmlPart .= $xmlObject->GetHeader();
$xmlPart .= $xmlObject->OfficeDocumentSettings();
$xmlPart .= $xmlObject->Style();

#worksheet means spreadsheet of xls file..if you want to add more than one then use logic
#and use this functino AddWorkSheet again for second spreadsheet
$xmlPart .= $xmlObject->AddWorkSheet($worksheetName,$headerValues);

#put the values of header..presently taking one spreadsheet
$DataValues ="put the column values here as per header values.That should be comma separated";

#its writing the values into xls file
$xmlPart .= $xmlObject->getColumnData($DataValues);

#filename of xls file.here you have to give the extension xml but when file will get done then
#open that file with openoffice or xls it will definately work
$file_name = "filename.xml";

$fp = fopen("/".$sourcepath.$file_name,"w");
$rr = "/".$sourcepath.$file_name;
system("chmod -rf 777 '".$rr."'");

#here i am using one spreadsheet so this 3 line code will get include once and if you want to
#create 2 spreadsheet then use twice
$xmlPart .= "</Table>";
$xmlPart .= $xmlObject->GetFooter();

#use this at the end of the all code means after creation of all spreadsheet
$xmlPart .= "</Workbook>";

if(
$fp){
    echo
"file open ";
}else{
    echo
"file Not open ";
}

#writing code to file
fwrite($fp,$xmlPart);
fclose($fp);

?>