Vish
Vish

Reputation: 4492

formatted PHP code in Microsoft Word

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

Upvotes: 4

Views: 14339

Answers (6)

nicola
nicola

Reputation: 2211

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

Upvotes: 13

RobertPitt
RobertPitt

Reputation: 57268

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.

Upvotes: 2

Spudley
Spudley

Reputation: 168685

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.

Upvotes: 1

Kavi Siegel
Kavi Siegel

Reputation: 2994

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

Upvotes: 2

webdad3
webdad3

Reputation: 9080

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.

Upvotes: 4

PseudoNinja
PseudoNinja

Reputation: 2856

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.

Upvotes: 2

Related Questions