Search code examples
androidandroid-studioms-wordsyntax-highlightingexport-to-word

Android Studio: Copy text with syntax highlighting


I am writing a programm with Android Studio V1.1 and I want to copy my code into a MS Word 2013 document. When I copy the code its just black in Word.

Is there a way to copy the text with syntax highlighting? I copied the code into Notepad++ and there is this "Copy Text with Syntax Highlighting" option but I that doesnt look as good as in Android Studio.

It would be great if someone could tell me a solution. Thanks!


Solution

  • As long as MS Word 2013 does not support syntax highlighting for code, you are not able to "automatically" colorize the copied code. Since the plain text does not contain color information's. It's only text. The highlighting comes from Studio itself, which parses the text and colorizes the text accordingly to the theme and programming language. If you want to have it looking like your color code theme in studio, you have to change the colors yourself. For website purposes, you could use one of the online code syntax highlighter.

    Edit: As far as I known, Syntax Highlighting from IntelliJ to LibreOffice and Chrome (in some cases) works well.