get_pages_count
get_pages_count($path); - Получить число страниц в WORD документеФункция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
<?php // Scenario: Get the number of pages in a Word document $xhe_host = getenv("RPABOT_HOST_URL"); // Connect functional objects if not already connected if (!isset($path)){ $path = "../../../Templates/init.php"; require($path); } // info echo "\n<span >word->" . basename (__FILE__) . "</span>\n"; // Initialize variables $filePath = "test/test.docx"; // Open the file for read SYSTEM::$word->open($filePath, true); // Example 1: Get the number of pages in the document echo("1. Get number of pages in document: "); $pagesCount = SYSTEM::$word->get_pages_count($filePath); echo($pagesCount . "\n"); // Close stream with file: "); echo("\nClose exists Word file: "); $closeResult = SYSTEM::$word->close($filePath); if ($closeResult) echo("Word file '$filePath' closed successfully"); else echo("Word file '$filePath' close fail"); echo "\n"; // Quit the application WINDOW::$app->quit(); ?>
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7012" from xweb_human_emulator import * # начало echo("<hr><font color=blue>sound.xxxxxxxxx</font><hr>") # 1 echo("1. Получить число страниц в файле : ") echo(word.get_page_count("test\\test.docx")) # конец echo("<hr><br>") # Quit app.quit()
#region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; #endregion class Program:XHEScript { static void Main(string[] args) { // init XHE server = Environment.GetEnvironmentVariable("RPABOT_HOST_URL"); InitXHE(); // начало echo("<hr><font color=blue>pdffile.get_page_count</font><hr>"); // 1 echo("1. Получить число страниц в файле : "); echo(wordfile.get_page_count("test\\test.docx")); // конец echo("\n\n"); app.quit(); } }
=============================================
word Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.