本文介绍了网页(.aspx)到word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户可以填写我拥有的网络表单,并将他们输入的数据提交到文本框中。在用户点击提交之前,我希望他们点击打印,表单将打印到word文档。我的计算机上有一个word文档。它与网页具有相同的字段。如何将word文档上传到Asp.Net,当用户点击打印时,word文档会打印出用户刚刚提交的数据?这可能吗?



A user can fill out the web form I have and submit the data that they entered into the textboxes. Before the user clicks on submit I would like for them to click on print and the form will print to a word document. I have a word document on my computer. It has the same fields as the web page does. How can I upload the word document to Asp.Net and when the user clicks on print the word document prints out with the data the user just submitted? Is this possible to do?

<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation = "false" CodeBehind="Gradrate.aspx.cs" Inherits="SACSCOCLogin1._1.Gradrate" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 585px;
            height: 137px;
        }
        .style2
        {
            font-size: x-large;
            text-align: center;
        }
        .style3
        {
            width: 100%;
        }
        .style4
        {
            width: 520px;
        }
        .style5
        {
            width: 188px;
        }
        .style9
        {
            font-size: x-large;
            text-decoration: underline;
            text-align: center;
        }
        .style10
        {
            width: 189px;
        }
        .style11
        {
            font-weight: bold;
            text-align: center;
        }
        .style13
        {
            width: 73px;
            font-size: large;
        }
        .style15
        {
            font-weight: bold;
            font-size: x-large;
        }
        .style16
        {
            width: 673px;
        }
        .style17
        {
            color: #FF0000;
            font-size: large;
            text-align: center;
        }
        .style18
        {
            width: 131px;
        }
        .style19
        {
            width: 190px;
        }
        .style20
        {
            width: 190px;
            text-align: center;
        }
        .style21
        {
            width: 188px;
            text-align: center;
        }
        .style22
        {
            width: 713px;
        }
        .style23
        {
            font-weight: bold;
            font-size: large;
        }
        .style24
        {
            width: 653px;
        }
        .style25
        {
            width: 204px;
        }
    </style>
