Jump to content

The COM object and character encoding


shmoyko

Recommended Posts

I have the joy of trying to create a MS Word document in German using PHP.

 

I fistly make an instance of the COM object:

 

$word = new COM("word.application") or die("Unable to instantiate word");

 

... ($doc defined here, etc.)

 

Then, I set up "bookmarks":

$tempBookmark = $doc->Bookmarks('INTRO');

$tempRange    = $tempBookmark->Range;

$contentRange->FormattedText = $tempRange;

$contentRange->Find->Execute('{Something}', 1, 0, 0, 0, 0, 1, 0, 0, $something, 2);

 

The above is just a sample.

 

The problem is this:

I use the mb_convert_encoding function to convert text from UTF-8 to ISO-8859-1.

Works fine, except when the text is in a table (within Word). Some German characters are not displayed or they're converted to 'English' equivalents.

 

Any idea why this is happening? Why are tables in Word special?

 

Many thanks.

Link to comment
https://forums.phpfreaks.com/topic/159692-the-com-object-and-character-encoding/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.