Determining whether the Word application has XML support

D

DA

Hi Anna

Sounds like all you'd need to do is confirm that
Office/Word '03 is installed.

Do a check on registry value
HKCU\Software\Microsoft\Office\11.0\Word
from withing your .NET application.

Hope that helps,
Dennis
-----Original Message-----
On a started Word application I can determine whether XML support is
available with the property
ArbitraryXMLSupportAvailable, but what I would
 
D

DA

Hi Anna

I see your point. I did a hunt through the registry and
found the "ProductName" string under
HKLM\Software\Microsoft\Office\11.0\Registration

Not convinced that this is the best way to check on
version or to solve your problem. Must get my coffee for
the morning and I'll have another think on it.

Dennis.
-----Original Message-----
Thanks for your response, but I don't believe that is enough. At
http://msdn.microsoft.com/library/default.asp? url=/library/en-
us/odc_wd2003_ta/html/odc_Wdnew2k3XMLOM.asp
it sais only Microsoft Office Word 2003 core program and Microsoft Office
Word 2003 in Microsoft Office Professional Edition 2003 support adding
schemas and will return true for
ArbitraryXMLSupportAvailable. Can the
 
A

Anna Neiderud

The drawback with the ProductName key is that it won't work with future
currently unknown versions of Word. But:

Turns out it is ok to attempt to start Word and use the
ArbitraryXMLSupportAvailable property afterall. With the attached method I
can do so without the user seeing any word application and with no
significant performance overhead (<.5 seconds on two laptops one with Word
2003 and one with an older version - ok in my scenario).

public static bool WordSupportsXML()
{
Microsoft.Office.Interop.Word.Application app = null;
try
{
// Start word
app = new Microsoft.Office.Interop.Word.ApplicationClass();

// Check
if (app!=null && app.ArbitraryXMLSupportAvailable)
{
return true;
}
}
catch {}
finally
{
if(app!=null)
{
// Stop word
object useDefault = System.Type.Missing;
app.Quit(ref useDefault, ref useDefault, ref useDefault);
}
}
return false;
}
 

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