<?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);
?>
|