-
October 7th, 2009, 07:31 AM
#1
How to specify the SaveAs Format parameter WORD Automation
Hi,
Im wanting to use WORD automation to save a WORD doc in a different format say text or unicode etc.
I have created the files from create class from typelib etc, can create my doc etc.
But I want to specify the parameter for the format in the SaveAs method for the document object.
In the documentation it is of type wdsaveformat
http://msdn.microsoft.com/en-us/libr...aveformat.aspx
In the SaveAs method of the document object it is just variant and an enum of type wdsaveformat
is not present in any of the files created from the typelib.
How can I specify the format parameter for the saveas method of the document object?
-
October 7th, 2009, 09:08 AM
#2
Re: How to specify the SaveAs Format parameter WORD Automation
Originally Posted by PRMARJORAM
... In the SaveAs method of the document object it is just variant and an enum of type wdsaveformat
is not present in any of the files created from the typelib.
Uhmm... and how about WdSaveFormat enumeration?
Victor Nijegorodov
-
October 7th, 2009, 10:02 AM
#3
Re: How to specify the SaveAs Format parameter WORD Automation
Originally Posted by VictorN
Uhmm... and how about WdSaveFormat enumeration?
Yes thats what I mean.
In fact I found a workaround.
When the files are created from the typelib another header file is also created with an extension.tlh so I got msword.tlh
This contains all the enums etc referenced.
But, if I include this file directly, get lots of compilations errors. I not need to though as within this file you can find the enumeration values you need: e.g;
enum WdSaveFormat
{
wdFormatDocument = 0,
wdFormatDocument97 = 0,
wdFormatTemplate = 1,
wdFormatTemplate97 = 1,
wdFormatText = 2,
wdFormatTextLineBreaks = 3,
wdFormatDOSText = 4,
wdFormatDOSTextLineBreaks = 5,
wdFormatRTF = 6,
wdFormatUnicodeText = 7,
wdFormatEncodedText = 7,
wdFormatHTML = 8,
wdFormatWebArchive = 9,
wdFormatFilteredHTML = 10,
wdFormatXML = 11,
wdFormatXMLDocument = 12,
wdFormatXMLDocumentMacroEnabled = 13,
wdFormatXMLTemplate = 14,
wdFormatXMLTemplateMacroEnabled = 15,
wdFormatDocumentDefault = 16,
wdFormatPDF = 17,
wdFormatXPS = 18,
wdFormatFlatXML = 19,
wdFormatFlatXMLMacroEnabled = 20,
wdFormatFlatXMLTemplate = 21,
wdFormatFlatXMLTemplateMacroEnabled = 22
};
And then in your code just create a variant object with the value you so desire: e.g.
COleVariant covUnicodeConvert((long)7);
then pass this as a parameter to the saveAs method.
Thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|