home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / bb98.exe / SOexcelu.php < prev    next >
PHP Script  |  2002-11-09  |  2KB  |  46 lines

  1. <?php if (!defined("SOexcelu")) { define("SOExcelu", 1);
  2.  
  3. include("SOhttp.php");
  4.  
  5. //    Update cell inside an Excel spreadsheet.
  6. //    Inputs:
  7. //        $sAddr: address of BadBlue server (e.g., "127.0.0.1:8080")
  8. //        $sPath: path of shared file in EXT.INI file (e.g., "path3")
  9. //        $sFile: name of Excel file to examine (e.g., "invoice.xls")
  10. //        $nSheet: sheet number (e.g., 1)
  11. //        $sUpdateCell: cell of area to retrieve (e.g., "A1")
  12. //        $sUpdateValue: value to update cell (always passed in as a string)
  13. //        $sUpdateType: data type of cell being updated (default is "S")
  14. //            I2 = short-int   I4 = long int    R4 = real     R8 = float
  15. //            C  = currency    D  = date        B  = boolean  E  = empty
  16. //            S  = string 
  17. //        $sUser: (optional) user-name to get access to file
  18. //        $sPassword: (optional) password to get access to file
  19. //    Outputs:
  20. //        $errmsg: empty if no error occurred, otherwise error message
  21. //
  22. function SOExcelUpdate($sAddr, $sPath, $sFile, $nSheet,
  23.                        $sUpdateCell, $sUpdateValue, $sUpdateType,
  24.                        $sUser = "", $sPassword = "") {
  25.     $errmsg = "";
  26.     do {
  27.  
  28.         //    Construct URL and grab page...
  29.         //
  30.         $nX = $nY = 1; $nDX = $nDY = 10;
  31.         $sURL = "http://".$sAddr."/ext.dll?MfcISAPICommand=LoadPage&".
  32.                 "page=xls.htx&a0=/get/".$sPath."/".rawurlencode($sFile)."&a1=".$nSheet."&a2=Update&".
  33.                 "a3=".$nX."&a4=".$nY."&a5=".$nDX."&a6=".$nDY."&a7=2&a8=100%25&".
  34.                 "a10=".$sUpdateCell."&a9=".rawurlencode($sUpdateValue)."/".$sUpdateType;
  35.         // echo("URL = $sURL <BR>");
  36.         $errmsg = SOHTTPGet($sURL, &$sPage, $sUser, $sPassword);
  37.         if (strlen($errmsg)) {
  38.             break;
  39.         }
  40.  
  41.     } while (0);
  42.     return ($errmsg);
  43. }
  44.  
  45. } ?>
  46.