用于查看/打印非表格数据的Vb.net选项 [英] Vb.net options for viewing/printing non tabular data

查看:87
本文介绍了用于查看/打印非表格数据的Vb.net选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个应用程序,可将部分检查结果从数据库输出到文本文件以进行打印/查看。该报告包含诸如公称尺寸,实际尺寸,误差,公差等字段。检查结果大多以表格格式显示,但也有一些非表格数据。我目前正在使用标准printline命令创建报告文件,并添加了填充以在需要时对齐数据。当我完成后,我使用标准的NotePad应用程序显示或打印报告。



当我第一次创建报告格式时,我围绕某种字体类型设计了它/尺寸。如果NotePad中的字体设置为特定类型/大小,则报告看起来正确。但是,如果某些用户通过NotePad GUI进入并更改了字体类型/大小,则查看数据的下一个人将无法以正确的格式查看报告。考虑到这一点,我试图想出一个防止这种情况的万无一失的方法。



我尝试了什么:



我在网上看过,可能有办法阻止用户通过注册表编辑NotePad中的字体,但此刻我不会走这条路。此外,这些计算机仍在运行带有Dot.Net 2.0的Windows 2000操作系统,所以如果可能的话,我不想加载或使用任何非标准软件(抱歉没有MS Excel或MS Word)。我想看看我有什么其他选择来完成我的任务?我在网上研究过并发现我可以使用各种Win32 API调用将原始数据直接输出到打印机。我认为这可能适用于打印,但如果我只想查看数据,我将如何查看数据呢?我还看过几篇关于使用print文档的文章。我使用此选项创建了一个自定义图表,但似乎对于基本文本数据可能有点过分。还有其他我可能错过的选项吗?

I currently have an App that outputs part inspection results from a database to a text file for printing/viewing. The report contains fields like, nominal size, actual size, error, tolerance, etc. The inspection results are mostly displayed in tabular format but there is also some non-tabular data. I am currently creating the report file using the standard printline commands with padding added in to align the data where required. When I am done, I either display or print the report using the standard NotePad app.

When I first created the report format, I designed it around a certain font type/size. If the font in NotePad is set to that particular type/size, the report look proper. If, however, some user gets in and changes the font type/size via the NotePad GUI, then the next person viewing the data will not see the report in the proper format. With this in mind, I am trying to come up with a fool proof way to prevent this.

What I have tried:

I have read online that there might be ways of preventing the user from editing the font in NotePad via the registry but I don't go down that route at the moment. Also, these computers are running still running Windows 2000 OS with Dot.Net 2.0 so I don't want to load or use any non standard software if it is all possible (Sorry no MS Excel or MS Word). I would like to see what other options I have to accomplish my task? I have researched online and found out that I can output the raw data directly to a printer using various Win32 API calls. I think this might work for printing but how would I go about viewing the data for cases I just want to look at the data? I have also seen a couple of articles about using print document. I created a custom chart once using this option but it seems like it might be a little overkill for just basic text data. Are there any other options that I may have missed?

推荐答案

因为你有一个用于查看这些数据的应用程序,所以我会避免使用NotePad(或任何其他编辑器)查看/打印 - 您已经发现了原因:-)



遇到类似问题时,我使用XML和XSLT生成HTML报告。

这使我可以完全控制布局,字体等,但是在需要时可以轻松更改报告 - 使用Win32 API调用时不会这样。



您可以将这些内容直接加载到默认浏览器中进行查看或打印,或者像我一样使用您的应用程序中的WebBrowser控件。



(警告 - 不要像我一样做并学习XSLT 2.0 ......它不适用于Win2000)
As you have an app for viewing this data then I would avoid using NotePad (or any other editor) for viewing/printing - you've already discovered why :-)

When faced with a similar issue I generated HTML reports using XML and XSLT.
This gave me full control over layout, font etc but enabled the reports to be easily altered when required - this will not be the case with using Win32 API calls.

You can load these directly into the default browser for viewing or printing or do as I did and use the WebBrowser control in your app.

(Warning - don't do as I did and learn XSLT 2.0 ... it doesn't apply to Win2000)


这篇关于用于查看/打印非表格数据的Vb.net选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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