Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

ConvertTo-OfficeWordMarkdown

Aliases: ConvertTo-WordMarkdown
Module
PSWriteOffice
Aliases
ConvertTo-WordMarkdown
Inputs
OfficeIMO.Word.WordDocument
Outputs
System.String System.IO.FileInfo

Converts a Word document to Markdown.

Syntax

ConvertTo-OfficeWordMarkdown
[-EnableHighlight]
[-EnableUnderline]
[-FontFamily <String>]
[-ImageDirectory <String>]
[-ImageExportMode <Base64|File>]
[-OutputPath <String>]
[-PassThru]
[-Path] <String>
[<CommonParameters>]
#
Parameter set: Path
ConvertTo-OfficeWordMarkdown
-Document <WordDocument>
[-EnableHighlight]
[-EnableUnderline]
[-FontFamily <String>]
[-ImageDirectory <String>]
[-ImageExportMode <Base64|File>]
[-OutputPath <String>]
[-PassThru]
[<CommonParameters>]
#
Parameter set: Document

Description

Returns Markdown text or saves it to a file when -OutputPath is specified.

Examples

Convert a .docx file to Markdown text.

$markdown = ConvertTo-OfficeWordMarkdown -Path .\report.docx

Loads the document and returns Markdown markup.

Save Markdown to disk.

ConvertTo-OfficeWordMarkdown -Path .\report.docx -OutputPath .\report.md -PassThru

Writes report.md and returns the file info.

Parameters

-EnableHighlight SwitchParameter optional
Wrap highlighted text with Markdown highlight markers.
-EnableUnderline SwitchParameter optional
Wrap underlined text with HTML underline tags.
-FontFamily String optional
Optional font family that should be treated as inline code.
-ImageDirectory String optional
Directory used when exporting images as files.
-ImageExportMode ImageExportMode optional
Controls how images are emitted during Markdown conversion.
Possible values: Base64, File
-OutputPath String optionalaliases: OutPath
Optional output path for the Markdown file.
-PassThru SwitchParameter optional
Emit a FileInfo when saving to disk.
-Path String requiredposition: 0aliases: FilePathsets: Path
Path to a .docx file.
-Document WordDocument requiredpipeline: True (ByValue)sets: Document
Word document instance to convert.

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.