DocumentBase.SaveFormat 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取文档的文件格式。
public int SaveFormat { get; }
属性值
文档的文件格式。
示例
下面的代码示例使用 <xref:Microsoft.Office.Tools.Word.DocumentBase.SaveAs%2A> 方法将文档保存到以 RTF 格式 myfile.docx 的新文件名。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。
private void DocumentSaveAs()
{
object FileName = "myfile.docx";
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);
}
}
Private Sub DocumentSaveAs()
Me.SaveAs(FileName:="myfile.docx", 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
注解
值是指定外部文件转换器或常量的唯一编号 WdSaveFormat 。
将此属性的值用于方法的 FileFormat 参数,将 <xref:Microsoft.Office.Tools.Word.DocumentBase.SaveAs%2A> 文档保存为不具有相应常量的文件格式 WdSaveFormat 。