如何在windows xp中的asp网页中打印div? [英] How to print div in asp web page in windows xp?

查看:103
本文介绍了如何在windows xp中的asp网页中打印div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div想要打印它。我使用css打印特定的div,当我在Windows 7中使用它时它是正确的。但是当我在windows xp中使用它时,我的设置被破坏了。我不知道windows xp的问题是什么?

这是打印的代码...

 <  输入   类型  = 按钮    value   = چپ     önclick  =  JavaScript:window.print();    

style = width:120px / >



和css ...

 < style  media = screen> 
NoDisplay
{
display none;
}
NoPrint
{
}
< / style >
< style media = print>
NoDisplay
{
}
NoPrint
{
display none ;
}
格局
{
margin 2.0 2.0 2.0 2.0;
}
@ page { margin 2cm}
< / style>



我为那些我不想打印它们的div设置了NoPrint样式。

感谢高级。

解决方案

本文介绍如何使用ASP.NET进行打印:

HTTP://www.c-sharpcorn er.com/uploadfile/rahul4_saxena/printing-in-Asp-Net/ [ ^ ]。



请注意,服务器端仅提供可打印内容和所有详细信息打印选择,打印质量和其他选项完全发生在客户端,以客户的操作系统设计。这是唯一合理且安全的方式。



即便如此,根据我的口味,这似乎有点过于冗余和干扰。我个人认为用户更了解何时打印,打印什么以及如何打印。您最好只提供适合打印的内容。不久之前,一些特殊的可打印版本主播已经流行,但你应该承认这并不优雅,特别是在网站维护方面。更好的方法是使用CSS媒体类型。请参阅:

http://www.w3schools.com/css/css_mediatypes.asp [ ^ ]。



这是在Web应用程序中打印的一种很好的方法:让用户这样做,只支持使用CSS的文档的打印版本。你需要为不同的媒体开发不同风格的CSS。



这个功能在这里描述:

http://www.w3.org/TR/CSS2/media.html [ ^ ]。



这是解释带有嵌入式样式表的示例代码:

http://www.w3schools.com/tags /att_style_media.asp [ ^ ]。



请同时查看以下建议:

http://webdesign.about.com/od/css/qt/tipcssmedia.htm [ ^ ],

http://www.javascriptkit.com/dhtmltutors/cssmedia.shtml [ ^ ]。



另见我过去对该主题的回答:

使用ASP.net打印到LPT1端口 [ ^ ]。



-SA

I have a div that I want to print it. I use css to print that specific div and it is right when i use it in windows seven.But when i use it in windows xp, my settings are ruined. I do not know whats the problem with windows xp?
This is the code for print...

<input type="button" value="چاپ"  önclick="JavaScript:window.print();" 

                    style="width: 120px" />


and css...

<style media=screen>
.NoDisplay
{
     display: none;
}
.NoPrint
{
}
</style>
<style media=print>
.NoDisplay
{
}
.NoPrint
{
     display: none;
}
.landscape 
{ 
    margin: 2.0 2.0 2.0 2.0;
} 
@page { margin: 2cm }
</style>


I put NoPrint style for divs that i do not want to print them.
Thanks in Advanced.

解决方案

This article explains how to print using ASP.NET:
http://www.c-sharpcorner.com/uploadfile/rahul4_saxena/printing-in-Asp-Net/[^].

Note that the server side only provides printable content, and all the detail of printing selection, printing quality and other options totally happens on the client side, in a way designed in client''s OS. This is the only reasonable and safe way.

Even this way seems to be a bit too redundant and intrusive, to my taste. I personally think that the user knows better when to print, what to print and how. You better just provide printer-friendly content. A while ago, some special "printable version" anchors were in fashion, but you should admit that this is not elegant, especially in terms of site maintenance. Much better approach is using CSS media types. Please see:
http://www.w3schools.com/css/css_mediatypes.asp[^].

This is really a good approach to printing in a Web application: make a user do it, only support print version of a document using CSS. You need to develop CSS with different styles for different media.

This feature is described here:
http://www.w3.org/TR/CSS2/media.html[^].

This is the explanation with the sample code with embedded style sheet:
http://www.w3schools.com/tags/att_style_media.asp[^].

Please also see these recommendations:
http://webdesign.about.com/od/css/qt/tipcssmedia.htm[^],
http://www.javascriptkit.com/dhtmltutors/cssmedia.shtml[^].

See also my past answer on the topic:
Print to LPT1 port using ASP.net[^].

—SA


这篇关于如何在windows xp中的asp网页中打印div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