在其自己的打印例程中打印外部文件
我基本上有一个在 .html 文件中生成报告的应用程序,我使用 .html 文件以便于制作表格和格式化文本。
现在我想介绍一种从我的程序打印报告的方法。因为我使用 .html 文件,所以如果我直接从我的应用程序打印它,格式将不正确(据我所知)。因此,我想像我的网络浏览器一样打印它,以保持表格数据和文本格式的完整性。
有谁知道如何做到这一点?
谢谢。
I basically have an application that generates reports in a .html file, I use a .html file for the ease of making tables and formatting text.
Now I would like to introduce a way of printing the reports from my program. Because I use a .html file, the formatting would not the correct if I was to print it directly from my application (as far as I know). For this reason, I would like to print it just like my web browser would have in order to keep the tabular data intact and the text formatting.
Does anyone know a way to do this?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
CSS 可以做你需要的一切。您可能希望在其自己的窗口(或 Iframe)中打开文档,并使用专为您的报表设计的自己的样式表。
请参阅:设置打印 CSS 的好规则?
CSS can do everything you need. You may want to open the document in its own window (or Iframe) with its own stylesheet specifically designed for your report.
See: Good rules for setting up print css?