In the OA system, I need to import the contents of Excel file into the database, and also need to export the contents of the database to Excel file. The author's OA is developed with PHP, and applied to the Web page, so it is more difficult to deal with PHP directly. After research, the author uses Delphi to develop an ActiveX control, to process the data of Excel file, then submit the data to the server, and then save to the database, easy to implement the import of Excel file data. The export is not used with ActiveX controls and is processed directly with PHP. The method is to generate the CSV file directly, because CSV is a comma-delimited text file and can be opened directly in Excel, so you can meet the requirements. Here's how to implement this. Imported page code: "Personnel Number", "FIELDNAME" = "Stuffid", "FieldType" and "A", Array ("CAPTION" = "Start Date", "FIELDNAME" and "=" Begindate "," fieldtype "=" a "), Array (" CAPTION "and" End Date "," FIELDNAME "and" ENDDATE "," FieldType "and" a "), Array ("CAPTION" = "Contract contents", "FIELDNAME" and "Contracttext", "FieldType" and "A"), Array ("CAPTION" = "Remarks", " FIELDNAME "+", "Thismemo", "FieldType" and "A", Array ("CAPTION" + "Server file name", "FIELDNAME" and "Docfile", " FieldType "=" a "), Array (" CAPTION "=" File Type "," FIELDNAME "=" FILETYPE "," FieldType "and" a "), Array (" CAPTION " = = "Local filename", "FIELDNAME" = "filename", "FieldType" and "A"), Array ("CAPTION" = "file extension", "FIELDNAME" and "=" Extname "," fieldtype "=" A "); Constructs the SQL statement, the wordSegment name Part $strSQL = "INSERT into Hr_workcontract ("; $strTemp = ""; for ($i = 0; $i execsql ($strSQL. $strTmp)) $do->setobject ("ERR", "Data import failed! "); else $do->setobject ("ERR", "Data import succeeded!") "); echo $strSQL. $strTmp; $STRTMP = "";}}} if (Trim ($STRTMP) = "") {$strTmp = substr ($strTmp, 0, strlen ($STRTMP)-2). ";"; if (! $do->execsql ($strSQL. $strTmp ) $do->setobject ("ERR", "Data import failed!") "); else $do->setobject ("ERR", "Data import succeeded!") ");//echo $strSQL. $strTmp;}}? > Labor Contract Information Import the Import data page as follows: You can display all the contents of the imported Excel file, and you can manually select the data to import, you can temporarily modify the data processing (after the modified data in red color, to show the difference). Select the file interface. You can select an Excel file on your local hard disk, including the XLS file and CSV two formats.
http://www.bkjia.com/PHPjc/531993.html www.bkjia.com true http://www.bkjia.com/PHPjc/531993.html techarticle in the OA system, I need to import the contents of Excel file into the database, and also need to export the contents of the database to Excel file. The author's OA is with P ...