471,338 Members | 1,001 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

C# dotnet and Word Automation

I am trying to save a document (automatically) to an XML document.

I am using the following code:

wrdApp.ActiveDocument.SaveAs(ref oOutFileName, ref oFormat, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing,ref
oMissing,ref oMissing,ref oMissing,ref oMissing);

The intellisense tells me that the 2nd parameter (where I have oFormat) is
for the format of the document. However, I have not been able to find what
the format of this should be. I have tried

object oFormat = "XML";
object oFormat = "2";
object oFormat = "XML Document";

etc.

Does anyone know the correct syntax for my oFormat variable?
Jul 21 '05 #1
2 3514
It should be one of the WdSaveFormat enumerated values (probably
WdFormatXML = 11).

See the Document.SaveAs documentation on MSDN:
http://msdn.microsoft.com/library/de...asp?frame=true

I got the value of the constant from this page:
http://msdn.microsoft.com/library/de...asp?frame=true
Joshua Flanagan
http://flimflan.com/blog
ANDY wrote:
I am trying to save a document (automatically) to an XML document.

I am using the following code:

wrdApp.ActiveDocument.SaveAs(ref oOutFileName, ref oFormat, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing,ref
oMissing,ref oMissing,ref oMissing,ref oMissing);

The intellisense tells me that the 2nd parameter (where I have oFormat) is
for the format of the document. However, I have not been able to find what
the format of this should be. I have tried

object oFormat = "XML";
object oFormat = "2";
object oFormat = "XML Document";

etc.

Does anyone know the correct syntax for my oFormat variable?

Jul 21 '05 #2
Is there anywhere with an example? This says to use the wdSaveFormat constant

Can be any WdSaveFormat constant. The one I want is wdFormatXML. If I put
the line in Object oFormat = "wdFormatXML", the program errors out at that
point - Type Mismatch. If I take off the quotes, like in the VB examples
given, I get wdFormatXML is not defined. I figure it is some component of
the Office.Core library, but can't seem to find it.

"Joshua Flanagan" wrote:
It should be one of the WdSaveFormat enumerated values (probably
WdFormatXML = 11).

See the Document.SaveAs documentation on MSDN:
http://msdn.microsoft.com/library/de...asp?frame=true

I got the value of the constant from this page:
http://msdn.microsoft.com/library/de...asp?frame=true
Joshua Flanagan
http://flimflan.com/blog
ANDY wrote:
I am trying to save a document (automatically) to an XML document.

I am using the following code:

wrdApp.ActiveDocument.SaveAs(ref oOutFileName, ref oFormat, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,ref oMissing,ref
oMissing,ref oMissing,ref oMissing,ref oMissing);

The intellisense tells me that the 2nd parameter (where I have oFormat) is
for the format of the document. However, I have not been able to find what
the format of this should be. I have tried

object oFormat = "XML";
object oFormat = "2";
object oFormat = "XML Document";

etc.

Does anyone know the correct syntax for my oFormat variable?

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by mickeydisn | last post: by
12 posts views Thread by Cheval | last post: by
4 posts views Thread by Daniel | last post: by
reply views Thread by mharris | last post: by
2 posts views Thread by Radek | last post: by
4 posts views Thread by Yohancef Chin | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.