找回密码
 FreeOZ用户注册
查看: 2760|回复: 7
打印 上一主题 下一主题

[论坛技术] C# print html

[复制链接]
跳转到指定楼层
1#
发表于 1-12-2010 13:00:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?FreeOZ用户注册

x
想写一个class print html,全是静态的function. 然后再asp page里调用。
高手??、
回复  

使用道具 举报

2#
发表于 1-12-2010 13:12:21 | 只看该作者
details? what you mean?

print C# source files in html?
write a C# application to print html to printer?
write a C# application to print html to console?
write a C+ application to print C# source code in html to file?
......
回复  

使用道具 举报

3#
 楼主| 发表于 1-12-2010 15:30:11 | 只看该作者
原帖由 coredump 于 1-12-2010 13:12 发表
details? what you mean?

print C# source files in html?
write a C# application to print html to printer?
write a C# application to print html to console?
write a C+ application to print C# source ...

就是写一个c#class 里都是static function(functions print html ), 然后在aspx page里用啊老大
回复  

使用道具 举报

4#
发表于 1-12-2010 15:40:51 | 只看该作者
你在aspx页面里面还是一样的可以用其他类的静态函数啊?
没有什么特殊的嘛
回复  

使用道具 举报

5#
 楼主| 发表于 1-12-2010 16:24:32 | 只看该作者
原帖由 woodheadz 于 1-12-2010 15:40 发表
你在aspx页面里面还是一样的可以用其他类的静态函数啊?
没有什么特殊的嘛

c#哪个class 可以输出 html, 类似于print的function?
不要response classs.

另外在aspx。里用那个class,我还用在.cs file declaire using class吗?
回复  

使用道具 举报

6#
发表于 1-12-2010 17:09:25 | 只看该作者
原帖由 lufumin1832 于 1-12-2010 16:24 发表

c#哪个class 可以输出 html, 类似于print的function?
不要response classs.

另外在aspx。里用那个class,我还用在.cs file declaire using class吗?


你肯定是需要一个response对象才能输出的,不然输出到哪里去?
很久没用ASP.net了,我记得你应该是可以通过HttpContext取得一个当前的context(好像是HttpContext.Current),从当前context上直接获得当前的Response对象。
实在不行你传个Response对象到静态方法里面去也没什么。
用Class肯定是需要using namespace的,除非是在同一个name space里面

评分

参与人数 1威望 +25 收起 理由
lufumin1832 + 25 谢谢分享!

查看全部评分

回复  

使用道具 举报

7#
 楼主| 发表于 2-12-2010 08:48:10 | 只看该作者
原帖由 woodheadz 于 1-12-2010 17:09 发表


你肯定是需要一个response对象才能输出的,不然输出到哪里去?
很久没用ASP.net了,我记得你应该是可以通过HttpContext取得一个当前的context(好像是HttpContext.Current),从当前context上直接获得当前的Res ...

看来只能传个response了
回复  

使用道具 举报

8#
发表于 6-12-2010 11:44:23 | 只看该作者
mshtml.IHTMLDocument2 doc = this.wbViewer.Document as mshtml.IHTMLDocument2;
            if (doc != null)
                doc.execCommand("Print", true, null);
回复  

使用道具 举报

您需要登录后才可以回帖 登录 | FreeOZ用户注册

本版积分规则

小黑屋|手机版|Archiver|FreeOZ论坛

GMT+11, 6-12-2025 14:48 , Processed in 0.018430 second(s), 25 queries , Gzip On, Redis On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表