4

I would like to save my php code from nusphere phped colour coded to microsoft word. How can I do that?

Vish
  • 4,508
  • 10
  • 42
  • 74

6 Answers6

12

i know one way.

open this page: http://qbnz.com/highlighter/demo.php

the above link is the php syntax highlighter on web,

(1) copy and paste your php code to the text area labelled 'Input via a text field:'

(2) go to the 'Options' selectbox below that text area, and choose 'Line numbers: none'

(3) click the 'Highlight!' button at the bottom of the page

(4) the highlighted php code will be shown

(5) select, copy this highlighted code, and paste it into Word. u will see the colored code in your Word document

those' are the detailed steps

hope this may help

nicola
  • 2,141
  • 1
  • 19
  • 19
4

Take a look at this post here: How do you display code snippets in MS Word preserving format and syntax highlighting?

I'm not sure you can do it from that specific IDE, maybe there is a plugin for it. However, this question has been asked before.

Community
  • 1
  • 1
webdad3
  • 8,893
  • 30
  • 121
  • 223
2

Your color formatting will not carry over. You have a choice, Take a screen shot and paste it as an image (making it un-editable) or lose your color coding and have something functional just not pretty.

PseudoNinja
  • 2,846
  • 1
  • 27
  • 37
2

Try to use this: http://php.net/manual/en/function.highlight-file.php It should copy over.

Kavi Siegel
  • 2,964
  • 2
  • 24
  • 33
  • From the command line, run `php --run 'highlight_file("/path/to/myfile.php");' > /tmp/code.html`, and then open that file with your favourite Web browser. You can then cut and paste that colourized code into your document. – colan Nov 08 '13 at 19:02
1

nusphere doesn't retain the colour coding data in copy+paste. Nor do most (any) other IDEs.

You might find some luck pasting the code into an online site that does colour coding, and then using copy+paste from there, since it'll have been generated into static HTML, which will retain the colour coding when you copy+paste.

The question form in this very site would be an example of a site that works that way, although I wouldn't suggest pasting code here just to paste them into Word -- it won't make you popular around here! ;) But there are other sites that may be better suited to that, or you could grab a freeware web app that does it and host it locally for your own use.

Spudley
  • 166,037
  • 39
  • 233
  • 307
1

A simple way to accomplish this to copy your source into a syntax highlighter on line such as http://www.tohtml.com/ and then produce the html based highlighting, when you copy the highlighted text from the html page word will read and understand the colours.

RobertPitt
  • 56,863
  • 21
  • 114
  • 161