2015-03-02 41 views
0

嗨,如下所示我正在使用ruby自動執行xls創建過程,但不幸的是,當創建xls文檔時發生小型樣式錯誤。這顯示在複選框中,前幾個太大,如下圖所示。 enter image description hereRuby xml to xls樣式錯誤

也在這裏是XLS表的代碼:

<table border="1" width="100px"> 
    <tr> 
    <th></th> 
    <th colspan="32">Hours of rest record</th> 
    <th colspan="16">Crew Members Name</th> 
    <th colspan="1"></th> 
    <th colspan="2"><%= @crewmember.user.full_name %></th> 
    </tr> 
    <tr> 
    <th></th> 
    <th colspan="48">Work hours (Place and 'x' in each half hour worked and count hours of rest)</th> 
    <th colspan="1">Start Date</th> 
    <th colspan="2"><%= @shifts.first.day %></th> 
    </tr> 
    <tr> 
    <th colspan="1">Hours/date</th> 
    <th colspan="2">0030</th> 
    <th colspan="2">0130</th> 
    <th colspan="2">0230</th> 
    <th colspan="2">0330</th> 
    <th colspan="2">0430</th> 
    <th colspan="2">0530</th> 
    <th colspan="2">0630</th> 
    <th colspan="2">0730</th> 
    <th colspan="2">0830</th> 
    <th colspan="2">0930</th> 
    <th colspan="2">1030</th> 
    <th colspan="2">1130</th> 
    <th colspan="2">1230</th> 
    <th colspan="2">1330</th> 
    <th colspan="2">1430</th> 
    <th colspan="2">1530</th> 
    <th colspan="2">1630</th> 
    <th colspan="2">1730</th> 
    <th colspan="2">1830</th> 
    <th colspan="2">1930</th> 
    <th colspan="2">2030</th> 
    <th colspan="2">2130</th> 
    <th colspan="2">2230</th> 
    <th colspan="2">2330</th> 
    <th colspan="1">Hours of rest</th> 
    <th colspan="2">Comment</th> 
    </tr> 
    <% @shifts.each do |shift| %> 
    <tr> 
    <td><%= shift.day %></td> 
    <td><%= shift.hour_0000_to_0029 %></td> 
    <td><%= shift.hour_0030_to_0059 %></td> 
    <td><%= shift.hour_0100_to_0129 %></td> 
    <td><%= shift.hour_0130_to_0159 %></td> 
    <td><%= shift.hour_0200_to_0229 %></td> 
    <td><%= shift.hour_0230_to_0259 %></td> 
    <td><%= shift.hour_0300_to_0329 %></td> 
    <td><%= shift.hour_0330_to_0359 %></td> 
    <td><%= shift.hour_0400_to_0429 %></td> 
    <td><%= shift.hour_0430_to_0459 %></td> 
    <td><%= shift.hour_0500_to_0529 %></td> 
    <td><%= shift.hour_0530_to_0559 %></td> 
    <td><%= shift.hour_0600_to_0629 %></td> 
    <td><%= shift.hour_0630_to_0659 %></td> 
    <td><%= shift.hour_0700_to_0729 %></td> 
    <td><%= shift.hour_0730_to_0759 %></td> 
    <td><%= shift.hour_0800_to_0829 %></td> 
    <td><%= shift.hour_0830_to_0859 %></td> 
    <td><%= shift.hour_0900_to_0929 %></td> 
    <td><%= shift.hour_0930_to_0959 %></td> 
    <td><%= shift.hour_1000_to_1029 %></td> 
    <td><%= shift.hour_1030_to_1059 %></td> 
    <td><%= shift.hour_1100_to_1129 %></td> 
    <td><%= shift.hour_1130_to_1159 %></td> 
    <td><%= shift.hour_1200_to_1229 %></td> 
    <td><%= shift.hour_1230_to_1259 %></td> 
    <td><%= shift.hour_1300_to_1329 %></td> 
    <td><%= shift.hour_1330_to_1359 %></td> 
    <td><%= shift.hour_1400_to_1429 %></td> 
    <td><%= shift.hour_1430_to_1459 %></td> 
    <td><%= shift.hour_1500_to_1529 %></td> 
    <td><%= shift.hour_1530_to_1559 %></td> 
    <td><%= shift.hour_1600_to_1629 %></td> 
    <td><%= shift.hour_1630_to_1659 %></td> 
    <td><%= shift.hour_1700_to_1729 %></td> 
    <td><%= shift.hour_1730_to_1759 %></td> 
    <td><%= shift.hour_1800_to_1829 %></td> 
    <td><%= shift.hour_1830_to_1859 %></td> 
    <td><%= shift.hour_1900_to_1929 %></td> 
    <td><%= shift.hour_1930_to_1959 %></td> 
    <td><%= shift.hour_2000_to_2029 %></td> 
    <td><%= shift.hour_2030_to_2059 %></td> 
    <td><%= shift.hour_2100_to_2129 %></td> 
    <td><%= shift.hour_2130_to_2159 %></td> 
    <td><%= shift.hour_2200_to_2229 %></td> 
    <td><%= shift.hour_2230_to_2259 %></td> 
    <td><%= shift.hour_2300_to_2329 %></td> 
    <td><%= shift.hour_2330_to_2359 %></td> 

    <td colspan="1" style="text-align:center;"><%= shift.hours_of_rest %></td> 
    <td colspan="2"><%= shift.time_profile_id %></td> 
    </tr> 
    <% end %> 
</table> 

<br/><br/> 
<table border="1"> 
    <tr> 
    <th>Approved By:</th> 
    <th>Hours of Rest Record:</th> 
    <th>Version</th> 
    <th>Last Review</th> 
    </tr> 
    <tr> 
    <td></td> 
    <td></td> 
    <td></td> 
    <td></td> 
    </tr> 
</table> 

<br/> 

<table border="0"> 
    <tr> 
    <td>Crew Member Signiture</td> 
    <td style="width:200px; border-bottom: 0.5px dotted black"></td> 
    </tr> 
    <tr><td></td></tr> 
    <tr> 
    <td>Master Signiture</td> 
    <td style="width:200px; border-bottom: 0.5px dotted black"></td> 
    </tr> 
</table> 

另一個需要注意的是,當我刪除所有的表,但最頂端表似乎解決它。

預先感謝您

+1

當你問一個問題關於代碼,提供該代碼的最小樣本以及輸入和輸出數據以複製問題非常重要。您的問題會很快關閉,因爲它只顯示我們無法用來幫助診斷問題的代碼輸出。它可以幫助您查看網站的幫助部分,以便您更熟悉如何提出問題。 – 2015-03-02 16:31:32

+0

@theTinMan嗨,謝謝你,我會爲未來記住這一點。 – andrew196 2015-03-02 16:57:22

回答

0

對不起傢伙,我想通了,「版本」和「最後的觀點」,「休息記錄的時間」被支配的寬度