Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put Objective C code into Word (Office) with syntax highlighting

I am writing documentation about an app and want to explain the code. I want to copy parts of the Objective C code from Xcode to Microsoft Word. I don't know how to put the code with syntax highlighting (and maybe line numbers, too ?!) into Word.

Does anybody know a usable solution for this little problem?

like image 978
brush51 Avatar asked Feb 09 '11 10:02

brush51


People also ask

How do I insert C code in Word?

Go to the Insert tab, click the Object drop-down arrow, and pick “Object.” On the Create New tab, select “OpenDocument Text” as the Object Type. Click “OK.” A new Word document will open for you to insert your code or command.

How do you highlight code snippets in Word?

Right click and select Plugin commands -> Copy Text with Syntax Highlighting; Paste it into MS Word and you are good to go!


2 Answers

Copy and paste works !

Nevertheless, make sure the option "Copy colors and fonts" in Preferences>Fonts & Colors is checked !

like image 196
Michel Guillet Avatar answered Nov 13 '22 05:11

Michel Guillet


If you need this in Pages you can paste into textedit then copy/paste from textedit into pages. I have yet to find a way to paste directly into pages and preserve the text color etc

like image 27
SteveG Avatar answered Nov 13 '22 06:11

SteveG