linways / table-to-excel

Javascript library to create "valid" excel file from html table with styles
MIT License
226 stars 109 forks source link

Error when table has two columns #13

Closed dviluk closed 5 years ago

dviluk commented 5 years ago

Hello, i have an error when using two columns

TypeError: e.columns[r] is undefined

I just modify the HTML on demo

<table id="simpleTable1" data-cols-width="70,15,10">
        <tbody>
          <tr>
            <th data-a-text-rotation="-45">Col 4 (date)</th>
            <th data-a-text-rotation="-90">Col 5</th>
          </tr>
          <tr>
            <td data-t="d">05-20-2018</td>
            <td data-t="n" data-num-fmt="$ 0.00">2210.00</td>
          </tr>
        </tbody>
      </table>

      <button id="button-excel">Create Excel</button>
rohithb commented 5 years ago

@dviluk I think this is same as #10 . Please match number of items in data-cols-width with number of columns. try

<table id="simpleTable1" data-cols-width="70,15">
        <tbody>
          <tr>
            <th data-a-text-rotation="-45">Col 4 (date)</th>
            <th data-a-text-rotation="-90">Col 5</th>
          </tr>
          <tr>
            <td data-t="d">05-20-2018</td>
            <td data-t="n" data-num-fmt="$ 0.00">2210.00</td>
          </tr>
        </tbody>
      </table>
dviluk commented 5 years ago

Too fast! Yes you are right! thank you!