none
向word文件追加文件内容不成功 RRS feed

  • 问题

  • 代码如下:word为2007版本,第一个语句执行后将原来的文件内容替换了,第二个语然执行成功,请达人指点。
    document.Content.InsertFile(strFileName, ref   missing, ref   confirmConversion, ref   link, ref   attachment);
    document.Content.InsertAfter("追加内容");
    2009年8月8日 19:26

答案

  • 你好

    document.Content.InsertAfter用于向Range追加文本
    而对于InsertFile方法
     
    C#
    void InsertFile(
    	[In] string FileName, 
    	[In, Optional] ref object Range, 
    	[In, Optional] ref object ConfirmConversions, 
    	[In, Optional] ref object Link, 
    	[In, Optional] ref object Attachment
    );
    C++
    public: Void InsertFile(
    	tring^ FileName, 
    	&Object^ Range, 
    	&Object^ ConfirmConversions, 
    	&Object^ Link, 
    	&Object^ Attachment
    );
    J#
    public void InsertFile(
    	/*in*/System.String FileName, 
    	/*in*/System.Object Range, 
    	/*in*/System.Object ConfirmConversions, 
    	/*in*/System.Object Link, 
    	/*in*/System.Object Attachment
    );
    JScript
    function InsertFile(
    	 FileName : String, 
    	 Range : Object, 
    	 ConfirmConversions : Object, 
    	 Link : Object, 
    	 Attachment : Object
    );

     

    Parameters

    FileName

    Required String. The path and file name of the file to be inserted. If you don't specify a path, Microsoft Word assumes the file is in the current folder.

    Range

    Optional Object. If the specified file is a Word document, this parameter refers to a bookmark. If the file is another type (for example, a Microsoft Excel worksheet), this parameter refers to a named range or a cell range (for example, R1C1:R3C4).

    ConfirmConversions

    Optional Object. True to have Word prompt you to confirm conversion when inserting files in formats other than the Word Document format.

    Link

    Optional Object. True to insert the file by using an INCLUDETEXT field.

    Attachment

    Optional Object. True to insert the file as an attachment to an e-mail message.


    Wenn ich dich hab’,gibt es nichts, was unerträglich ist.坚持不懈!http://hi.baidu.com/1987raymond
    2009年8月9日 4:36
    版主