WordImport.h header

#include <ew/app/WordImport.h>

Namespace ew::app

Functions

ImportedManuscript ew::app::importWord(const QString &docxPath)

Reads a Word document docxPath (a .docx ZIP), extracts word/document.xml, and imports it via importWordXml (titled from the file name). Returns just a root Document if the file cannot be read or contains no document part.

ImportedManuscript ew::app::importWordXml(const QString &documentXml, const QString &title)

Parses the word/document.xml of a Word document (its OOXML documentXml) into an importable manuscript. title becomes the root Document; each heading paragraph (Word's "Heading N" / "Title" styles) starts a section Document nested by heading level, and the body paragraphs under a heading become that section's body (blank line between paragraphs, tabs and line breaks preserved). Text before any heading, or a document with no headings, lands in the root's body. Malformed or empty XML yields just the root Document. Documents are returned by pointer, root first.