v8.9.0: 🧩 Macro-Enabled Files, Templates & Tidier HTML and Markdown
I am pleased to announce the release of officeParser v8.9.0! Word's, Excel's and PowerPoint's macro-enabled files, templates and slideshows are read, a footnote with id 0 is kept, HTML can leave out footnote back-links and give each sheet a header row, Markdown writes a column aligned paragraph by paragraph as the column's alignment, and pdf.js moves to 6.5.438.
[!WARNING] Behavior changes
- Markdown column alignment comes from the cells' paragraphs. A column whose cells each hold one paragraph, all centred or all right-aligned, is now written as
:---:or---:with plain cells, where each cell was a<div style="text-align: ...">under| --- |. Columns holding anything else keep each cell's own alignment.- Under
sheetLayout: 'tables'a sheet's heading has one id, from its text (<h2 id="visits">), as every other heading's is. Thesheet-Nid and the empty anchor before the heading are gone.- Browsers loading their own PDF worker point
pdfWorkerSrcatpdfjs-dist@6.5.438'spdf.worker.min.mjs.
.docm, .dotx, .dotm, .xlsm, .xltx, .xltm, .pptm, .potx, .potm, .ppsx and .ppsm were refused as unsupported, by file name and from a buffer, though only their main part's content type differs from a DOCX's, XLSX's or PPTX's. Each is now read as its document is, and fileType takes their names. Their macros are not read. Thanks to @AButtiens for the report.
Separator notes were told apart by their ids, -1 and 0, as Word numbers them, so a file whose first real note has id 0 (as WPS Office writes) lost it. Separators are now told apart by their type. Thanks to @AButtiens for the report.
await ast.to('html', { htmlConfig: { footnoteBackLinks: false } }); // notes without the ↩ link
await ast.to('html', { htmlConfig: { sheetLayout: 'tables', sheetHeaderRow: 'first' } });
footnoteBackLinks: falsewrites each footnote and endnote with its own content only, for a host that keeps a note's markup as its text. On by default.sheetHeaderRow: 'first'makes each sheet's first row its header row undersheetLayout: 'tables', so a sheet of column names becomes a table with a header, and its Markdown a proper GFM table.
A table whose cells each hold one centred or right-aligned paragraph is now written as the column's alignment instead of HTML in every cell. The header's left-aligned paragraph makes the column :---, and cells that show nothing are passed over.
- HTML: a header row with empty columns keeps its cells in their columns. In a sheet's table, a header row's cells after an empty column were written a column to the left.
- PDF: pdf.js 6.5.438, with what PDFs read as unchanged, and each font's data let go once it is bound, so long documents with many fonts stay lean.
See the full list in the changelog.
npm install officeparser@8.9.0
🔗 Full Changelog: View v8.9.0 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.8.0: 📊 Charts Everywhere, Word & RTF Content, Template Conditions
I am pleased to announce the release of officeParser v8.8.0! Word charts are read, every chart keeps its points, levels, axes and formats and reaches every output, Word and RTF content that used to vanish on the way out (embedded objects, equations, tracked deletions, EMF and WMF pictures) is kept, template conditions take filters and compare numbers on request, and spreadsheets keep their formulas.
Thanks to @setthase, @jayhemnani9910, @L4XB, @brennanbutler01, @gezerui888, @nicolasdev and @ceolinwill, whose pull requests and reports are in this release.
- Word charts are read as chart nodes with their data, as in PowerPoint and Excel (#131).
- Every point keeps its place: a blank point no longer shifts values onto the wrong category (#136); multi-level categories stay apart (#139); number formats and shown text are kept (#140); every axis is read, with each series' chart type (#143); scatter and bubble charts keep their X values and sizes (#144).
- Every output writes a chart: Markdown and RTF as their data's table, EPUB as a table, the native PDF engine draws charts in a line of text too. CSV reports the charts it leaves out.
Embedded objects (an Excel sheet, an equation) are shown by their preview picture; RTF tracked deletions are left out, RTF equations are read, RTF embedded objects show their last look; EMF and WMF pictures are kept and typed, and the native PDF engine draws the bitmap they hold. A content control's placeholder prompt is no longer read as text (includePlaceholderText writes it).
{{ if (answer | lower) == "yes" }} // filters in conditions
{{ if status <> "paid" }} // <> reads as !=
numericTextComparison: 'number' compares two number texts as numbers, exactly; by default they compare as text, as before, now with a TEMPLATE_NUMBERS_COMPARED_AS_TEXT warning when ordered. dataNumberSeparators takes a list of ways to read a number and refuses text they read differently.
XLSX cell formulas are read beside their values (CellMetadata.formula, never written into any output); prefixed SpreadsheetML (#153) and entity-encoded values are read; workbooks saved without calculated results keep their cells. Hidden PPTX and ODP slides are marked, and speaker notes no longer end with the notes page's slide number (#137, #138).
- PDF output leaves hidden slides out, with their notes, as it already does hidden sheets;
pdfConfig.printHiddenprints them. - Markdown asks
onNodeonce about a whole line in an HTML table cell or list item, instead of about each part.
- PDF words are no longer glued together where a font's space glyph reads as a tab (#158), as they were since 8.4.0.
- Markdown inside HTML table cells is kept, never shown as a code like
hxt8aparnhc:0. - Equations keep their braces (
\frac{a}{b}, not\fracab) in LaTeX, Markdown and every output that writes them. - Pictures in PDF list items, headings and footnotes are drawn, and each equation written as its LaTeX source is reported.
- Pictures are embedded by what their bytes are (a JPEG named
.pngis drawn), and PPTX, ODP and RTF output no longer fail on a picture whose data is not base64. abortSignalstops reading an archive, and the browser bundles no longer definewindow.setImmediate.- A chart shown at many places, and very large hostile pictures, no longer multiply the output or its memory.
See the full list in the changelog.
npm install officeparser@8.8.0
🔗 Full Changelog: View v8.8.0 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.7.1: 🩹 Hyphens, Chart Sheets & Tab Order
A patch release of fixes. Two of them put back behaviour earlier releases had: PDF layout text keeps a word's hyphen at a line break again, and a workbook's hidden chart sheet no longer hides the worksheet beside it.
Thanks to @setthase and @trackoor, whose reports drove this release, and to @jihtsan, whose pull request puts a workbook's sheets in tab order and gives each tab the name and hidden state of its own part.
- PDF layout text keeps a word's hyphen at the line break. A word hyphenated at a line end ("agree-" then "ment") was printed in layout text as "agree" and "ment", its hyphen gone; it is "agree-" and "ment" again, as before 8.0.0, in text and in PPTX and ODP slides. Dashes that divide no word keep their place. (#145)
- XLSX sheets come out in the workbook's tab order, not the order of the files in the package. (#130)
- A chart sheet no longer takes the name and hidden state of the worksheet with the same number, so a hidden chart sheet no longer hides that worksheet's content in PDF output. Every part a workbook names is found by its full path, so comments behind absolute targets are attached, and pictures and charts in a drawing named by one are placed. (#141)
- A chart sheet's chart is placed in its own tab when attachments are extracted. (#142)
- A mistyped operator in a template condition is named as typed, and a picture left out of an output says which picture and why.
npm install officeparser@8.7.1
🔗 Full Changelog: View v8.7.1 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.7.0
I am pleased to announce the release of officeParser v8.7.0! Templates fill OpenDocument text files as well as Word files and tell you about text that only looks like a tag, <details> and figure captions survive the trip through HTML and Markdown, note references show their real marks, and a set of fixes keeps small hostile files from growing into huge outputs.
OfficeTemplate.render, tags() and check() now fill .odt and .ott templates with the same tags and data as Word's: text split across spans, headers and footers, notes, comments, text boxes, list items and table rows. An .ott renders to an .odt.
const filled = await OfficeTemplate.render('letter.ott', { data });
- Text that looks like a tag but is not one (
{{first name}},{{ name }, full-width braces) is listed bytags()and warned once byrender()andcheck()withTEMPLATE_NOT_A_TAG. dataNumberSeparatorsreads numbers written as text with a decimal comma ('1.234,50'), and text that is a number compares with a number in conditions.- A keyword spelt as other template languages spell it (
elseif,end if) carries the fix indetails.suggestion.
<details>/<summary> is read from HTML and Markdown as a disclosure node with a summary node, written back as such in HTML, EPUB and Markdown and as a bold summary line elsewhere. <kbd> is read as keyboard input, and a <figure>'s caption is read as the picture's (ImageMetadata.caption) and written in every format and image mode.
htmlConfig.sheetLayout: 'tables' writes each sheet of a workbook as a heading and a plain table, for pages that embed a workbook in a document.
- Note references show the note's mark, not its internal id (
2,ftn1), following ODT's notes configuration. - RTF bullet lists with numbered deeper levels stay bullet lists.
- A quote of several paragraphs stays one quote in HTML, EPUB, Markdown and LaTeX.
- XHTML is read as HTML without a type warning.
- Markdown keeps text it dropped after an empty first list item and in items holding a lone carriage return.
- Small documents can no longer grow into huge outputs through repeated headers, nested text boxes or styled rich strings, and large workbooks of repeated rich text are read whole.
- The native PDF engine and the chunk splitter work in bounded memory on very long paragraphs; the PDF is byte for byte the same.
- LaTeX writes a highlight through one command per colour, about half the size, and highlighted underlined text wraps.
📝 On the blog: Filling an OpenDocument Template, Text That Looks Like a Tag, Reading a Details Block in Markdown the Way GitHub Shows It and How a Document Library Is Tested.
npm install officeparser@8.7.0
🔗 Full Changelog: View v8.7.0 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.6.0
I am pleased to announce the release of officeParser v8.6.0! Templates can list their tags and check data before a render, form fields in Word and OpenDocument files are read instead of dropped, sections that restart their page numbers keep them, and PDF parsing works beside an application's own pdf.js of another version.
Thanks to @setthase, whose report drove the pdf.js fix in this release.
OfficeTemplate.tags() lists a template's fields and block tags, with their parts, paths, filters and loops, with no data needed. OfficeTemplate.check() reads your data against the template without rendering and returns every problem a render with onMissing: 'error' would reject for, all at once, each with its part and loop pass:
const problems = await OfficeTemplate.check('invoice.docx', { data });
// [{ code: 'TEMPLATE_FIELD_MISSING', field: 'line.qty', loops: [{ list: 'lines', index: 1 }], ... }]
parseOffice rejected every PDF ("The API version ... does not match the Worker version") when an application's own pdfjs-dist of another version had loaded first. officeParser now runs pdf.js's worker on a module of its own, in either load order. pdfjs-dist stays pinned to the version officeParser is tested with; the README explains why.
Word's legacy check boxes read as ☒ or ☐ and its drop-downs as the selected entry. OpenDocument check boxes, radio buttons, text fields, list and combo boxes read as they show. All were dropped before. The native PDF engine draws ☐ ☑ ☒ as boxes when no font has them, instead of ?.
A Word, RTF or ODT section that restarts its page numbers (a body at 1 after front matter) is read into PageSetup.pageNumberStart and numbered so in DOCX, ODT, RTF, LaTeX and the native PDF engine.
A workbook's HTML switches sheets by CSS where its script does not run: scripts off, a sandboxed frame, or a fragment inserted into a page.
- A pdf.js document your own code opens no longer moves PDF parses out of the separate process.
- pdf.js documents your own code opens no longer print warnings after an in-process parse.
- A preloaded pdf.js worker parses in the browser under
allowRemoteAssets: false. PDF_NO_TEXT_EXTRACTEDsays how much text was read and names fonts with no character map.- HTML workbooks show one sheet at a time in frames that block storage.
📝 On the blog: Two Versions of pdf.js in One Process and Form Fields That Were Never Text.
npm install officeparser@8.6.0
🔗 Full Changelog: View v8.6.0 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.5.0
I am pleased to announce the release of officeParser v8.5.0! A PDF's running headers and footers stay out of its text when some pages have none, and each page prints its own in Word, ODT, RTF, LaTeX and the native PDF engine. List markers read in sequence, Markdown tables take their options, and a known Brotli flaw is kept away.
Thanks to @svineshreddy97-max, @CeamKrier, @jihtsan and @L4XB, whose reports and pull requests drove this release.
[!WARNING] Behavior changes
enginesnow names the Node.js releases with the Brotli fix:>=22.23.4 <23 || >=24.22.1 <25 || >=26.12.1. Older ones still run; a PDF's or font's Brotli data is decoded in JavaScript, andBROTLI_DECODER_AVOIDEDsays so.
A tagged PDF's artifacts go to auxiliary again where some pages have none and where the numbers change style. Lines that differ are parts: a first page's, even pages', or a section at each change or restart (PageSetup.pageNumberStart), so each page prints its own. Default exports now carry section and type on these headers. A line with a number of its own stays in the text.
"560Retirement" reads "560 Retirement" where a PDF draws a run in a tiny font before a word.
Cells honor fallbackToHtml.inlineFormatting and textFormatting. Colour and size spans are gone by default, so one large PDF's Markdown fell from 829 KB to 467 KB; turn inlineFormatting on to keep them. Nothing in a cell can end the HTML block.
A new warning, PDF_FONT_UNMAPPED, names a font whose text is likely its glyph ids, with its pages in details.pages, so a caller can tell such text from real text and reach for OCR.
(l), (m) and (C) were read as 50, 1000 and 100. They read in sequence now, and Markdown and chunks keep the label: - (l) Annual reports. mdConfig.listMarkers: 'numbers' writes numbers.
- A PDF or font never reaches a Brotli decoder with a known flaw (CVE-2026-111497).
- DOCX non-breaking hyphens and positional tabs are read as characters (#119).
- RAG chunks keep surrogate pairs whole at their boundaries (#121).
📝 On the blog: Text That Looks Real: A PDF Font With No Map and The Answer Was in the Glyph's Name.
npm install officeparser@8.5.0
🔗 Full Changelog: View v8.5.0 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.4.1
I am pleased to announce the release of officeParser v8.4.1! It reads the values of a filled PDF form as text where they stand, takes an untagged PDF's running headers and footers out of its body text, and writes their page numbers as live page fields in Word, OpenDocument, RTF and LaTeX output.
Each form field's value is text at its field, beside its label: a text field's value, a check box or radio button as ☒ or ☐, a choice field's selected options. A value under a table's head is that table's cell, and a date written one character per box reads as one value. Hidden fields, push buttons and signatures are left out.
Lines an untagged PDF repeats at the top or bottom of its pages go to auxiliary.headers and auxiliary.footers, as a tagged PDF's do, so text, Markdown and HTML output no longer repeat "Page 3 of 4" on every page. Their page numbers become page fields, so DOCX, ODT, RTF and LaTeX output number each page its own. Where it is unsure, a line stays in the text: a date, a ticket number, a chapter's head that changes, a header only some pages have. pdfParserConfig.keepHeadersAndFootersInPages: true keeps every page's in its place.
- Glyphs a font's CMap leaves out are read by their names, as Poppler reads them: "ni!ht" in a subset font reads "nicht".
- A JPEG picture in a PDF stays a JPEG, its own bytes, where it was re-encoded as a much larger PNG.
- White text on a coloured bar keeps the bar as its
backgroundColor, so it is no longer invisible in HTML, DOCX, ODT and RTF. - A PDF's custom properties are its author's own: pdf.js's structural flags no longer reach Markdown front matter, HTML meta tags or DOCX.
- HTML output writes no file name under a picture, no
langfor a document of no stated language, and pads a table's short rows. - LaTeX output writes page fields from any document, Word and ODT ones too, where it printed the saved number on every page.
- A tagged PDF's header that changes from page to page stays in its pages, where Word output printed the first chapter's on every page.
- A stamp's picture or a form field's box is read where it is drawn, not at the page's corner.
- A picture inside a PDF's soft mask is no longer extracted as one of the page's.
- Text output keeps touching runs together ("example.com." rather than "example.com ."), and spaces runs beside right-to-left text as before.
- Reading a PDF's marked content holds less memory.
npm install officeparser@8.4.1
🔗 Full Changelog: View v8.4.1 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.4.0
I am pleased to announce the release of officeParser v8.4.0! It reads a scan's recognised text as what it is, invisible text laid over a picture, and keeps it invisible when the page becomes a slide or a PDF. It reads Indic scripts and Thai whole from the PDFs LibreOffice makes, keeps a PDF's landscape pages when it becomes a Word or OpenDocument file, and takes the web's font formats, WOFF and WOFF2, for its native PDF engine.
Text a PDF draws invisibly (a scan's recognised words, as scanners, OCRmyPDF and Tesseract write them) is marked TextFormatting.invisible. PPTX and ODP output write it fully transparent and both PDF engines draw it unseen, so a scan's slide or page still looks like the scan, with its words there to select and search. Every other output writes it as text.
Each level text run of a PDF has bounds.baseline, and PPTX and ODP output place a page's lines on them: slides from a PDF line up with the page to a fraction of a point.
A page of another size or orientation starts a section, so DOCX, ODT and RTF output keep each page's size, and LaTeX output its orientation.
pdfConfig.fonts and pdfConfig.fallbackFonts take WOFF and WOFF2 files, unpacked to the font each holds and checked in linear time. The README now says which fonts draw ₹, ₽ and emoji.
A PDF warning about a page carries it as OfficeIssue.page: a picture that could not be extracted, a page that could not be loaded, and the page a budget ran out on.
- No font ends the process or is embedded for viewers to draw nothing. A WOFF2 font made subsetting throw outside the conversion; a font that cannot be read now fails the conversion with
PDF_GENERATION_FAILED, naming its option. - A character is drawn by the first font that draws it. An empty glyph (a colour emoji font's) is passed over for the next font, or the character is reported lost, where it was drawn blank.
- Indic scripts and Thai are read whole from PDFs that place each letter cluster apart.
- Font names are typefaces or none: "Type3", "GlyphLessFont" and generic families are no longer written as a typeface.
- Japanese, Chinese and Korean text in fonts a PDF does not embed is read, where every character was lost: pdf.js is given its CMaps.
- JBIG2, CCITT fax and JPEG 2000 pictures are decoded: pdf.js is given its image decoders.
pdfCMapUrlandpdfDecoderUrlsay where they come from in the browser. - A PDF picture that is left out is reported, with its page, where it was left out silently: one that cannot be decoded, and one larger than the new
pdfParserConfig.maxImagePixels. - RTF output starts each page and slide on a page of its own.
- An ODT section in columns of its own is set in its columns, without
includeBreakNodes. - More PDF tables are read right: tagged rows that leave cells out, cells set close together, headers over two lines, merged cells set between rows, and labels with their values.
npm install officeparser@8.4.0
🔗 Full Changelog: View v8.4.0 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.3.0
I am pleased to announce the release of officeParser v8.3.0! It writes four more formats: spreadsheets as XLSX and ODS and decks as PPTX and ODP, from any document it reads. And it reads how a document is laid out, not only what it says: its pages and sections, its headers and footers, paragraph spacing, list markers, a slide's shapes and places, and what a spreadsheet hides and how it shows its numbers. The native PDF engine draws all of it, so a document converts to a PDF that looks like its printout.
[!WARNING] Behavior changes
- The default paper format is
'auto'. PDF, DOCX, ODT and LaTeX output use the document's own pages (US Letter, landscape, a slide's size) and margins where it sets them, else A4 with inch margins. Passformat: 'A4'(and amargin) for the old output.csvDelimiterdefaults to'auto': the delimiter is read from the file.- Word, ODT and RTF headers and footers are
headerandfooternodes, one per part, whereauxiliary.headersandauxiliary.footersheld every part's paragraphs in one list.- PDF output leaves out what a printout does: hidden sheet content (
pdfConfig.printHiddenprints it) and speaker notes (pdfConfig.printSpeakerNotes).- A section's start is a
breaknode by default in Word, ODT and RTF documents (with its number and setup), whateverincludeBreakNodessays, so each section's pages, columns, headers and page numbers are kept. In text and Markdown output it shows nothing, and in HTML output it starts a new page in print.
ast.to('xlsx') and ast.to('ods') write a workbook: a spreadsheet sheet for sheet, its values typed and shown in their number formats, with its merged cells and hidden sheets, rows and columns; any other document as its tables, a sheet each. ast.to('pptx') and ast.to('odp') write a deck: a deck slide for slide with its text boxes, pictures, shapes, tables and speaker notes; a PDF's pages as slides with their text where the page set it; any other document flowed onto slides under its headings. Charts are written as tables of their data. The CLI takes --to=xlsx, --to=ods, --to=pptx and --to=odp, configured by xlsxConfig, odsConfig, pptxConfig and odpConfig.
const ast = await OfficeParser.parseOffice('report.pdf');
const { value: deck } = await ast.to('pptx'); // Uint8Array
const { value: workbook } = await ast.to('xlsx'); // its tables, a sheet each
OfficeMetadata.pageSetup holds a document's page (size, margins, header and footer distances, columns, page numbering), and each later section's break carries its own. Headers and footers carry their kind, section and page fields, and the native PDF engine draws each page's own, with its number in its section's format (i, ii, iii for front matter).
A text frame or text box beside a document's text (ODT, Word, RTF) is a drawing node with its place, and the native PDF engine sets the text around it.
PPTX and ODP shapes have their places (bounds) and looks (drawing nodes with ShapeMetadata), slides their backgrounds, and text the size and colour its master gives. The native PDF engine draws each slide as it is designed.
Hidden sheets, rows and columns are marked, number cells record the text their format shows (CellMetadata.shownText: 19%, €120.00), and merged ranges are read as spans.
ParagraphMetadata.spacing and ListMetadata.marker are read from DOCX, ODT, RTF, HTML and PDF, and written back by the writers.
Links, alignment, indents, serif and monospaced text, footnotes at the foot of their page, shaded cells, content-sized columns, pictures in cells and lines, GIF, BMP and SVG pictures, charts with their titles, and Hindi and other Indic scripts shaped with their conjuncts (copied out as written).
- Word justified paragraphs read as justified; nested Word list levels count afresh under each parent.
- PDF: turned text read whole with its angle; look-alike CJK ideographs read as the unified ones; table cells set apart in plain text.
- PPTX text in a theme colour has its colour.
- RTF symbol words (
\emdash,\bulletand others) read as their characters. - HTML reads a page's own stylesheet and the colour in a
backgroundshorthand. - A line or page break inside a paragraph is drawn in the native PDF engine.
- A split table's header row starts every chunk of it in chunked output.
npm install officeparser@8.3.0
🔗 Full Changelog: View v8.3.0 details 🔗 Documentation & Visualizer: officeparser.harshankur.com
v8.2.0
I am pleased to announce the release of officeParser v8.2.0! Word templates grow from fill-in fields into real documents: conditions, loops over paragraphs and table rows, and Word's own number and date formats. The native PDF engine now draws in fonts you give it, so any script converts, and writes a bookmark outline. PDF parsing can keep to the headings a document tags, Excel date and time cells read as the sheet shows them, and allowRemoteAssets: false makes sure a parse fetches nothing from a CDN.
Thanks to @MasaGon and @L4XB, whose reports and fixes drove this release.
A huge shoutout to Raymond Camden (@cfjedimaster), whose ideas shaped this release's template work: conditions, loops and Word's number and date formats grew out of his suggestions.
[!WARNING] Behavior changes
- Excel date and time cells are text. A cell formatted as a date, a time or a duration reads as ISO text (
2024-09-30,14:05:00,36:00:00), where it read as the number Excel stores (45565,0.25,1.5). If you converted serial numbers yourself, drop that step.- Templates read tags they left as typed before.
{{ if paid }}and{{ for line in lines }}are now blocks, so one without its closing tag rejects withTEMPLATE_SYNTAX, and{{ name | upper }}or{{ total | format "0.00" }}is now filled.{{else}},{{endif}}and{{endfor}}are block tags: a field with one of those names is no longer filled, and one with no block to belong to rejects.{{if}}and{{for}}alone, which were filled as fields namedifandfor, are now left as text. A block keyword spelt as other template languages spell it (elseif,elif,end if) rejects, naming the spelling to use. With custom delimiters made of letters or digits, a tag is the shortest stretch between a start and an end delimiter.- A template is held to
decompressionLimits.maxXmlElements, as a parse is: a template whose elements, tags and the tokens in its tags together number more than that rejects withXML_ELEMENT_LIMIT_EXCEEDED.- A template field whose value is a list, an object or a function rejects with
TEMPLATE_DATA_INVALID, where it was written as[object Object], its items joined by commas, or the function's source. Loop over a list, or name the field you want ({{ customer.name }}).- A Markdown table's header row is a header, and no longer bold. It is written as
<th>in a<thead>, and in DOCX, ODT, RTF and LaTeX as a repeating header row without added bold, as a header row from HTML or Word already was. Bold an author typed in a header cell is kept. RTF now writes every header row with\trhdrand reads a\trhdrrow as the header.- HTML output loads Chart.js only for a page that draws a chart. With no chart script to draw with (
htmlConfig.chartJsSrc: '', or a parse underallowRemoteAssets: false), a chart is written as a table of its values, with aCONTENT_NOT_REPRESENTABLEwarning.- The native PDF engine's
CONTENT_NOT_REPRESENTABLEwarnings carrydetails.reason, and the one for text that could not be drawn comes once, when the conversion ends, with a count and a sample. A chart raises it too.- An embed size or video id that is not one is not read. A Markdown or HTML width or height must be a CSS length, and a video id an id; a
::youtubedirective with an id that is not one stays text.
OfficeTemplate.render now keeps or drops content with {{ if }} and repeats it with {{ for }}. Where the tags sit decides what they cover, so a template needs no special markup:
| Where the tags are | What repeats or is kept |
|---|---|
| In one paragraph | The text between them |
| In paragraphs of their own | The paragraphs between them (the tag paragraphs go too, leaving no blank line) |
| In different cells of one table | Whole table rows |
{{ for line in lines }} {{ line.item }} {{ line.qty }} {{ line.price | format "$#,##0.00" }} {{ endfor }}
{{ if total > 1000 }}Free shipping.{{ else }}Shipping: $15.{{ endif }}
Conditions compare and combine fields, numbers, strings, dates, true, false and null. Inside a loop, loop.index, loop.number, loop.first, loop.last and loop.length describe the pass. Each copy of a picture, bookmark, paragraph, content control, footnote or comment gets ids of its own, so the output opens in Word without repair, and a footnote in a loop reads that pass's item. Two new errors name the tag and the part when something does not fit: TEMPLATE_SYNTAX and TEMPLATE_DATA_INVALID. decompressionLimits.maxRepeatedContent bounds what loops can add.
{{ total | format "$#,##0.00" }} -> $1,250.50
{{ due | format "MMMM d, yyyy" }} -> November 1, 2026
{{ name | upper }} -> ACME CORP
The pictures are Word's own (its \# and \@ switches), with sections for negative numbers and zero, percentages and quoted text. Formatting is done by officeParser, not the runtime's Intl, so a template renders the same in every Node version and browser. numberSeparators, dateNames and utcOffsetMinutes set what it writes, and formatters adds filters of your own.
pdfConfig.fonts and pdfConfig.fallbackFonts take .ttf/.otf files. Each character is drawn in the first font that has it, words are shaped (ligatures, Arabic joining, Indic conjuncts), and a right-to-left line is laid out from the right edge. A Greek, Hindi, Arabic or CJK document no longer converts to question marks. Fonts are subset to the glyphs used. Embedding needs the optional peer @pdf-lib/fontkit; without fonts nothing changes. pdfConfig.outline: true now writes a bookmark outline in the native engine too.
pdfParserConfig.headingDetection: 'tags' gives only the headings a PDF's structure tree tags, and HeadingMetadata.levelSource says what decided each heading ('tags' or 'font-size').
A cell whose number format shows a date, a time or a duration reads as the sheet shows it, in ISO form, in 1900 and 1904 workbooks alike, as ODS cells already read. Contributed by @L4XB in #116.
With allowRemoteAssets: false, a parse that would load the pdf.js worker or Tesseract's files from a CDN rejects with the new REMOTE_ASSET_BLOCKED error, naming the option to set. ocrConfig.cacheMethod controls Tesseract's language-data cache, and maxPasswordAttempts sets how often onPassword is asked.
- Markdown tables keep a line break alone in a cell, and quoted directive and attribute values (
::youtube{id="..."},{width="50%"}) lose their quotes. - OCR runs each image on a worker created with that parse's options, not one another parse created with other paths.
- A config naming some
ocrConfigoptions gets the defaults for the rest: one giving bothlanguageandworkerPathwas taken as complete, its other options left unset and unchecked. - An invalid
headingDetectionvalue is reported withINVALID_CONFIG_VALUE, and the default is used. OfficeTemplate.renderreports a misspelt option, and anonMissingvalue it does not take, using'keep'.- A
decompressionLimitsvalue that is not a number of 0 or more is reported, and its default used: one such asNaNor'x'used to turn its bound off without a word. - HTML under hundreds of nested wrappers is read in linear time.
- The native PDF engine wraps header cells at their bold width, and draws em spaces, thin spaces and other spaces as spaces.
npm install officeparser@8.2.0
🔗 Full Changelog: View v8.2.0 details 🔗 Documentation & Visualizer: officeparser.harshankur.com