如何将程序打印到 MS Word?

发布于 2024-07-15 23:32:51 字数 162 浏览 5 评论 0原文

我们有一个项目,教授要求我们用microsoft word打印程序代码。 然而,当我将所有代码粘贴到 MS Word 中时,结果发现它没有着色,那些漂亮的编程字体。它在 Microsoft Word 中看起来非常难看。

我希望它能非常华丽地打印在纸上。 就像我们在记事本++中看到的那样

We have a project, and the professor asked us to print the program codes using microsoft word. however when i pasted all my codes in ms word it turns out that it doesn't have coloring, those nice programming fonts.. It just looks awfully ugly in microsoft word..

I want this to be printed on papers very gorgeously. Like what we see in our notepad++

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

一场春暖 2024-07-22 23:32:51

如果您使用的是 Windows,则可以在 Visual Studio 中打开源代码(假设是 C++、C# 或 VB),复制代码并将其粘贴到 Word。

“Visual Studio”到“Word”确实保留格式(颜色和字体)。

If you are on Windows, you can open the source code in Visual Studio (assuming it is C++, C# or VB), copy the code, and paste it to Word.

"Visual Studio" to "Word" does keep the formatting (color and fonts).

生来就爱笑 2024-07-22 23:32:51

当我可以避免时,我不会使用 Word。 它只是不太擅长保持格式,并且不能提供真正好看的打印效果。

  • 断行不是程序感知的。
  • 段落中断是程序无法识别的。
  • 保留 VS 的格式并不会进行基于结构的标记,不是吗?
  • Word的排版引擎比TeX或Quark/Indesign差很多

I do not use Word for this when I can avoid it. It's simply not very good at keeping the formatting and doesn't provide really good-looking prints.

  • The line-breaking isn't program-aware.
  • The paragraph breaking isn't program aware.
  • The keeping of the formatting from VS doesn't do structure-based markup, does it?
  • The typesetting engine of Word is a lot worse than TeX or Quark/Indesign
披肩女神 2024-07-22 23:32:51

Microsoft Word 对于代码审查非常方便。 特别是如果您不想花钱购买专门为同行代码审查而设计的工具之一。 每个审阅者都可以在文档中插入他们的评论和/或修改代码。 如果您跟踪更改,则可以查看更改的内容并接受或拒绝更改。 在审核过程中,您只需循环浏览评论和更改即可。 完成后,您只需将最终产品复制并粘贴回源文件即可。 它胜过必须列出评论列表,破译它们,然后自己合并请求。

编辑:我们使用 Visual Studio。 因此,在源代码和 Microsoft Word 之间进行剪切/粘贴工作正常,除非行长度超过页面大小。

Microsoft Word is very handy for code reviews. Particularly if you don't want to splurge for one of the tools explicitly designed for peer code reviews. Each reviewer can insert their comments and/or modify the code themselves right in the document. If you keep track changes on then you can see what was changed and accept or reject the changes. During the review you only have to cycle through the comments and changes. When you are all done, you can simply copy and paste the final product back into the source file. It beats having to take a list of comments, decipher them and then incorporate the requests yourself.

EDIT: We use Visual Studio. So Cut/Paste between the source and Microsoft Word works fine, except in the cases where the line length exceeds the page size.

末が日狂欢 2024-07-22 23:32:51

如果您有 NppExport 插件,请转到

插件 -> NppExport-> (然后您可以选择“导出为 RTF”、“将 RTF 复制到剪贴板”或“将所有格式复制到剪贴板”)

如果选择导出为 rtf,则在 Microsoft Word 中打开它;如果选择复制,则将其粘贴到 Word到剪贴板

希望这对我有帮助

我在我的 SQL 作业中尝试过它并且它有效

If you have the NppExport Plugin, go to

Plugins -> NppExport -> (Then you can choose between "Export to RTF", "Copy RTF to Clipboard", or "Copy all formats to clipboard")

Then open it in Microsoft Word if you choose export to rtf, or paste it to Word if you choose copy to clipboard

Hope this helps

I tried it for my SQL assignment and it works

花间憩 2024-07-22 23:32:51

我不确定我是否理解这个问题,但如果您问“如何将我的源代码放入 Word 并使其看起来像 Notepad++”,您将需要对 Microsoft Word 自动化进行一些研究。

使用 C# 的 Word 自动化
使用 Word 的 OLE 自动化(文章)
Microsoft Word 自动化课程

I'm not sure I understand the question, but if you're asking "how do I put my source code into Word and make it look pretty like Notepad++," you'll want to do some research into automating Microsoft Word.

Word automation using C#
OLE Automation using Word (Article)
Microsoft Word Automation Class

小嗷兮 2024-07-22 23:32:51

这看起来似乎很明显,但是您只需从记事本++打印它怎么样?

This may seem obvious, but how about you just print it from notepad++?

誰認得朕 2024-07-22 23:32:51

Eclipse 做了 decasteljau 所说的同样的事情。

当您从 Eclipse 复制代码,然后粘贴到 Outlook 上时,代码会保持其颜色。

Eclipse does the same thing told by decasteljau.

When you copy code from eclipse, and then you paste on Outlook, the code keeps its colours.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文