API Reference

Cmdlet

ConvertTo-OfficeWordDocument

Namespace PSWriteOffice
Inputs
None
Outputs
System.IO.FileInfo

Converts Word documents between supported .doc and .docx formats.

Remarks

Uses the OfficeIMO Word normal load/save conversion path, including legacy DOC diagnostics and save preflight.

Examples

Authored help example

Convert a legacy DOC file to DOCX.

PS>


ConvertTo-OfficeWordDocument -Path .\legacy.doc -OutputPath .\converted.docx -PassThru
        

Reads the .doc file and writes a .docx file.

Convert a DOCX file to native DOC.

PS>


ConvertTo-OfficeWordDocument -Path .\report.docx -OutputPath .\report.doc -Force
        

Writes a supported native Word 97-2003 .doc file.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.

Syntax

ConvertTo-OfficeWordDocument [-AllowLossyLegacyConversion] [-Force] [-Open] -OutputPath <String> [-PassThru] -Path <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AllowLossyLegacyConversion SwitchParameter optionalposition: namedpipeline: False
Allow conversion when a legacy DOC source contains unsupported or preserve-only content.
Force SwitchParameter optionalposition: namedpipeline: False
Overwrite an existing destination file.
Open SwitchParameter optionalposition: namedpipeline: False
Open the converted document after saving.
OutputPath String requiredposition: 1pipeline: Falsealiases: OutPath
Destination .doc or .docx file path.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the saved file information.
Path String requiredposition: 0pipeline: Falsealiases: FilePath
Source .doc or .docx file path.

Outputs

System.IO.FileInfo