Пример #1
0
 /**
  * Inserts page number filed into the document.
  * @param string $fileName
  * @param string $alignment
  * @param string $format
  * @param string $isTop
  * @param string $setPageNumberOnFirstPage
  */
 public function insertPageNumber($alignment, $format, $isTop, $setPageNumberOnFirstPage)
 {
     try {
         //Build JSON to post
         $fieldsArray = array('Format' => $format, 'Alignment' => $alignment, 'IsTop' => $isTop, 'SetPageNumberOnFirstPage' => $setPageNumberOnFirstPage);
         $json = json_encode($fieldsArray);
         //build URI to insert page number
         $strURI = Product::$baseProductUri . "/words/" . $fileName . "/insertPageNumbers";
         //sign URI
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "POST", "json", $json);
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             //Save docs on server
             $folder = new Folder();
             $outputStream = $folder->getFile($fileName);
             $outputPath = SaasposeApp::$outputLocation . $fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
Пример #2
0
 /**
  * Deletes a chart
  * $chartIndex
  */
 public function deleteChart($chartIndex)
 {
     try {
         $strURI = Product::$baseProductUri . "/cells/" . $this->fileName . "/worksheets/" . $this->worksheetName . "/charts/" . $chartIndex;
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "DELETE", "", "");
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             //Save doc on server
             $folder = new Folder();
             $outputStream = $folder->getFile($this->fileName);
             $outputPath = SaasposeApp::$outputLocation . $this->fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
 /**
  * Replace a text with the new value in the document
  * @param string $fileName
  * @param string $oldValue
  * @param string $newValue
  * @param string $isMatchCase
  * @param string $isMatchWholeWord
  */
 public function replaceText($fileName, $oldValue, $newValue, $isMatchCase, $isMatchWholeWord)
 {
     try {
         //Build JSON to post
         $fieldsArray = array('OldValue' => $oldValue, 'NewValue' => $newValue, 'IsMatchCase' => $isMatchCase, 'IsMatchWholeWord' => $isMatchWholeWord);
         $json = json_encode($fieldsArray);
         //build URI to replace text
         $strURI = Product::$baseProductUri . "/words/" . $fileName . "/replaceText";
         //sign URI
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "POST", "json", $json);
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             //Save docs on server
             $folder = new Folder();
             $outputStream = $folder->getFile($fileName);
             $outputPath = SaasposeApp::$outputLocation . $fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
Пример #4
0
 /**
  * Executes mail merge template.
  * @param string $fileName
  * @param string $strXML
  */
 public function executeTemplate($strXML)
 {
     try {
         //build URI to execute mail merge template
         $strURI = Product::$baseProductUri . "/words/" . $this->fileName . "/executeTemplate";
         //sign URI
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "POST", "", $strXML);
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             $json = json_decode($responseStream);
             //Save docs on server
             $folder = new Folder();
             $outputStream = $folder->getFile($json->Document->fileName);
             $outputPath = SaasposeApp::$outputLocation . $this->fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }
Пример #5
0
 /**
  * Deletes all slides from a presentation
  */
 public function deleteAllSlides()
 {
     try {
         //Build URI to replace text
         $strURI = Product::$baseProductUri . "/slides/" . $this->fileName . "/slides";
         $signedURI = Utils::sign($strURI);
         $responseStream = Utils::processCommand($signedURI, "DELETE", "", "");
         $v_output = Utils::validateOutput($responseStream);
         if ($v_output === "") {
             //Save doc on server
             $folder = new Folder();
             $outputStream = $folder->getFile($this->fileName);
             $outputPath = SaasposeApp::$outputLocation . $this->fileName;
             Utils::saveFile($outputStream, $outputPath);
             return "";
         } else {
             return $v_output;
         }
     } catch (Exception $e) {
         throw new Exception($e->getMessage());
     }
 }