0

我有以下 NoPrint.css 打印样式表:

    /* DEFAULTS
----------------------------------------------------------*/
body
{
    margin: 0px;
    padding: 0px;   
}          

/* PRIMARY LAYOUT ELEMENTS   
----------------------------------------------------------*/

.page
{
    margin: 0px;

}

.header
{
    display:none;
}

.header h1
{
    display:none;
}

.main
{
    padding: 0px 0px;
    margin: 0px;  
}


div.chart
{
    clear:both;
    float:left; 
    width:45%;
}

/*
 --- Suitable when the print orientation is landscape*/

div.chart4
{
    float:left;
    width:50%;
}
.DatumSetzen
{
    float:left;
    width:45%; 
    margin-bottom:1px;
}
div.vorwocheChart
{
    clear:both;
    margin-top:0px;
    margin-bottom:0px;
}
div.chartV
{
    clear:both;
    float:left; 
    width:45%; 
}
div.chart4V
{
    float:left;
    width:45%;
}
div.Labels
{   
    display:none;
}    
.drucken
{
    display:none;   
}

页面布局的标记:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="WebApplication2.SiteMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head runat="server">
    <title></title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" media="screen"/>
    <link href="~/Styles/NoPrint.css" rel="Stylesheet" type="text/css" media="print" />
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder> </head> <body>
    <form runat="server">
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>                    
                    AVIS
                    <asp:Label ID="DateLabel" runat="server"><%=DateTime.Now.Year%></asp:Label> <!-- Displays current year in the main heading of the website-->
         &nbsp;</h1>
            </div>
            <div class="loginDisplay">
                <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                    <AnonymousTemplate>
                        [ <asp:LinkButton ID="HeadLoginStatus" runat="server" onclick="HeadLogin_Click">Anmelden</asp:LinkButton> ]

                    </AnonymousTemplate>
                    <LoggedInTemplate>                        
                        Willkommen <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!                        
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Abmelden" LogoutPageUrl="~/Logout.aspx"/> ]
                    </LoggedInTemplate>
                </asp:LoginView>
            </div>
            <div class="clear hideSkiplink">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" IncludeStyleBlock="false" Orientation="Horizontal"  >

                    <Items>
                        <asp:MenuItem NavigateUrl="~/Wiegen.aspx" Text="WIEGEN"/>
                        <asp:MenuItem NavigateUrl="~/Granulieren.aspx" Text="GRANULIEREN" />
                        <asp:MenuItem NavigateUrl="~/Sieben.aspx" Text="SIEBEN" />
                        <asp:MenuItem NavigateUrl="~/Verkapseln.aspx" Text="VERKAPSELN" />
                        <asp:MenuItem NavigateUrl="~/Tablettieren.aspx" Text="TABLETTIEREN" />

                   </Items>
                </asp:Menu>
            </div>
        </div>
        <div class="main">   
        <div class="button">
            <asp:Panel ID="Panel1" DefaultButton="BT2" runat="server">

             <asp:ImageButton ID="ImageButton1" runat="server" 
                    ImageUrl="~/Images/printButton.png" OnClientClick="javascript:window.print();" ToolTip="Drucken"/>  
                    <asp:Button ID="BT2" runat="server" EnableViewState="False" EnableTheming="False" Enabled="False" Visible="False" />

            </asp:Panel>               
            </div>     

            <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
        </div>
        <div class="clear">
        </div>
    </div>
    <div class="footer">

    </div>
    </form> </body> </html>

这适用于具有三个图表的网页,两个在左侧,一个在右侧,并且打印样式表在第一次给出打印命令时工作正常,三个图表按预期以横向打印在一张纸上,但第二次,它每页打印一个图表,浮动正在工作,但宽度没有被拾取。我正在为我的应用程序使用 Internet Explorer。如果有人能建议它有什么问题,我将不胜感激。

4

0 回答 0