开发者

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 kno开发者_Go百科w 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?


Copy and paste works !

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


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


If you copy from Xcode and paste into Word you get syntax highlighting etc as expected. You just need to reduce the font size to make it more readable and avoid wrapping etc. It would probably be a good idea to define a suitable Style in Word, e.g. "Code" which would have the required font size etc for pasted code.


It supports these by default in Xcode 4. And what you need to do is to choose "Use Orignal Format" in Word or Power Point.


If you need this in Pages, then a workaround is to copy in Xcode, paste in Word, copy again and then paste in Pages (That is if you have MS Word available).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