Thank you for purchasing my script. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!
Awesome Conversion Script provides many types of format conversions using a simple single script. You need to use a single function to convert from one format to another format of data.
You can import either excel, csv, xml, html table to database and also can generate this different format files (excel, csv, xml, html table). You can also convert these files from one format to another like excel can be converted to pdf, csv can be converted to xml, xml can be converted to excel.
You can either use the sql script or database table selection of generate this different format of files, for example you can use the sql script to generate the pdf, excel, csv, xml format files.
You can either use the GUI to convert the files or you can use script programmatically to do the format conversion. Script works on concept of converting the given format to 2 dimensional array and then it converts the 2 dimensional array to required format. So any type of supported files with 2 level of nesting will work perfectly. For database operation, script uses the bulk PDO operation for faster result. I had included the demo data inside script.
List of ACS Functions
1. convert($from,$to,$inputSource="",$outputFileName="");
/**
* Main Convert function - It converts a given format ($from) to a specified format ($to).
*
* @param string $from The name of the format, that needs to be converted
* @param string $from The name of the format, to which given format($from) needs to be converted.
* @param string $inputSource The name of the input file which needs to be converted.
* @param string $from The name of the output file after conversion.
*
Example:
$ACS=new ACS();
$ACS->convert("csv","excel",$path,$outputPath);
*/
2. arrayToDB($data);
/**
* Insert the data from two dimensional associative array to database using insert batch operation. Returns true
* if operation performed successfully
*
* @param array $data Associative array with key as column name and value as table values.
*
*/
4. arrayToHTML($htmlArray,$outputFileName="file.html",$isCalledFromPDF=false); /** * Generates the html table as output from the array provided. * @param array $htmlArray Associative array with key as column name and value as table values. * @param array $outputFileName Output file name * @param bool $isCalledFromPDF This function is used internally in arrayToPDF() also, so to check whether it is called directly or using the pdf function */
5. arrayToPDF($pdfArray,$outputFileName="file.pdf"); /** * Generates the pdf as output from the array provided. Returns true if operation performed successfully else return false * @param array $pdfArray Associative array with key as column name and value as table values.. * @param string $outputFileName Output pdf file name */
6. arrayToExcel($excelArray,$outputFileName="file.xlsx"); /** * Generates the excel file as output from the array provided. * * @param array $excelArray Associative array with key as column name and value as table values. * @param string $outputFileName Output excel file name * */
7. arrayToCSV($csvArray,$fileName="file.csv"); /** * Generates the csv file as output from the array provided. * * @param array $csvArray Associative array with key as column name and value as table values. * * @param string $outputFileName Output csv file name * */
7. excelToArray($fileName); /** * Read an excel file and return content as array * * @param string $fileName excel file name * * return array return array */
8. xmlToArray($xmlSource); /** * Read an xml file/xml and return content as array * * @param string $xmlSource xml as string or xml file name * * return array return array */
9. csvToArray($fileName); /** * Read a CSV File and return content as an array. * * @param string $fileName Path of file with file name (default is 'file.csv') * * return array return content array */
10. htmlToArray($htmlContent); /** * Read an html file/html and return content as array * @param string $html html as string or xml file name * * return array return array */
11. getDBTables(); /** * Retrives all the tables from database * * return array table names in array */
12. getDBTableColumns($dbTableName); /** * Retrives the column names from a given table * @param string $table The name of the table to get columns. * * return array column name in array */
/********************* Debugging variables - use these variables to debug application ********************************/ public $error; // Display any error occured in conversion public $messages=""; // Display all messages at various steps for processing conversion public $inputDataArray=array(); // Display the input data as array generated by input format public $formattedDataArray=array(); // Display the formatted data as array after processing the input data /********************* File related variables - use this for various file operations *********************************/ public $fileOutputMode="browser"; // if fileOutputMode="browser", then it will ask for download else it will save public $checkFileName=true; // If true then it checks for illegal character in file name public $checkFileNameCharacters=true; // If true then it checks for no. of character in file name, should be less than 255 public $replaceOlderFile=false; // If true then it will replace the older file if present at same location public $uploadedFileName=""; // Name of new uploaded file public $fileUploadPath="../upload/"; // Path of the uploaded file public $maxSize=100000; // Max size of file allowed for file upload public $fileSavePath="../saved/"; // Default path for saving generated file public $pdfFontName="helvetica"; // font name for pdf public $pdfFontSize="8"; // font size for pdf public $pdfFontWeight="B"; // font weight for pdf public $pdfAuthorName="Author Name"; // Author name for pdf public $pdfSubject="PDF Subject Name";// Subject name for pdf public $excelFormat="2007"; // Set format of excel generate (.xlsx or .xls) public $user_name="root"; // Username for the database public $password=""; // Password for database public $host_name="localhost"; // hostname/server for database public $db_name="acs"; // Database name public $dbTableName=""; // Database table name public $columns=array(); // Column names for the database table name private $db; // Internally used db object public $isFirstRowHeader=false; public $delimiter=","; // Delimiter to be used in handling csv files, default is ',' public $enclosure='"'; // Enclosure to be used in handling csv files, default is '"' public $isFile=false; // Whether the supplied xml or html source is file or not public $useFirstRowAsTag=false; public $outputHTML=""; // Display html table generated public $tableCssClass="tblCss"; // css class for the html table public $trCssClass="trCss"; // css class for the html table row (tr) public $htmlTableStyle=""; // css style for the html table public $htmlTRStyle=""; // css style for the html table row (tr) public $htmlTDStyle=""; // css style for the html table col (td) public $outputXML=""; // Display xml table generated public $rootElement="root"; // Root Element for the xml public $encoding="utf-8"; // Encoding for the xml file public $rowTagName=""; // If this is set to some valid xml tag name then generated xml will contain this tagname after each subarray of two dimensional array public $logusername="demo"; // Set this to check the login username or else you can use database checking public $logpassword="demo"; // Set this to check the login password or else you can use database checking
1. I am not able to upload files using the GUI?Ans: Main reason for not able to upload files is may be due to incorrect permission for the upload folders. Make sure your upload folders need to be writable so that files can be uploaded to them, or created in them or written to them by PHP
2. I am getting following error "File size is greater than max. file size allowed"?Ans: The max. file size allowed can be setting the script variable $maxSize. for e.g. $ACS->maxFileSize=100000; This max file size allowed can't be more than the php.ini setting. To increase the maximum upload size, open php .ini file and change the values of upload_max_filesize and post_max_size directives to the desired value.
3. How to change the location of folder where uploaded files saved when using GUI?Ans: The location of folder can be set using the $uploadFolderLocation. for e.g. $ACS->fileUploadPath=".../upload/newfolder/"';
4. Can I pass any type of file in supported formats ?Ans: Awesome Conversion Script works on concept of 2 dimensional array. so only files that can be converted 2 dimensional array can be used i.e. files must be of max. 2 level nesting.
5. Can I pass xml as file or xml directly?Ans: You can pass xml as either file or xml directly. If you pass xml file then you need to set $isFile=true
6. How can change database Information?Ans: Database information can be set using the various variable in the main script page. (AwesomeConversionScript/script/classes/ACS.php)
To set database name
$ACS->host_name="YourHostName";
$ACS->user_name="UserName";
$ACS->password="Password";
$ACS->db_name="YourDatabaseName";
7. How to change the location of folder where uploaded files saved when using GUI?Ans: The location of folder can be set using the $fileSavePath. for e.g. $ACS->fileSavePath=".../save/"';
8. How can I add login authentication for script?Ans: Script has already code written to support login authentication. To use this, uncomment the following code at the top of script page(AwesomeConversionScript/script/classes/ACS.php) /*
session_start(); if(!isset($_SESSION['username'])) { header("Location:../../login.php"); }*/;This will redirect user to login page.
The login page on submit information validates the login details from the following variable from the script (ofcourse you can use your database for login authentication).
public $logusername="demo"; // Set this to check the login username or else you can use database checking public $logpassword="demo"; // Set this to check the login password or else you can use database checking
9. what does 'Is First Row Header' means?Ans: 'Is First Row Header' means whether to use the first row in upload operation or not as most of the time, first row contains headings only. If it is true then then it means first row contains heading and it will be not included else if will be included.
10. what does 'Use First Row As Tag' means?Ans: 'Use First Row As Tag' means whether to use the first row as tags in case of xml, html. If it is true then first row will be used for generating various tags in the output xml file or <thead> in html.
1. Now It supports append record for the excel and csv. So now you can add new rows to existing excel file or else create a completely new excel file. Following needs to be done in order to append data.
//set append=true to add new row file $ACS->append=true; //set path of the existing file, on which we will append data $ACS->existingFilePath="demo_excel_csv/STUDENTS.csv";
2. Added New Demo forms to insert/append data in database, excel, csv. Please check More section in demo.
1. By default, it supports unicode(utf8). You can change character set in script/classes/DBModel.php, change $charset as per your requirement.
2. Added new option of import csv to db with column maping. Please check demo for this.