Due to my work needs, in the OA system, I need to import the content of the EXCEL file to the database, and export the content in the database to the EXCEL file. The author's OA is developed using PHP and applied on the web page, so it is difficult to directly use PHP for processing. After research, I developed an ACTIVEX Control Using DELPHI to process the EXCEL file data, then submit the data to the server, and save it to the database, this allows you to easily import EXCEL file data. You can use PHP to export data without ACTIVEX controls. The method is to directly generate a CSV file, because CSV is a text file separated by commas, and can be opened directly in EXCEL, so it can meet the requirements. The following describes the implementation methods. Code of the imported page: "personnel number", "FIELDNAME" => "STUFFID", "FIELDTYPE" => ""), array ("CAPTION" => "Start Date", "FIELDNAME" => "BEGINDATE", "FIELDTYPE" => ""), array ("CAPTION" => "end date", "FIELDNAME" => "ENDDATE", "FIELDTYPE" => ""), array ("CAPTION" => "contract content", "FIELDNAME" => "CONTRACTTEXT", "FIELDTYPE" => ""), array ("CAPTION" => "Remarks", "FIELDNAME" => "THISMEMO", "FIELDTYPE" => ""), array ("CAPTION" => "Server File Name", "FIELDNAME" => "DOCFILE", "FIELDT YPE "=>" A "), array (" CAPTION "=>" file type "," FIELDNAME "=>" FILETYPE "," FIELDTYPE "=>" "), array ("CAPTION" => "local file name", "FIELDNAME" => "FILENAME", "FIELDTYPE" => ""), array ("CAPTION" => "file extension", "FIELDNAME" => "EXTNAME", "FIELDTYPE" => "A"); // construct an SQL statement, field name section $ strSQL = "insert into HR_WORKCONTRACT ("; $ strTemp = ""; for ($ I = 0; $ I ExecSQL ($ strSQL. $ strTmp) $ do-> SetObject ("ERR", "data import failed! "); Else $ do-> SetObject (" ERR "," data imported successfully! "); // 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 imported successfully! "); // Echo $ strSQL. $ strTmp ;}}?> The following figure shows the page for importing the labor contract information: all the content of the imported EXCEL file is displayed, and the data to be imported can be selected manually, you can modify the data temporarily (after the modification, the data is displayed in red to show the difference ). Select a file. You can select EXCEL files on the local hard disk, including XLS files and CSV files.