I got data out of order when I use XLSX.utils.table_to_book to export xlsx. #3175

Open
opened 2024-08-13 04:33:43 +00:00 by Aganivi · 6 comments

In Excel

You can clearly see that this line of data is in the wrong position.

image

At Table of HTML

This table has only one tr label, there's a problem with the data it's exporting. I try to export a table with two tr label, the exported data is normal.

image

Data

It should start from 1.

image

Code

function downloadHTMLTableAsXLSX(table_elt, title) {
  let workbook = XLSX.utils.table_to_book(table_elt);
  console.log(`workbook:`, workbook);
  var ws = workbook.Sheets['Sheet1'];
  XLSX.utils.sheet_add_aoa(ws, [['Created ' + new Date().toISOString()]], {
    origin: -1,
  });
  XLSX.writeFile(workbook, `${title}.xlsx`);
}
### In Excel You can clearly see that this line of data is in the wrong position. <img width="1284" alt="image" src="/attachments/0ea0ea2f-5b52-4868-9a72-ef310f460aba"> ### At Table of HTML This table has only one tr label, there's a problem with the data it's exporting. I try to export a table with two tr label, the exported data is normal. ![image](/attachments/02df2922-c368-4682-92b1-56698b09f9cb) ### Data It should start from 1. ![image](/attachments/3198d921-41ab-4415-9654-ccaa1cdf92c1) ### Code ```js function downloadHTMLTableAsXLSX(table_elt, title) { let workbook = XLSX.utils.table_to_book(table_elt); console.log(`workbook:`, workbook); var ws = workbook.Sheets['Sheet1']; XLSX.utils.sheet_add_aoa(ws, [['Created ' + new Date().toISOString()]], { origin: -1, }); XLSX.writeFile(workbook, `${title}.xlsx`); } ```
Owner

None of the images were added -- can you try uploading the screenshot and posting the HTML table?

None of the images were added -- can you try uploading the screenshot and posting the HTML table?
Owner

If you can share the screenshots again, or at least share the HTML table innerHTML code, we can reopen the issue and investigate further.

