ashishd751 / react-excel-renderer

A react library to render and display excel sheets on webpage
MIT License
173 stars 53 forks source link

Images rendering #5

Closed Amulya-sb closed 4 years ago

Amulya-sb commented 5 years ago

Images are not displaying in excel sheet , any solution for images rendering.

ashishd751 commented 4 years ago

Nope, sorry, it'd require a great deal of refactoring to support image rendering in the Excel. Currently it's not on the Next Features list.

gwalshington commented 3 years ago

I wanted something similar. I know my images are always at index 6. Here is my updateFile function:

updateFile(file) {
    ExcelRenderer(file, (err, resp) => {
      if(err){
        console.log(err);
      }
      else{
        const filteredRows = resp.rows.filter(function (el) {

          if(el[6] && el[6] != "Brand Image") {
            const image_url = el[6]
            el[6] = <img src={image_url}  style={{width: 50, height: 50}}/>
          }
          return el.length != 0;
        });
        this.setState({
          file: file,
          cols: resp.cols,
          rows: filteredRows
        });
      }