2015-03-02 32 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

对不起家伙,我想通了,“版本”和“最后的观点”,“休息记录的时间”被支配的宽度