使用格式保存源代码(语法突出显示)
我需要以 .pdf 文件形式向竞赛提交代码。如果语法像实际工作室中那样突出显示,那就太好了,而且更容易阅读。我真的不想自己一行一行地突出显示它,那么有没有办法以.rtf格式导出Delphi源代码?
谢谢
I need to submit my code to a competition in a .pdf file. It would be nice and much easier to read if the syntax was highlighted as in the actual studio. I don't really feel like highlighting it by myself, line after line, so is there a way to export Delphi source code in .rtf?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
两个免费的 IDE 增强功能具有您正在寻找的功能(我认为):
GExperts (http://www.gexperts.org/) gexperts.org/ )有一个“导出源”选项,可以导出为 RTF 和/或 HTML。
CnPack ( http://www.cnpack.org/index.php?lang= en )有一个“导出为 HTML/RTF”选项。
Two free IDE enhancements have the functionality that you are looking for (I think):
GExperts ( http://www.gexperts.org/ ) has an "Export Source" option which can export as RTF and/or HTML.
CnPack ( http://www.cnpack.org/index.php?lang=en ) has an "Export to HTML/RTF" option.
还有 John Kaster 的 YAPP(又一个漂亮的打印机),作为 网络服务 或 独立可执行文件。
There's also John Kaster's YAPP (yet another pretty-printer), as web service or standalone executable.
GExperts 包含源导出专家。它集成到 Delphi IDE 中:
GExperts contain the Source Export expert. It is integrated into the Delphi IDE:
GVim 有一个“导出到 HTML”功能 - 但不能执行行号和背景颜色,因此应避免使用深色主题,因为它们看起来不会像您期望的那样。然后,您可以在 Web 浏览器中打开该文件,然后将其打印为 PDF。
GVim has an "export to HTML" function - can't do line numbers and background colors, though, so dark themes should be avoided as they will not look as you expect. You can then open the file in your web browser and from there print it to PDF.
CnWizards 可能会破坏非拉丁字符。
至少在 XE2 中,当导出到 RTF 时,带有俄语字符的源代码被破坏。
它们在默认的 HTML/UTF8 导出中也被破坏。
由于我使用了英语+俄语之外的一些字符(希腊字母),因此即使使用非默认 HTML/windows-1251 导出,它们也会被破坏。
此外,CnWizards 也无法导出 DFM,这也是该项目的一部分。
SynEdit、SynPlus 或 YAPP 等外部工具很好,但无法一次转换所有项目,无法重用 IDE 自定义着色,并且可能会落后于最新 Delphi 版本中的最新语法更改。
CnWizards may broke non-Latin characters.
At least in XE2 sources with russian characters were broken, when exporting to RTF.
They were also broken in default HTML/UTF8 export.
And since i used some characters (Greek letters) beyond English+Russian, they were borken even with non-default HTML/windows-1251 export
Also CnWizards can not export DFM which are also part of the project.
External tools like SynEdit, SynPlus or YAPP are nice, but cannot convert all the project at once, cannot reuse IDE customized colouring, and potentially would lack behind most recent syntax changes in most recent Delphi releases.
保存 DFM 的一种可能方法是从 IDE 打印到免费软件 PDF 打印机或 Windows 7 中提供的 Microsoft XPS 打印机。
后者创建的页面太大,无法适合打印页面。
这就是 STDU Viewer 可以提供帮助的地方 - 它允许文件 |高级印刷|适合打印机的页边距模式,以便在复制文件的任何计算机上打印它们。
One possible way to save DFM is printing from IDE into freeware PDF printer or into Microsoft XPS printer, available in Windows 7.
The latter creates page too large that cannot be fit into printed page.
This where STDU Viewer comes to help - it allows File | Advanced Printing | Fit into printer's margins mode to print them on any computer the file copied too.