If you can share the screenshots again, or at least share the HTML table innerHTML code, we can reopen the issue and investigate further.
Author
<table style="width: 100%;"><thead><tr><th rowspan="2" colspan="1">保险单年度</th><th rowspan="2" colspan="1">被保险人年龄</th><th rowspan="2" colspan="1">当年度保险费</th><th rowspan="2" colspan="1">累计保险费</th><th rowspan="2" colspan="1">当年度年金/满期金</th><th rowspan="2" colspan="1">累计年金/满期金</th><th rowspan="2" colspan="1">公共交通工具意外全残保险金</th><th rowspan="2" colspan="1">身故保险金</th><th rowspan="2" colspan="1">退保金(现金价值)</th></tr></thead><tbody class="myRedActive" style="width: 100%"><tr py="1" attage="35"><td>1</td><td>35</td><td>12,000.00</td><td>12,000.00</td><td>0</td><td>0</td><td>1,200</td><td>12,000</td><td>4,200</td></tr><tr py="2" attage="36"><td>2</td><td>36</td><td>12,000.00</td><td>24,000.00</td><td>0</td><td>0</td><td>2,400</td><td>24,000</td><td>10,164</td></tr><tr py="3" attage="37"><td>3</td><td>37</td><td>12,000.00</td><td>36,000.00</td><td>0</td><td>0</td><td>3,600</td><td>36,000</td><td>17,244</td></tr><tr py="4" attage="38"><td>4</td><td>38</td><td>12,000.00</td><td>48,000.00</td><td>0</td><td>0</td><td>4,800</td><td>48,000</td><td>25,092</td></tr><tr py="5" attage="39"><td>5</td><td>39</td><td>12,000.00</td><td>60,000.00</td><td>0</td><td>0</td><td>6,000</td><td>60,000</td><td>33,384</td></tr><tr py="6" attage="40"><td>6</td><td>40</td><td>12,000.00</td><td>72,000.00</td><td>0</td><td>0</td><td>7,200</td><td>72,000</td><td>42,132</td></tr><tr py="7" attage="41"><td>7</td><td>41</td><td>12,000.00</td><td>84,000.00</td><td>0</td><td>0</td><td>8,400</td><td>84,000</td><td>51,348</td></tr><tr py="8" attage="42"><td>8</td><td>42</td><td>12,000.00</td><td>96,000.00</td><td>0</td><td>0</td><td>9,600</td><td>96,000</td><td>61,068</td></tr><tr py="9" attage="43"><td>9</td><td>43</td><td>12,000.00</td><td>108,000.00</td><td>0</td><td>0</td><td>10,800</td><td>108,000</td><td>71,316</td></tr><tr py="10" attage="44"><td>10</td><td>44</td><td>12,000.00</td><td>120,000.00</td><td>0</td><td>0</td><td>12,000</td><td>120,000</td><td>82,116</td></tr><tr py="11" attage="45"><td>11</td><td>45</td><td>12,000.00</td><td>132,000.00</td><td>0</td><td>0</td><td>13,200</td><td>132,000</td><td>93,492</td></tr><tr py="12" attage="46"><td>12</td><td>46</td><td>12,000.00</td><td>144,000.00</td><td>0</td><td>0</td><td>14,400</td><td>144,000</td><td>105,480</td></tr><tr py="13" attage="47"><td>13</td><td>47</td><td>12,000.00</td><td>156,000.00</td><td>0</td><td>0</td><td>15,600</td><td>156,000</td><td>118,092</td></tr><tr py="14" attage="48"><td>14</td><td>48</td><td>12,000.00</td><td>168,000.00</td><td>0</td><td>0</td><td>16,800</td><td>168,000</td><td>131,388</td></tr><tr py="15" attage="49"><td>15</td><td>49</td><td>12,000.00</td><td>180,000.00</td><td>0</td><td>0</td><td>18,000</td><td>180,000</td><td>145,380</td></tr><tr py="16" attage="50"><td>16</td><td>50</td><td>12,000.00</td><td>192,000.00</td><td>0</td><td>0</td><td>19,200</td><td>192,000</td><td>160,116</td></tr><tr py="17" attage="51"><td>17</td><td>51</td><td>12,000.00</td><td>204,000.00</td><td>0</td><td>0</td><td>20,400</td><td>204,000</td><td>175,620</td></tr><tr py="18" attage="52"><td>18</td><td>52</td><td>12,000.00</td><td>216,000.00</td><td>0</td><td>0</td><td>21,600</td><td>216,000</td><td>191,952</td></tr><tr py="19" attage="53"><td>19</td><td>53</td><td>12,000.00</td><td>228,000.00</td><td>0</td><td>0</td><td>22,800</td><td>228,000</td><td>209,124</td></tr><tr py="20" attage="54"><td>20</td><td>54</td><td>12,000.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>240,000</td><td>227,208</td></tr><tr py="21" attage="55"><td>21</td><td>55</td><td>0.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>240,000</td><td>237,432</td></tr><tr py="22" attage="56"><td>22</td><td>56</td><td>0.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>248,112</td><td>248,112</td></tr><tr py="23" attage="57"><td>23</td><td>57</td><td>0.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>259,284</td><td>259,284</td></tr><tr py="24" attage="58"><td>24</td><td>58</td><td>0.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>270,948</td><td>270,948</td></tr><tr py="25" attage="59"><td>25</td><td>59</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>20,766</td><td>24,000</td><td>283,140</td><td>283,140</td></tr><tr py="26" attage="60"><td>26</td><td>60</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>41,532</td><td>24,000</td><td>274,176</td><td>274,176</td></tr><tr py="27" attage="61"><td>27</td><td>61</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>62,298</td><td>24,000</td><td>264,816</td><td>264,816</td></tr><tr py="28" attage="62"><td>28</td><td>62</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>83,064</td><td>24,000</td><td>255,036</td><td>255,036</td></tr><tr py="29" attage="63"><td>29</td><td>63</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>103,830</td><td>24,000</td><td>244,812</td><td>244,812</td></tr><tr py="30" attage="64"><td>30</td><td>64</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>124,596</td><td>24,000</td><td>234,132</td><td>234,132</td></tr><tr py="31" attage="65"><td>31</td><td>65</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>145,362</td><td>24,000</td><td>222,960</td><td>222,960</td></tr><tr py="32" attage="66"><td>32</td><td>66</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>166,128</td><td>24,000</td><td>211,296</td><td>211,296</td></tr><tr py="33" attage="67"><td>33</td><td>67</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>186,894</td><td>24,000</td><td>199,104</td><td>199,104</td></tr><tr py="34" attage="68"><td>34</td><td>68</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>207,660</td><td>24,000</td><td>186,360</td><td>186,360</td></tr><tr py="35" attage="69"><td>35</td><td>69</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>228,426</td><td>24,000</td><td>173,052</td><td>173,052</td></tr><tr py="36" attage="70"><td>36</td><td>70</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>249,192</td><td>24,000</td><td>159,132</td><td>159,132</td></tr><tr py="37" attage="71"><td>37</td><td>71</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>269,958</td><td>24,000</td><td>144,600</td><td>144,600</td></tr><tr py="38" attage="72"><td>38</td><td>72</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>290,724</td><td>24,000</td><td>129,396</td><td>129,396</td></tr><tr py="39" attage="73"><td>39</td><td>73</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>311,490</td><td>24,000</td><td>113,520</td><td>113,520</td></tr><tr py="40" attage="74"><td>40</td><td>74</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>332,256</td><td>24,000</td><td>96,936</td><td>96,936</td></tr><tr py="41" attage="75"><td>41</td><td>75</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>353,022</td><td>24,000</td><td>79,596</td><td>79,596</td></tr><tr py="42" attage="76"><td>42</td><td>76</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>373,788</td><td>24,000</td><td>61,476</td><td>61,476</td></tr><tr py="43" attage="77"><td>43</td><td>77</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>394,554</td><td>24,000</td><td>42,540</td><td>42,540</td></tr><tr py="44" attage="78"><td>44</td><td>78</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>415,320</td><td>24,000</td><td>22,752</td><td>22,752</td></tr><tr py="45" attage="79"><td>45</td><td>79</td><td>0.00</td><td>240,000.00</td><td>2,077</td><td>417,397</td><td>24,000</td><td>2,077</td><td>2,077</td></tr></tbody></table>

