Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

ConvertFrom-OfficeImage

Module PSWriteOffice
Inputs
OfficeIMO.Pdf.Ocr.PdfSearchableOcrReview
Outputs
System.IO.FileInfo PSWriteOffice.Services.Ocr.OfficeImageConversionResult

Exports a recognized image as editable Excel, Word, text, Markdown, HTML, JSON, CSV or searchable PDF.

Syntax

ConvertFrom-OfficeImage [-CsvOptions <CsvSaveOptions>] [-ExcelOptions <PdfTablesToExcelOptions>] [-FirstRowIsHeader] [-Force] [-HtmlOptions <PdfToHtmlOptions>] [-InputObject] <PdfSearchableOcrReview> [-OutputPath] <String> [-PassThru] [-WordOptions <PdfToWordOptions>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Recognize once with Get-OfficeImageDocument, inspect its evidence, then reuse that snapshot for each output. Excel and CSV contain detected tables only. CSV requires exactly one table. Empty recognition or missing tables fail before output publication.

Examples

Authored help example

Export an image as Excel and Word.

$image = Get-OfficeImageDocument -Path .\Ledger.png
$image | ConvertFrom-OfficeImage -OutputPath .\Ledger.xlsx -FirstRowIsHeader -PassThru
$image | ConvertFrom-OfficeImage -OutputPath .\Ledger.docx

Excel receives caller-confirmed headers and typed columns. PassThru returns recognition evidence and the format conversion report.

Customize CSV formatting while retaining formula escaping.

$csv = @{ Delimiter = ';'; FormulaInjectionPolicy = 'Escape' }
$image | ConvertFrom-OfficeImage -OutputPath .\Ledger.csv -CsvOptions $csv

Set Escape explicitly when customizing CSV formatting for spreadsheet consumption. Every recognized table row is written as data without a synthesized header, regardless of IncludeHeader.

Parameters

-CsvOptions CsvSaveOptions optional
CSV field formatting and formula policy. When omitted, formula-like source text is escaped, including negative numeric text. Supplied options retain their FormulaInjectionPolicy; a new CsvSaveOptions object defaults to Preserve. Set Escape explicitly when customizing options for spreadsheet consumption. Every recognized table row is written as data without a synthesized header, regardless of IncludeHeader. This command controls UTF-8, uncompressed file output and replacement through Force; CsvOptions controls field formatting and formula handling.
-ExcelOptions PdfTablesToExcelOptions optional
Advanced Excel typing, culture, row limit and table formatting settings.
-FirstRowIsHeader SwitchParameter optional
Confirm the first row of each Excel table with unknown schema as column headers.
-Force SwitchParameter optional
Replace an existing destination after conversion succeeds.
-HtmlOptions PdfToHtmlOptions optional
Advanced HTML projection settings. Word and HTML defaults exclude the original scan from editable content.
-InputObject PdfSearchableOcrReview requiredposition: 0pipeline: True (ByValue)
Recognized image review returned by Get-OfficeImageDocument.
-OutputPath String requiredposition: 1
Output path. The extension selects .xlsx, .docx, .pdf, .txt, .md, .html, .json or .csv.
-PassThru SwitchParameter optional
Return output location, source review and format report instead of FileInfo.
-WordOptions PdfToWordOptions optional
Advanced Word projection settings.

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.

Outputs

PSWriteOffice.Services.Ocr.OfficeImageConversionResult: Output location, recognition evidence and format projection report from an image export.