Excel embedded in Word converted to bitmap

B

- B@rney

Hi Guys'n Dolls!

I have a Office Add-In that inherits Extensibility.IDTExtensibility2.

In OnStartupComplete I check if(applicationObject is Word.Application) and
so on for the three Office applications I want my add-in to support, and add
Open and BeforeClose event handlers, in which I do most logic. Then I add a
button.

The Add-In now works great, after a quite some time work, but my customer
just noticed some strange behaviour.

When they open a Word document, containing a Excel Spreadsheet object, and
wait until the SpellChecker is finished working, the Excel Spreadsheet is
converted to a bitmap! This only happends if the Add-In is installed on the
client and registered for Excel (in HKLM[or
HKCU]/Software/Microsoft/Office/Excel/AddIns/MyAddIn.Connect).

Whats going on here? Anyone?

I've added code that iterates through any embedded objects in the Open Event
and marks their respective ranges as not to be spellchecked, but if the user
changes language, or forces a spellcheck, the objects will be converted...
 
C

Cindy M -WordMVP-

Hi,

Well, no one really seems to have any ideas...

Perhaps if you describe what this Addin is doing it might ring some bells? I
get the impression you're somehow "forcing" a spellcheck, even on objects...

An embedded object will convert to an embedded graphic if the field code is
removed, for example (Fields.Unlink). A file conversion that doesn't support
embedded OLE objects can cause the problem. So can certain types of
manipulation, activating the object, for example, when the OLE Server isn't
available.
I have a Office Add-In that inherits Extensibility.IDTExtensibility2.

In OnStartupComplete I check if(applicationObject is Word.Application) and
so on for the three Office applications I want my add-in to support, and add
Open and BeforeClose event handlers, in which I do most logic. Then I add a
button.

The Add-In now works great, after a quite some time work, but my customer
just noticed some strange behaviour.

When they open a Word document, containing a Excel Spreadsheet object, and
wait until the SpellChecker is finished working, the Excel Spreadsheet is
converted to a bitmap! This only happends if the Add-In is installed on the
client and registered for Excel (in HKLM[or
HKCU]/Software/Microsoft/Office/Excel/AddIns/MyAddIn.Connect).

Whats going on here? Anyone?

I've added code that iterates through any embedded objects in the Open Event
and marks their respective ranges as not to be spellchecked, but if the user
changes language, or forces a spellcheck, the objects will be converted...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
B

- B@rney

Sorry Cindy!

The Add-in basically does the same thing in all Office Applications, but the
implementation differs.

The business scenario is a client of mine that have developed their own
web-based CRM solution. They wanted a smoother way for users to save
documents that come from the CRM Solution back to the web. They used to have
an ordinary File Upload, but wanted to be able to do this from Office.

In my solution I've developed an Add-In that hooks onto the (Before)Close
Event and has it's own Save button. On both these events I check som business
logic to see if this document comes from the CRM system. If so I create a
copy in the users Temp directory and upload that file over http. The I delete
the Temp file.

When OnStartupComplete is called I check for which Application is running
and add Open and BeforeClose events. I also add the button.

Some of these files start their lives as XML (WordML and so on), and some as
native Word/Excel/PowerPoint. All are saved in native format before uploading.

What the client has observed is that when Word documents allready in the CRM
system (on the web), containing embedded Excel objects, are opened, and the
SpellCheck completes, these Excel objects are converted to bitmaps.

I don't touch the SpellChecker at all.

My workaround was described in the earlier post. But, I'd rather have a more
robust solution to this issue.

All clients run Office 2003 SP2.
--
- B@rney
___________________________
http://www.sharepointdemo.biz/
http://www.sharepointdemo.biz/blogs/bjarne/


Cindy M -WordMVP- said:
Hi,

Well, no one really seems to have any ideas...

Perhaps if you describe what this Addin is doing it might ring some bells? I
get the impression you're somehow "forcing" a spellcheck, even on objects...