In fact, I have uploaded a screenshot to this issue, I don't know if you can see it?

You can use this HTML table.

```HTML <table style="width: 100%;"><thead><tr><th rowspan="2" colspan="1">保险单年度</th><th rowspan="2" colspan="1">被保险人年龄</th><th rowspan="2" colspan="1">当年度保险费</th><th rowspan="2" colspan="1">累计保险费</th><th rowspan="2" colspan="1">当年度年金/满期金</th><th rowspan="2" colspan="1">累计年金/满期金</th><th rowspan="2" colspan="1">公共交通工具意外全残保险金</th><th rowspan="2" colspan="1">身故保险金</th><th rowspan="2" colspan="1">退保金(现金价值)</th></tr></thead><tbody class="myRedActive" style="width: 100%"><tr py="1" attage="35"><td>1</td><td>35</td><td>12,000.00</td><td>12,000.00</td><td>0</td><td>0</td><td>1,200</td><td>12,000</td><td>4,200</td></tr><tr py="2" attage="36"><td>2</td><td>36</td><td>12,000.00</td><td>24,000.00</td><td>0</td><td>0</td><td>2,400</td><td>24,000</td><td>10,164</td></tr><tr py="3" attage="37"><td>3</td><td>37</td><td>12,000.00</td><td>36,000.00</td><td>0</td><td>0</td><td>3,600</td><td>36,000</td><td>17,244</td></tr><tr py="4" attage="38"><td>4</td><td>38</td><td>12,000.00</td><td>48,000.00</td><td>0</td><td>0</td><td>4,800</td><td>48,000</td><td>25,092</td></tr><tr py="5" attage="39"><td>5</td><td>39</td><td>12,000.00</td><td>60,000.00</td><td>0</td><td>0</td><td>6,000</td><td>60,000</td><td>33,384</td></tr><tr py="6" attage="40"><td>6</td><td>40</td><td>12,000.00</td><td>72,000.00</td><td>0</td><td>0</td><td>7,200</td><td>72,000</td><td>42,132</td></tr><tr py="7" attage="41"><td>7</td><td>41</td><td>12,000.00</td><td>84,000.00</td><td>0</td><td>0</td><td>8,400</td><td>84,000</td><td>51,348</td></tr><tr py="8" attage="42"><td>8</td><td>42</td><td>12,000.00</td><td>96,000.00</td><td>0</td><td>0</td><td>9,600</td><td>96,000</td><td>61,068</td></tr><tr py="9" attage="43"><td>9</td><td>43</td><td>12,000.00</td><td>108,000.00</td><td>0</td><td>0</td><td>10,800</td><td>108,000</td><td>71,316</td></tr><tr py="10" attage="44"><td>10</td><td>44</td><td>12,000.00</td><td>120,000.00</td><td>0</td><td>0</td><td>12,000</td><td>120,000</td><td>82,116</td></tr><tr py="11" attage="45"><td>11</td><td>45</td><td>12,000.00</td><td>132,000.00</td><td>0</td><td>0</td><td>13,200</td><td>132,000</td><td>93,492</td></tr><tr py="12" attage="46"><td>12</td><td>46</td><td>12,000.00</td><td>144,000.00</td><td>0</td><td>0</td><td>14,400</td><td>144,000</td><td>105,480</td></tr><tr py="13" attage="47"><td>13</td><td>47</td><td>12,000.00</td><td>156,000.00</td><td>0</td><td>0</td><td>15,600</td><td>156,000</td><td>118,092</td></tr><tr py="14" attage="48"><td>14</td><td>48</td><td>12,000.00</td><td>168,000.00</td><td>0</td><td>0</td><td>16,800</td><td>168,000</td><td>131,388</td></tr><tr py="15" attage="49"><td>15</td><td>49</td><td>12,000.00</td><td>180,000.00</td><td>0</td><td>0</td><td>18,000</td><td>180,000</td><td>145,380</td></tr><tr py="16" attage="50"><td>16</td><td>50</td><td>12,000.00</td><td>192,000.00</td><td>0</td><td>0</td><td>19,200</td><td>192,000</td><td>160,116</td></tr><tr py="17" attage="51"><td>17</td><td>51</td><td>12,000.00</td><td>204,000.00</td><td>0</td><td>0</td><td>20,400</td><td>204,000</td><td>175,620</td></tr><tr py="18" attage="52"><td>18</td><td>52</td><td>12,000.00</td><td>216,000.00</td><td>0</td><td>0</td><td>21,600</td><td>216,000</td><td>191,952</td></tr><tr py="19" attage="53"><td>19</td><td>53</td><td>12,000.00</td><td>228,000.00</td><td>0</td><td>0</td><td>22,800</td><td>228,000</td><td>209,124</td></tr><tr py="20" attage="54"><td>20</td><td>54</td><td>12,000.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>240,000</td><td>227,208</td></tr><tr py="21" attage="55"><td>21</td><td>55</td><td>0.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>240,000</td><td>237,432</td></tr><tr py="22" attage="56"><td>22</td><td>56</td><td>0.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>248,112</td><td>248,112</td></tr><tr py="23" attage="57"><td>23</td><td>57</td><td>0.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>259,284</td><td>259,284</td></tr><tr py="24" attage="58"><td>24</td><td>58</td><td>0.00</td><td>240,000.00</td><td>0</td><td>0</td><td>24,000</td><td>270,948</td><td>270,948</td></tr><tr py="25" attage="59"><td>25</td><td>59</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>20,766</td><td>24,000</td><td>283,140</td><td>283,140</td></tr><tr py="26" attage="60"><td>26</td><td>60</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>41,532</td><td>24,000</td><td>274,176</td><td>274,176</td></tr><tr py="27" attage="61"><td>27</td><td>61</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>62,298</td><td>24,000</td><td>264,816</td><td>264,816</td></tr><tr py="28" attage="62"><td>28</td><td>62</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>83,064</td><td>24,000</td><td>255,036</td><td>255,036</td></tr><tr py="29" attage="63"><td>29</td><td>63</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>103,830</td><td>24,000</td><td>244,812</td><td>244,812</td></tr><tr py="30" attage="64"><td>30</td><td>64</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>124,596</td><td>24,000</td><td>234,132</td><td>234,132</td></tr><tr py="31" attage="65"><td>31</td><td>65</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>145,362</td><td>24,000</td><td>222,960</td><td>222,960</td></tr><tr py="32" attage="66"><td>32</td><td>66</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>166,128</td><td>24,000</td><td>211,296</td><td>211,296</td></tr><tr py="33" attage="67"><td>33</td><td>67</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>186,894</td><td>24,000</td><td>199,104</td><td>199,104</td></tr><tr py="34" attage="68"><td>34</td><td>68</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>207,660</td><td>24,000</td><td>186,360</td><td>186,360</td></tr><tr py="35" attage="69"><td>35</td><td>69</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>228,426</td><td>24,000</td><td>173,052</td><td>173,052</td></tr><tr py="36" attage="70"><td>36</td><td>70</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>249,192</td><td>24,000</td><td>159,132</td><td>159,132</td></tr><tr py="37" attage="71"><td>37</td><td>71</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>269,958</td><td>24,000</td><td>144,600</td><td>144,600</td></tr><tr py="38" attage="72"><td>38</td><td>72</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>290,724</td><td>24,000</td><td>129,396</td><td>129,396</td></tr><tr py="39" attage="73"><td>39</td><td>73</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>311,490</td><td>24,000</td><td>113,520</td><td>113,520</td></tr><tr py="40" attage="74"><td>40</td><td>74</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>332,256</td><td>24,000</td><td>96,936</td><td>96,936</td></tr><tr py="41" attage="75"><td>41</td><td>75</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>353,022</td><td>24,000</td><td>79,596</td><td>79,596</td></tr><tr py="42" attage="76"><td>42</td><td>76</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>373,788</td><td>24,000</td><td>61,476</td><td>61,476</td></tr><tr py="43" attage="77"><td>43</td><td>77</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>394,554</td><td>24,000</td><td>42,540</td><td>42,540</td></tr><tr py="44" attage="78"><td>44</td><td>78</td><td>0.00</td><td>240,000.00</td><td>20,766</td><td>415,320</td><td>24,000</td><td>22,752</td><td>22,752</td></tr><tr py="45" attage="79"><td>45</td><td>79</td><td>0.00</td><td>240,000.00</td><td>2,077</td><td>417,397</td><td>24,000</td><td>2,077</td><td>2,077</td></tr></tbody></table> ``` In fact, I have uploaded a screenshot to this issue, I don't know if you can see it? You can use this HTML table.
Author

