SaveDOCXToFile

Document conversion, extraction, DOCX, files

Description

Converts a PDF page range into an editable DOCX file containing native paragraphs, headings, lists, tables, styles, page breaks, and optional images

Syntax

Delphi

Function TPDFlib.SaveDOCXToFile(Const PageRange: WideString;
  Options: Integer; Const FileName: WideString): Integer;

ActiveX

Function PDFlib::SaveDOCXToFile(PageRange As String,
  Options As Long, FileName As String) As Long

DLL

int DLSaveDOCXToFile(int InstanceID, const wchar_t* PageRange,
  int Options, const wchar_t* FileName);
int DLSaveDOCXToFileA(int InstanceID, const char* PageRange,
  int Options, const char* FileName);

Parameters

PageRangeA one-based page range, or an empty string for every page
OptionsThe option mask documented by SaveDOCXToStream
FileNameThe destination DOCX file path

Return values

Returns the number of converted pages, or zero when validation, extraction, packaging, or file writing fails

Remarks

The file is a standard WordprocessingML package and requires no Office automation or external conversion process

Tagged reading order, empty and merged table cells and continued tables follow SaveDOCXToStream; document analysis flags are set separately through SetStructuredTextOptions

Selected page models and included images are retained during document-wide analysis, with additional XML and package buffers

Extraction preserves the selected page and open writer tag stack; current unsaved writer tags are included without closing tags or finalising the document

Inspect GetLastStructuredTextDiagnostics for warnings and reading sources

LastErrorCode is 114 for invalid arguments and 518 for extraction, packaging, or file failures

See also

SaveDOCXToStream, SaveDOCXToFileA, ExportDocumentMarkdown