Are there any third party libraries that can lex SQL and return an rich text string?
This would be the easiest way to avoid writing your own syntax highlighter that understands the full SQL grammar. Looks like there area bunch of online syntax highlighters that will produce HTML output. [1] You could also look at Eclipse's source code to see how they accomplish syntax highlighting. You might have better luck asking your question on StackOverflow or another community where there are more people who have integrated syntax highlighters into their application. Once you have that, writing the colorized SQL to a Word document via POI is easy. If this is a one-off, you can also copy your SQL code to Notepad++ or any other application which supports OLE/rich text on a clipboard, you can paste the colorized text back to the Word document. [1] https://stackoverflow.com/questions/221570/what-code-highlighting-libs-are-there-for-java On Mar 3, 2017 02:46, "Peter Remec" <peter.re...@gamadata.si> wrote: I'm generating a .docx file using Apache POI. This file contains a lot of SQL code and is quite unreadable so I was thinking about coloring that code. Any idea how to achieve that? I understand that POI doesn't have some highlighter to complete this task. I'm just looking for some idea of how to highlight it during file generation with POI. Thanks! --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For additional commands, e-mail: user-h...@poi.apache.org