None of the images were added -- can you try uploading the screenshot and posting the HTML table?

Sorry for this, I ignored the email of this comment.

And I didn't focus comment on this official code repository.

> None of the images were added -- can you try uploading the screenshot and posting the HTML table? Sorry for this, I ignored the email of this comment. And I didn't focus comment on this official code repository.
Owner

Not sure why it didn't show up the first time.

Not sure why it didn't show up the first time.
sheetjs reopened this issue 2024-09-06 21:00:38 +00:00
Owner

Thanks for reporting!

At a high level, the HTML DOM TABLE parser uses the rows property of the table element to enumerate the rows.

Your table revealed a funny corner case in how rows work.

https://html.spec.whatwg.org/multipage/tables.html#forming-a-table when a table row group (THEAD, TBODY, TFOOT) ends, the engine is supposed to effectively insert empty rows to ensure no overlap between groups. Those rows are not added to the rows array, and therefore any algorithm that uses the TABLE rows property directly will not work properly.

Your example elicits this behavior. The following cells are the header:

<thead><tr>

<th rowspan="2" colspan="1">保险单年度</th>
<th rowspan="2" colspan="1">被保险人年龄</th>
<th rowspan="2" colspan="1">当年度保险费</th>
<th rowspan="2" colspan="1">累计保险费</th>
<th rowspan="2" colspan="1">当年度年金/满期金</th>
<th rowspan="2" colspan="1">累计年金/满期金</th>
<th rowspan="2" colspan="1">公共交通工具意外全残保险金</th>
<th rowspan="2" colspan="1">身故保险金</th>
<th rowspan="2" colspan="1">退保金(现金价值)</th>

