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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.