Document.SaveFormat 属性 (2007 system)

更新:2007 年 11 月

获取文档的文件格式。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word.v9.0(在 Microsoft.Office.Tools.Word.v9.0.dll 中)

语法

声明
<BrowsableAttribute(False)> _
Public ReadOnly Property SaveFormat As Integer
用法
Dim instance As Document
Dim value As Integer

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

属性值

类型:System.Int32

文档的文件格式。

备注

该值是指定外部文件转换器或 WdSaveFormat 常数的唯一数字。

如果将此属性的值用于 SaveAs 方法的 FileFormat 参数,则可以使用没有对应 WdSaveFormat 常数的文件格式保存文档。

示例

下面的代码示例使用 SaveAs 方法将文档以 RTF 格式保存到名为 myfile.doc 的新文件中。

此示例针对的是文档级自定义项。

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);
    }
}

权限

另请参见

参考

Document 类

Document 成员

Microsoft.Office.Tools.Word 命名空间