_Document.SaveAs(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) 方法

定义

使用新的名称或格式保存指定的文档。Saves the specified document with a new name or format. 此方法的一些参数对应于 "另存为" 对话框("文件" 菜单)中的选项。Some of the arguments for this method correspond to the options in the Save Asdialog box (File menu).

public void SaveAs (ref object FileName, ref object FileFormat, ref object LockComments, ref object Password, ref object AddToRecentFiles, ref object WritePassword, ref object ReadOnlyRecommended, ref object EmbedTrueTypeFonts, ref object SaveNativePictureFormat, ref object SaveFormsData, ref object SaveAsAOCELetter, ref object Encoding, ref object InsertLineBreaks, ref object AllowSubstitutions, ref object LineEnding, ref object AddBiDiMarks);
abstract member SaveAs : obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj * obj -> unit
Public Sub SaveAs (Optional ByRef FileName As Object, Optional ByRef FileFormat As Object, Optional ByRef LockComments As Object, Optional ByRef Password As Object, Optional ByRef AddToRecentFiles As Object, Optional ByRef WritePassword As Object, Optional ByRef ReadOnlyRecommended As Object, Optional ByRef EmbedTrueTypeFonts As Object, Optional ByRef SaveNativePictureFormat As Object, Optional ByRef SaveFormsData As Object, Optional ByRef SaveAsAOCELetter As Object, Optional ByRef Encoding As Object, Optional ByRef InsertLineBreaks As Object, Optional ByRef AllowSubstitutions As Object, Optional ByRef LineEnding As Object, Optional ByRef AddBiDiMarks As Object)

参数

FileName
Object

可选对象Optional Object. 文档的名称。The name for the document. 默认值为当前文件夹和文件名。The default is the current folder and file name. 如果从未保存过此文档,则使用默认文件名(例如 Doc1.doc)。If the document has never been saved, the default name is used (for example, Doc1.doc). 如果已经存在具有指定文件名的文档,则覆盖此文档,并且在覆盖前不提示用户。If a document with the specified file name already exists, the document is overwritten without the user being prompted first.

FileFormat
Object

可选对象Optional Object. 文档的保存格式。The format in which the document is saved. 可以是任何 WdSaveFormat 常量。Can be any WdSaveFormat constant. 若要将文档保存为其他格式,请为该对象的属性指定适当的值 SaveFormat FileConverterTo save a document in another format, specify the appropriate value for the SaveFormat property of the FileConverter object.

LockComments
Object

可选对象Optional Object. 如果该属性值为 True,则锁定文档备注。True to lock the document for comments. 默认值为 FalseThe default is False.

Password
Object

可选对象Optional Object. 用于打开文档的密码字符串(请参阅下面的“说明”。A password string for opening the document. 请参阅下面的"说明")。(See Remarks below.)

AddToRecentFiles
Object

可选对象Optional Object. 如果该属性值为 True,则将文档添加到“文件”菜单上最近使用的文件列表中。True to add the document to the list of recently used files on the File menu. 默认值为 TrueThe default is True.

WritePassword
Object

可选对象Optional Object. 用于将更改保存到文档的密码字符串(请参阅下面的“说明”。A password string for saving changes to the document. (See Remarks below.)

ReadOnlyRecommended
Object

可选对象Optional Object. 如果该属性值为 True,则每次打开文档时,Microsoft Word 都将建议采用只读方式。True to have Microsoft Word suggest read-only status whenever the document is opened. 默认值为 FalseThe default is False.

EmbedTrueTypeFonts
Object

可选对象Optional Object. 如果该属性值为 True,则 TrueType 字体随文档一起保存。True to save TrueType fonts with the document. 如果省略此参数,则该 EmbedTrueTypeFonts 参数假定属性的值 EmbedTrueTypeFontsIf omitted, the EmbedTrueTypeFonts argument assumes the value of the EmbedTrueTypeFonts property.

SaveNativePictureFormat
Object

可选对象Optional Object. 如果图形是从其他平台(例如 Macintosh)导入的,则为 True ,仅保存导入图形的 Windows 版本。If graphics were imported from another platform (for example, Macintosh), True to save only the Windows version of the imported graphics.

SaveFormsData
Object

可选对象Optional Object. 如果为 True ,则将用户在窗体中输入的数据保存为数据记录。True to save the data entered by a user in a form as a data record.

SaveAsAOCELetter
Object

可选对象Optional Object. 如果文档包含附加的邮件,当该属性值为 True 时,将文档存为 AOCE 信函(同时保存邮件)。If the document has an attached mailer, True to save the document as an AOCE letter (the mailer is saved).

Encoding
Object

可选 MsoEncodingOptional MsoEncoding. 用于另存为编码文本文件的文档的代码页或字符集。The code page, or character set, to use for documents saved as encoded text files. 默认为系统代码页。The default is the system code page.

InsertLineBreaks
Object

可选对象Optional Object. 在将文档保存为文本文件时,如果该属性值为 True,则在每一行文本后插入换行符。If the document is saved as a text file, True to insert line breaks at the end of each line of text.

AllowSubstitutions
Object

可选对象Optional Object. 将文档保存为文本文件时,如果该属性值为 True,则 Word 可以将一些符号替换为相似的文本。If the document is saved as a text file, True allows Word to replace some symbols with text that looks similar. 例如,将版权符号显示为 (c)。For example, displaying the copyright symbol as (c). 默认值为 FalseThe default is False.

LineEnding
Object

可选对象Optional Object. Word 在另存为文本文件的文档中标记换行符和分段符的方式。The way Word marks the line and paragraph breaks in documents saved as text files. 可以是任何 WdLineEndingType 常量。Can be any WdLineEndingType constant.

AddBiDiMarks
Object

可选对象Optional Object. 如果该属性值为 True,则为输出文件添加控制符,以保留原始文档中文本的双向版式。True adds control characters to the output file to preserve bi-directional layout of the text in the original document.

注解

避免在应用程序中使用硬编码的密码。如果某个过程需要密码,可要求用户提供密码,将其以变量形式进行存储,然后在编码中使用该变量。Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

适用于