Ziv-Barber / officegen

Standalone Office Open XML files (Microsoft Office 2007 and later) generator for Word (docx), PowerPoint (pptx) and Excell (xlsx) in javascript. The output is a stream.
MIT License
2.65k stars 471 forks source link

docx.addImage path is not defined #277

Closed aug2uag closed 5 years ago

aug2uag commented 5 years ago

Using officegen Version 0.4.5 method addImage for docx generation with path or path and image_format_type (I didn't try using opt, though it shouldn't matter)

node_modules/officegen/lib/docx-p.js:146
            var image_ext = path.extname ( image_path );
                            ^

ReferenceError: path is not defined

exception at docx-p.js:146 var image_ext = path.extname ( image_path ); may need change to switch with image_type since it's safe:

switch ( image_type ) {
    case '.bmp':
        image_type = 'bmp';
        break;

    case '.gif':
        ...