Editra documentation

Import Word & HTML

Open existing DOCX and styled HTML files with the same secure importer used by Editra 1.1.0.

Open full example

Use the native importer

Load the productivity plugin and use File → Open, File → Import Word, or File → Import HTML. The website does not maintain a separate converter; its live examples run the exact published editra-js@1.0.1 implementation.

const editor = await Editra.init({
  selector: "#editra-editor",
  theme: "Word",
  plugins: ["productivity", "pagesize", "margins", "pagination", "export"]
});

await editor.executeCommand("importWord");
// or
await editor.executeCommand("importHTML");

What is preserved

For supported DOCX and HTML content, Editra carries forward document text, fonts, sizes, colours, alignment, paragraph spacing, tabs, lists, tables, column widths, borders, page size, orientation, margins, headers, footers, images, and safe rendered CSS where the browser can represent it.

Security boundary: imported markup is treated as untrusted. Scripts, event handlers, unsafe URLs, dangerous CSS, executable embeds, and DOM-clobbering content are rejected or removed before the document reaches the editor.

Supported files and clear errors

  • .docx uses the browser-native Editra DOCX renderer.
  • .html and .htm retain safe styles after CSS flattening and sanitization.
  • Legacy binary .doc is rejected with instructions to save it as .docx.
  • Corrupt, oversized, encrypted, or unsupported documents produce a visible error instead of displaying binary symbols.

Fidelity expectations

Editra preserves the supported browser representation without a server or third-party conversion service. Microsoft Word and browsers use different layout engines, so unsupported Word-only features can still differ. Always review regulated or print-critical documents before publication.

Open the Word and HTML import example