将网页表单导出到msword
本文关键字:msword 网页 表单 | 更新日期: 2023-09-27 18:18:53
我一直在寻找如何从asp.net导出到word的教程和其他问题,但我发现大多数都是处理一个简单的html表,这不是我需要的或涉及昂贵的扩展。
我有一个用户完成和提交的web表单。一旦提交,我想给他们选择导出到Word(见截图)。
我试过右键点击并另存为作为测试,看看效果如何,它一点也不整洁(见截图)。
当我打印预览页面也是一个烂摊子由于汉堡边栏(见截图)这两个问题是相关的吗?
关于让word文档看起来与网页相似有什么建议吗?
我的代码示例:<!--Section 4 - Health & Safety-->
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseFour">Health & Safety</a>
</h3>
</div>
<div id="collapseFour" class="panel-collapse collapse in">
<div class="panel-body">
<p>Have their been any changes to Health and Safety issues since the last assessment?</p>
<label class="radio-inline">
<span class="checkableBox checkableBox-radio">
<asp:RadioButton class="validate[required]" ID="rbtnHealthYes" runat="server" value="Y" Text="Yes" GroupName="HealthAndSafetyChanges" />
</span>
</label>
<label class="radio-inline">
<span class="checkableBox checkableBox-radio">
<asp:RadioButton class="validate[required]" ID="rbtnHealthNo" runat="server" value="N" Text="No" GroupName="HealthAndSafetyChanges" />
</span>
</label>
<br /><br />
<p><i>If the answer to the above is yes, please give more details below and complete a new Health and Safety Assessment.</i></p>
<asp:TextBox class="form-control input-sm auto-size m-b-10" ID="txtHealthDetails" runat="server" TextMode="MultiLine"
placeholder="This could include things such as new renovations to the house or measures which have since broken. (This text box will grow as you fill it)"></asp:TextBox>
<hr class="whiter m-t-20" />
<br />
<br />
<p>Additional Comments:</p>
<asp:TextBox class="form-control input-sm auto-size m-b-10" ID="txtHealthComments" runat="server" TextMode="MultiLine"
placeholder="(This text box will grow as you fill it)"></asp:TextBox>
</div>
<!--Body End -->
</div>
<!--Collapse 4 End -->
</div>
<!--Section 4 End -->
http://joshcoopster.tumblr.com/image/131738484325 http://joshcoopster.tumblr.com/image/131738526900 http://joshcoopster.tumblr.com/image/131738596840
最干净的方法是将信息"转换"为Word可以打开和显示的有效文档类型。如果标准HTML可以提供所需的质量,那么可以使用它。如果你需要更强大的功能,你可以使用OpenXML SDK编写WordOpenXML。
我想,一个大问题是,你是否真的需要显示表单控件,还是仅仅显示信息就足够了。