Document.SaveFormat Property (2007 System)

Gets the file format of the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property SaveFormat As Integer
'Usage
Dim instance As Document 
Dim value As Integer 

value = instance.SaveFormat
[BrowsableAttribute(false)]
public int SaveFormat { get; }
[BrowsableAttribute(false)]
public:
property int SaveFormat {
    int get ();
}
public function get SaveFormat () : int

Property Value

Type: System.Int32
The file format of the document.

Remarks

The value is a unique number that specifies an external file converter or a WdSaveFormat constant.

Use the value of this property for the FileFormat argument of the SaveAs method to save a document in a file format for which there is not a corresponding WdSaveFormat constant.

Examples

The following code example uses the SaveAs method to save the document to the new file name myfile.doc in RTF format.

This example is for a document-level customization.

Private Sub DocumentSaveAs()

    Me.SaveAs(FileName:="myfile.doc", FileFormat:=Word.WdSaveFormat.wdFormatRTF, _
        LockComments:=False, AddToRecentFiles:=True, ReadOnlyRecommended:=False, _
        EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=True, _
        SaveFormsData:=True, SaveAsAOCELetter:=False, _
        Encoding:=Office.MsoEncoding.msoEncodingUSASCII, _
        InsertLineBreaks:=False, AllowSubstitutions:=False, _
        LineEnding:=Word.WdLineEndingType.wdCRLF, _
        AddBiDiMarks:=False)
End Sub
private void DocumentSaveAs()
{
    object FileName = "myfile.doc";
    object FileFormat = Word.WdSaveFormat.wdFormatRTF;
    object LockComments = false;
    object AddToRecentFiles = true;
    object ReadOnlyRecommended = false;
    object EmbedTrueTypeFonts = false;
    object SaveNativePictureFormat = true;
    object SaveFormsData = true;
    object SaveAsAOCELetter = false;
    object Encoding = Office.MsoEncoding.msoEncodingUSASCII;
    object InsertLineBreaks = false;
    object AllowSubstitutions = false;
    object LineEnding = Word.WdLineEndingType.wdCRLF;
    object AddBiDiMarks = false;

    if (this.SaveFormat == (int)Word.WdSaveFormat.wdFormatDocument)
    {
        this.SaveAs(ref FileName, ref FileFormat, ref LockComments,
            ref missing, ref AddToRecentFiles, ref missing,
            ref ReadOnlyRecommended, ref EmbedTrueTypeFonts,
            ref SaveNativePictureFormat, ref SaveFormsData,
            ref SaveAsAOCELetter, ref Encoding, ref InsertLineBreaks,
            ref AllowSubstitutions, ref LineEnding, ref AddBiDiMarks);
    }
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace