powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / PHP, Perl, Python [игнор отключен] [закрыт для гостей] / PHPWord поддержка языков
3 сообщений из 3, страница 1 из 1
PHPWord поддержка языков
    #38701759
Фотография Areostar
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
создаю документ word на PHPWord.пишу на англиском все норм. в место других языков - кракозябры.

а чем дело может чнго добавить надо?

Вот код:

Код: php
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
<?php
header('Content-Type: text/html; charset=utf-8');
	error_reporting(E_ALL);
    ini_set('display_errors', 1);
// Include the PHPWord.php, all other classes were loaded by an autoloader
require_once 'PHPWord.php';

// Create a new PHPWord Object
$PHPWord = new PHPWord();

// Every element you want to append to the word document is placed in a section. So you need a section:
$section = $PHPWord->createSection();

// After creating a section, you can append elements:
$section->addText('ываываываываыва');

// You can directly style your text by giving the addText function an array:
$section->addText('Hello world! I am formatted.', array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));

// If you often need the same style again you can create a user defined style to the word document
// and give the addText function the name of the style:
$PHPWord->addFontStyle('myOwnStyle', array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
$section->addText('Hello world! I am formatted by a user defined style', 'myOwnStyle');

// You can also putthe appended element to local object an call functions like this:
$myTextElement = $section->addText('Hello World!');
//$myTextElement->setBold();
//$myTextElement->setName('Verdana');
//$myTextElement->setSize(22);

// At least write the document to webspace:
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('helloWorld.docx');
?>
...
Рейтинг: 0 / 0
PHPWord поддержка языков
    #38701814
vkle
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Areostar,

Обычно крякозябры лезут из-за неправильной кодировки текста.
...
Рейтинг: 0 / 0
PHPWord поддержка языков
    #38701982
Фотография Areostar
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Это ясно.

Но я уже сам разобрался! в самой библиотеке изменения надо было сделать.
что лишний раз кодеровку не меняло
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / PHP, Perl, Python [игнор отключен] [закрыт для гостей] / PHPWord поддержка языков
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]