An embedded object will convert to an embedded graphic if the field code is
removed, for example (Fields.Unlink). A file conversion that doesn't support
embedded OLE objects can cause the problem. So can certain types of
manipulation, activating the object, for example, when the OLE Server isn't
available.
I have a Office Add-In that inherits Extensibility.IDTExtensibility2.

In OnStartupComplete I check if(applicationObject is Word.Application) and
so on for the three Office applications I want my add-in to support, and add
Open and BeforeClose event handlers, in which I do most logic. Then I add a
button.

The Add-In now works great, after a quite some time work, but my customer
just noticed some strange behaviour.

When they open a Word document, containing a Excel Spreadsheet object, and
wait until the SpellChecker is finished working, the Excel Spreadsheet is
converted to a bitmap! This only happends if the Add-In is installed on the
client and registered for Excel (in HKLM[or
HKCU]/Software/Microsoft/Office/Excel/AddIns/MyAddIn.Connect).

Whats going on here? Anyone?

I've added code that iterates through any embedded objects in the Open Event
and marks their respective ranges as not to be spellchecked, but if the user
changes language, or forces a spellcheck, the objects will be converted...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)


This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
C

Cindy M -WordMVP-

Hi Barney,

I must say, I've never heard of anything like this before... And this is only
happening files that have been saved in this system? And only when your Add-in
is active? And it happens with doc files that have never been saved as XML? I
find that rather... odd, shall we say? I don't suppose "you" have taken a
first-hand look?

The first things I'd look at are:

1. Is it certain the client isn't using any other tools/Add-ins, most
importantly for spell-checking?

Can your Add-in be loaded manually? I wonder what starting Word in Safe Mode,
then loading your Add-in (and only your add-in) would have as a result?

2. Is it absolutely certain that no third-party product could be interfering
with the link up to the OLE Server (Excel)? One should really try booting
Windows in Safe Mode and see if the problem goes away.
What the client has observed is that when Word documents allready in the CRM
system (on the web), containing embedded Excel objects, are opened, and the
SpellCheck completes, these Excel objects are converted to bitmaps.

I don't touch the SpellChecker at all.

My workaround was described in the earlier post. But, I'd rather have a more
robust solution to this issue.

All clients run Office 2003 SP2.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
B

- B@rney

Hi Cindy!

Yes, I've taken a first-hand look myself.

I experience the exact same behaviour. Sometimes we have to wait a few
minutes before it kicks in. Might it be related to Auto-Save? I too find this
odd!

Something else that's odd is that Microsoft doesn't respond. I thought that
was the point with these Managed Newsgroups?

Today I got a dialogbox which I've posted here:
http://www.sharepointdemo.biz/Shared Documents/image001.png

I've got a couple of other Add-Ins enebled on my system, but disabling them
doesn't help at all.

How do I load the Add-In after starting Word in Safe Mode? If I do that my
button is gone...

I've tried running Windows in Safe mode, but experienced the same behaviour.
 
B

- B@rney

I've been researching this behaviour more systematically...

Looks like this occurs if the user resizes the embedded object. Then either
after a automatic spell-check, or Auto Save, the object has been converted...
 
B

- B@rney

Hi Cindy!

To be able to pinpoint what's going wrong I've created a minimal Add-In that
reproduces the behaviour.

To reproduce:
Create a new Project in Visual Studio, selecting the Shared Add-in Template
under Other Projects | Extensibility Projects. Name the project EmbedIssue.
Select to create an Add-in using Visual C#.
Select only the applications Excel, PowerPoint and Word.
Name the Add-in.
You don't need the check any checkboxes on the Choose Add-in Options page.
Create the Project.

Add reference (from the COM tab) to Microsoft Excel 11.0 Object Library,
Microsoft PowerPoint 11.0 Object Library, Microsoft Word 11.0 Object Library.

Add Reference to System.Windows.Forms

Open the Connect.cs class.
Replace everything with the code found here:
http://www.sharepointdemo.biz/EmbedIssue/
in this file:
http://www.sharepointdemo.biz/EmbedIssue/Shared Documents/Connect.cs

Build and install the add-in.

Open the document called Sample.doc in the same Document Library.

