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

Output is generated in a temporary file beside the destination and replaces it only after the complete export succeeds; invalid page selections, cancellation, generation failures, and publication failures preserve an existing destination

Hyperlink relationship targets preserve non-ASCII characters and literal entity spellings from the extracted URL

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 finalizing the document

Inspect GetLastStructuredTextDiagnostics for warnings and reading sources

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

Line breaks, tabs, source list numbering, inherited semantic languages, script-specific fonts, and internal page navigation follow the stream exporter; see SaveDOCXToStream for flags and details

See also

SaveDOCXToStream, SaveDOCXToFileA, ExportDocumentMarkdown