</head>
<body background="Images/bkg-blu.jpg">
    <form id="form1" runat="server">
    <div style="text-align: center">

        <img alt="" class="style1" src="Images/buildout_header.jpg" /></div>
    <p>
        <asp:TextBox ID="TextBoxINST_ID" runat="server" Enabled="False" ReadOnly="True" 

            Visible="False"></asp:TextBox>
        <asp:TextBox ID="TextBoxaccessLevel" runat="server" Visible="False"></asp:TextBox>
    </p>
    <p class="style2">
         </p>
    <div class="style9">
        Graduation Rate Information<br />
        </div>
    <p class="style17">
        "Note, if your institution reports more than one set of cohorts using
        more than one Unit ID, Please enter the Unit ID into the textbox first before
        anything else. Then enter the information needed. This form will reset once you
        have clicked the Submit button and you will remain on this page to enter additional cohorts."</p>
    <p class="style17">
         </p>
    <table class="style3">
        <tr>
            <td style="text-align: center">
                <asp:Label ID="lblSchool" runat="server" CssClass="style15"></asp:Label>
            </td>
        </tr>
    </table>
    <table class="style3">
        <tr>
            <td class="style16" style="text-align: right">
                <asp:Label ID="lblCity" runat="server" CssClass="style23"></asp:Label>
                 ,</td>
            <td>
 
                <asp:Label ID="lblState" runat="server" CssClass="style23"></asp:Label>
            </td>
        </tr>
    </table>
    <br />
    Unit ID (Six-Digit IPEDS institution number):<br />
    <table class="style3">
        <tr>
            <td class="style13">
                Unit ID</td>
            <td class="style18">
                <asp:TextBox ID="TextBoxUNITID" runat="server" AutoPostBack="True" 

                    ontextchanged="TextBoxUNITID_TextChanged" Width="180px">0</asp:TextBox>
            </td>
            <td class="style24">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator24" runat="server" 

                    ControlToValidate="TextBoxUNITID" ErrorMessage="You Must Enter a Unit ID!!!!" 

                    ForeColor="Red" style="font-weight: 700" Display="Dynamic"></asp:RequiredFieldValidator>
            </td>
            <td>
                Today's Date</td>
            <td class="style25">
                
                <asp:TextBox ID="TextBoxDATE" runat="server" Width="180px" CssClass="style11" 

                    Enabled="False" ReadOnly="True" style="text-align: center"></asp:TextBox>
                
            </td>
            <td>
                <asp:Label ID="lblTime" runat="server" style="font-weight: 700"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style13">
                 </td>
            <td class="style18">
                 </td>
            <td class="style24">
                 </td>
        </tr>
        </table>
    <table class="style3">
        <tr>
            <td class="style4">
                 </td>
            <td class="style5">
                 </td>
            <td class="style19">
                              
            </td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style4">
                 </td>
            <td class="style5">
                      PREVIOUS YEAR</td>
            <td class="style19">
                                
                YEAR</td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style4">
                 </td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYEAR" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True" style="text-align: center"></asp:TextBox>
            </td>
            <td class="style20">
                <asp:TextBox ID="TextBoxYEAR" runat="server" Width="180px" CssClass="style11" 

                    Enabled="False" ReadOnly="True">2013</asp:TextBox>
            </td>
            <td>
                 </td>
        </tr>
    </table>
    <table class="style3">
        <tr>
            <td class="style4">
                Associates / Two-Year Program</td>
            <td class="style5">
                 </td>
            <td class="style10">
                 </td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style4">
                1. Total Number of Students in the Cohort</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTNUGSC" runat="server" Width="180px" 

                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTNUGSC" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" 

                    ControlToValidate="TextBoxTNUGSC" ErrorMessage="You Must Enter Total Students Cohort" 

                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                2. Total Number of Students Completed within 150% of Time of Degree</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTNUGSCD" runat="server" Width="180px" 

                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTNUGSCD" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server" 

                    ControlToValidate="TextBoxTNUGSCD" ErrorMessage="You Must Enter Total Students Completed" 

                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                3. Total Transfers Out</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTTOUG" runat="server" Width="180px" 

                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTTOUG" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator18" runat="server" 

                    ControlToValidate="TextBoxTTOUG" ErrorMessage="You Must EnterTotal Transfers" 

                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                Baccalaureate / Four-Year Program</td>
            <td class="style5">
                 </td>
            <td class="style10">
                 </td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style4">
                4. Total Number of Students in the Cohort</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTNGSC" runat="server" Width="180px" 

                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTNGSC" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator19" runat="server" 

                    ControlToValidate="TextBoxTNGSC" ErrorMessage="You Must Enter Total Students Cohort" 

                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                5. Total Number of Students Completed within 150% of Time of Degree</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTNGSCD" runat="server" Width="180px" 

                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTNGSCD" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator20" runat="server" 

                    ControlToValidate="TextBoxTNGSCD" ErrorMessage="You Must Enter Total Students Completed" 

                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                6. Total
                Transfers Out</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTTOG" runat="server" Width="180px" 

                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTTOG" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator21" runat="server" 

                    ControlToValidate="TextBoxTTOG" ErrorMessage="You Must EnterTotal Transfers" 

                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
    </table>
    <br />
    <br />
    <table class="style3">
        <tr>
            <td style="text-align: justify" class="style22">
                                                                                                                                          
                <asp:Button ID="Submit" runat="server" Text="Submit" Width="75px" 

                    onclick="Submit_Click" />
            </td>
            <td style="text-align: left">
                                               
                <asp:Button ID="Print" runat="server" Text="Print" Width="75px" 

                    onclick="Print_Click" />
            </td>
        </tr>
    </table>
    </form>
    </body>
</html>





I am trying to get this page printed out with the data in it. I don’t need the textboxex that is under the Previous Year column. If I could get the Logo and the other textboxes with the data in it to be printed. How can i do this?



I am trying to get this page printed out with the data in it. I don't need the textboxex that is under the Previous Year column. If I could get the Logo and the other textboxes with the data in it to be printed. How can i do this?

推荐答案


这篇关于网页(.aspx)到word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 07:56