</tr></thead>

Each TD element in the header row has rowspan=2, so from the perspective of rows it is one row but the browsers actually treat it as two rows.

To understand how SheetJS currently interprets the table, remove the open and close THEAD and TBODY tags. https://jsbin.com/sovatimifo/edit?html,output you will see that the data row is actually added to the end of the second row.

We'll have to do some more testing to ensure this works correctly, but the DOM parser should be scanning rows from tHead, tBodies, and tFoot directly.

Thanks for reporting! At a high level, the HTML DOM TABLE parser uses [the `rows` property](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/rows) of the `table` element to enumerate the rows. Your table revealed a funny corner case in how `rows` work. https://html.spec.whatwg.org/multipage/tables.html#forming-a-table when a table row group (THEAD, TBODY, TFOOT) ends, the engine is supposed to effectively insert empty rows to ensure no overlap between groups. Those rows are not added to the `rows` array, and therefore any algorithm that uses the TABLE `rows` property directly will not work properly. Your example elicits this behavior. The following cells are the header: ```html <thead><tr> <th rowspan="2" colspan="1">保险单年度</th> <th rowspan="2" colspan="1">被保险人年龄</th> <th rowspan="2" colspan="1">当年度保险费</th> <th rowspan="2" colspan="1">累计保险费</th> <th rowspan="2" colspan="1">当年度年金/满期金</th> <th rowspan="2" colspan="1">累计年金/满期金</th> <th rowspan="2" colspan="1">公共交通工具意外全残保险金</th> <th rowspan="2" colspan="1">身故保险金</th> <th rowspan="2" colspan="1">退保金(现金价值)</th> </tr></thead> ``` Each TD element in the header row has rowspan=2, so from the perspective of `rows` it is one row but the browsers actually treat it as two rows. To understand how SheetJS currently interprets the table, remove the open and close THEAD and TBODY tags. https://jsbin.com/sovatimifo/edit?html,output you will see that the data row is actually added to the end of the second row. We'll have to do some more testing to ensure this works correctly, but the DOM parser should be scanning `rows` from [`tHead`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/tHead), [`tBodies`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/tBodies), and [`tFoot`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLTableElement/tFoot) directly.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#3175
No description provided.