Resize the Embedded Excel objects. Wait. Wait some more. See if the objects
aren't converted to bitmaps. They are on my machine...

All this Add-in does is that it registers some Open and BeforeClose Events
and it Adds a button with an OnClick Event.

Have you got any idea why this is going on?

Anyone else have any idea?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?LSBCQHJuZXk=?=,
Something else that's odd is that Microsoft doesn't respond. I thought that
was the point with these Managed Newsgroups?
Managed for MSDN subscribers, I think, if you've logged into
the MSDN site and entered the group that way (can't swear to
that, though, as I've only peripherally followed any
discussions on this). If that applies to you, then maybe you
have to send an email or something to "wake 'em up"?
How do I load the Add-In after starting Word in Safe Mode? If I do that my
button is gone...
Tools/Customize/Commands; Tools category. There's a COM Add-ins
entry you can drag anywhere (usually to the Tools menu). That
gives you an interface to load COM Add-ins.
I've tried running Windows in Safe mode, but experienced the same behaviour.
<ugh> I was so sure this was third-party "management" software
of some kind said:
Looks like this occurs if the user resizes the embedded object. Then either
after a automatic spell-check, or Auto Save, the object has been converted...

Today I got a dialogbox which I've posted here:
http://www.sharepointdemo.biz/Shared Documents/image001.png
Hmmmm. Wait a sec, I may have been misunderstanding something
here. Is this Add-in in the Word interface, or the Excel
interface? I've been working on the premise it's in the Word
interface, but on looking at the dialog box, then re-reading
the entire thread...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8
2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 
B

- B@rney

Hi Cindy!

The problem occurs when working on a Word document with embedded Excel
objects. So, it is definetly the Word interface. But the dialogbox is from
Excel.

But, I'm now quite sure this dialog isn't causing the problem. I turned off
all AutoSave/AutoRecover options, and that dialog dissapeared, but the
problem with the Excel objects continued...

Take a look at my most recent posts to see more updates...
 
B

- B@rney

I got an idea, but haven't figured out how to implement it...

If I could figure out during OnStartUpComplete that Excel is currently
running embedded in Word, then I could skip hooking up the events. And an
Add-In without these two events didn't produce the issue described previously.

Does anybody out there know how to see, from Excel, that Excel is currently
running embedded in Word?

- B@rney
___________________________
http://www.sharepointdemo.biz/
http://www.sharepointdemo.biz/blogs/bjarne/
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?LSBCQHJuZXk=?=,
I got an idea, but haven't figured out how to implement it...

If I could figure out during OnStartUpComplete that Excel is currently
running embedded in Word, then I could skip hooking up the events. And an
Add-In without these two events didn't produce the issue described previously.

Does anybody out there know how to see, from Excel, that Excel is currently
running embedded in Word?
Ahhh. OK, a couple of further observations

1. I can see Excel.exe in the Task Manager "Processes". If you know how to
access to API calls that give you that information (I don't), you'd be half way
there. And I *think*, once you're working at that level, you should be able to
pick up HOW the process was started (Word has an undocumented command line
switch "embedded", for example, when it's been started in this manner).

2. By default, Word will generally update the links to embedded applications
when a document is opened. This involves running the Excel (or whatever) process
in the background - the user usually has no idea this is going on. I'd sorta
forgotten about this, but your post here reminded me of this. There's an option
you can use to shut this off (Tools/OPtions/General), or fields can be locked so
they can't update. Perhaps you could use either or both of these to get your
Addin to load in "asynch" mode with the updates.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
P

Peter Huang [MSFT]

Hi Brney,

I think you may try to isolate the problem via the steps below.
1. Disable all the addins in Word and Excel
Now if you do the spelling check will the problem persists
2. Please disable all the other addin except the Word Addin, to see if the
problem persists.
3. Disable all the other addin except the Excel Addin, to see if the
problem persists.
4. disable all the other addins except the Word Addin and the Excel Addin
to see if the problem persists

Also can you provide a simple reproduce code and Excel,Word Test Files so
that we can try to reproduce the problem at our side.

Thanks for your efforts.!




Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top