Is it possible and by what means to issue java code in a Microsoft Word document? Thank.
3 answers
It is necessary to write a beautiful report to the authorities or there to teach - as I understand it? It is done like this:
- Launch Intellij IDEA
- Load the file and type File-> Export to HTML ...
- Next, the resulting HTML is loaded into Word and we get a very presentable code, with highlighted keywords, and, if necessary, with line numbers.
- If you don’t like the formatting of the code, you can choose the style of the code, fonts, hyphenation, curly brackets, etc. through the same IDEA (via File-> Settings-> Code style).
Update For fans of Eclipse, there is a Java2HTML plugin or its version as a separate Java application that also generates HTML
Conducted an experiment:
- Opened IE
- Opened a question on a hashcode, any where the code is colored.
- Highlighted the code, pressed ctrl-c
- In the Word pressed ctrl-v
- Profit
In other words, unzip the code in html, open it in the Word ...
- thank! By the way, I did something like this yesterday, formatted it into pastebin and copied it into Word =) The syntax highlighting has been preserved! - Gonza12 2:41 pm
I understand here the question is in relation to the IDE with which you work.
I work with eclipse, and for me the problem is solved like this: I copy the code directly from the IDE into word (it is copied along with the formatting). There is only one nuance: if you insert one line or a very small piece (for example, a variable name) in this case the code is obtained with a blue background (where the blue background is, rather, for all this selection). a bug or a feature I don’t know :)
- OK thanks! Well, that’s not bad either, sort of like highlighting a code =) - Gonza12