Skip to main content

Convert legacy Office files without Office automation

Office Binary to OOXML converts Microsoft Office 97–2003 binary files into modern OOXML packages in pure TypeScript. It accepts and returns Uint8Array, runs in Node.js or a modern browser, and does not require Microsoft Office.

InputOutputAPI
.ppt.pptxconvertPptToPptx()
.doc.docxconvertDocToDocx()
.xls.xlsxconvertXlsToXlsx()

Install

The SDK is currently delivered as a tarball attached to a private GitHub Release, not through the public npm registry. Download an approved release and install the local artifact:

npm install ./office-binary-to-ooxml-0.6.0.tgz

Pin an exact release in repeatable builds. Access to the private source repository does not automatically make a browser user eligible to download the SDK; distribute artifacts through your approved package or release channel.

Convert a file in Node.js

import {readFile, writeFile} from 'node:fs/promises';
import {convertPptToPptx} from 'office-binary-to-ooxml';

const source = new Uint8Array(await readFile('quarterly-report.ppt'));
const output = convertPptToPptx(source);
await writeFile('quarterly-report.pptx', output);

Use the matching high-level function for Word and Excel:

import {
convertDocToDocx,
convertXlsToXlsx,
} from 'office-binary-to-ooxml';

const docx = convertDocToDocx(docBytes);
const xlsx = convertXlsToXlsx(xlsBytes, {sourceName: 'budget.xls'});

Convert in the browser

The conversion can remain entirely on the user's device:

import {convertDocToDocx} from 'office-binary-to-ooxml';

async function convertSelectedFile(file) {
const input = new Uint8Array(await file.arrayBuffer());
const output = convertDocToDocx(input);
const blob = new Blob([output], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
});

const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = file.name.replace(/\.doc$/i, '.docx');
link.click();
URL.revokeObjectURL(link.href);
}

For large files, run conversion in a Web Worker so parsing and ZIP generation do not block the UI thread.

Options

convertPptToPptx(data, options) accepts todayDateCache when a deterministic cached value is needed for PPT date fields. Normally, omit it.

convertXlsToXlsx(data, options) supports:

OptionPurpose
sourceNamePreserves a meaningful workbook and fallback worksheet name
passwordSupplies one password or a list of candidates for encrypted BIFF workbooks
conversionTimeUses one timestamp across a batch conversion
outputDirectoryEmits optional absolute-path metadata for the destination directory

Do not infer passwords from file names or log supplied password candidates.

Error handling

import {
EncryptedFileError,
InvalidFileError,
convertPptToPptx,
} from 'office-binary-to-ooxml';

try {
const output = convertPptToPptx(input);
} catch (error) {
if (error instanceof EncryptedFileError) {
showMessage('This presentation is encrypted and needs a supported password.');
} else if (error instanceof InvalidFileError) {
showMessage('Select a valid PowerPoint 97–2003 presentation.');
} else {
reportUnexpectedConversionError(error);
}
}

Validate the file extension for user experience, but use the parser result—not the extension—as the trust boundary. Limit file size, run untrusted conversions with memory and time limits, and never overwrite the source file automatically.

Fidelity expectations

Legacy Office formats contain features that do not map perfectly to OOXML. Always keep the source file, show the generated file as a new download, and verify important documents in the target Office application. Complex layout, embedded objects, charts, macros, encryption, fonts, and application-specific extensions deserve additional testing.

The source repository already provides separate PPT, DOC, and XLS browser demos. The planned Open the live Office Binary Converter Playground. Conversion runs locally in the browser and uploaded documents will not be sent to the developers service.