ImageGear .NET v25.2 - Updated
ImageGear.Formats.Office Assembly / ImageGear.Formats.Office Namespace / ImGearWordDocument Class / ConvertFile Method
The input file path.
The output file path.
The format of the file to which the document should be resaved.




In This Topic
    ConvertFile Method (ImGearWordDocument)
    In This Topic
    Resaves a Microsoft Word document to another Microsoft Word file format.
    Syntax
    'Declaration
     
    Public Shared Sub ConvertFile( _
       ByVal inputFilePath As String, _
       ByVal outputFilePath As String, _
       ByVal format As ImGearWordFormats _
    ) 
    'Usage
     
    Dim inputFilePath As String
    Dim outputFilePath As String
    Dim format As ImGearWordFormats
     
    ImGearWordDocument.ConvertFile(inputFilePath, outputFilePath, format)
    public static void ConvertFile( 
       string inputFilePath,
       string outputFilePath,
       ImGearWordFormats format
    )
    public: static void ConvertFile( 
       string* inputFilePath,
       string* outputFilePath,
       ImGearWordFormats format
    ) 
    public:
    static void ConvertFile( 
       String^ inputFilePath,
       String^ outputFilePath,
       ImGearWordFormats format
    ) 

    Parameters

    inputFilePath
    The input file path.
    outputFilePath
    The output file path.
    format
    The format of the file to which the document should be resaved.
    Exceptions
    ExceptionDescription
    Argument inputFilePath does not refer an existing file.
    Argument inputFilePath or outputFilePath is an empty string or one of these paths cannot be resolved.
    The caller does not have the required permissions.
    Argument inputFilePath or outputFilePath is null.
    Argument inputFilePath or outputFilePath contains a colon (":") that is not part of a volume identifier.
    Argument inputFilePath or outputFilePath is too long.
    File conversion error. For additional information see the ErrorCode and Message members of the exception.
    Remarks

    The format can take one of the following values:

    WorkerDocumentType.MSWord2007XML

    WorkerDocumentType.MSWord2003XML

    WorkerDocumentType.MSWord97

    WorkerDocumentType.MSRichText

    In order to make the last option WorkerDocumentType.MSRichText available, RTF format must be initialized

    ImGearFileFormats.Filters.Add(ImGearOffice.CreateRTFFormat());

    If unsupported format is specified, the document is converted to WorkerDocumentType.MSWord2007XML

    See Also