Export Arduino Code to MS Word

Is there anyway of exporting my code to MS Word so I keep the Arduino code formating instead of just getting normal text?

To make it short: No.

But there are importer for Word to do the pretty printing itself, p.e. http://www.comsci.co.uk/freedownloads.html.

Arduino comes standard with a pretty nice Programmers editor in the 'avr toolchain' dir : arduino-1.0.1/hardware/tools/avr/pn/pn.exe Feature list is pretty good : http://www.pnotepad.org/features/

dme916_2: Is there anyway of exporting my code to MS Word so I keep the Arduino code formating instead of just getting normal text?

You can do it in a roundabout way:

  1. From the Arduino IDE, select your code and click Edit -> Copy as HTML
  2. Paste the text into a textfile and save it with a .html extension
  3. Open the HTML file in your web browser and copy all text.
  4. Paste into your document in Microsoft Word.
1 Like

What are you trying to do?

thanks perhof this is exactly what I needed

Great perhof, that helps me too.

[quote author=James C4S link=topic=151593.msg1138594#msg1138594 date=1362152296] What are you trying to do? [/quote] James, I am a computer science student. My current project requires me to build a report of my work with the Arduino, and I need to import the code in the report (MS word)

I'm pretty sure I don't understand what you are asking. Maybe the problem is with Word. I open .ino files in LibreOffice Writer, they look fine (it's not really an import, they're UTF-8). Great for setting a wide left margin for printing on 3-hole punched paper. I could use LibreOffice for programming, as long as I was careful to save as plain text, not odt. What happens if you just open in Word (treating like a text document, which it is)?

polypagan: I'm pretty sure I don't understand what you are asking.

They don't understand why copying/pasting or opening a ino file in Word doesn't have the same formatting and coloring as the Arduino IDE.

Thanks, James,

I hadn't thought of that. I think of those color cues as an aid to entering text, not necessarily to presenting/understanding it, so it hadn't occurred to me.

If one uses the Linux editor Kate, (KDE Advanced Text Editor, which can likely be installed on Mac OS X) you see the .c/.cpp coloring, which can be directly printed.

This may not match the Arduino IDE's definitions, however it is programmable if important. I don't know of a Windows equivalent, so I suppose the multi-step method using html may be the best route.

I've just been experimenting. You can get a "Code Colorizer" add-on for Open Office which allows you to select some code and have it coloured - not exactly like in the IDE or Gedit, but it would probably be perfectly OK for a presentation document.

There may be something similar for Word.

...R

perhof: You can do it in a roundabout way:

  1. From the Arduino IDE, select your code and click Edit -> Copy as HTML
  2. Paste the text into a textfile and save it with a .html extension
  3. Open the HTML file in your web browser and copy all text.
  4. Paste into your document in Microsoft Word.

thanks!!

perhof: You can do it in a roundabout way:

  1. From the Arduino IDE, select your code and click Edit -> Copy as HTML
  2. Paste the text into a textfile and save it with a .html extension
  3. Open the HTML file in your web browser and copy all text.
  4. Paste into your document in Microsoft Word.

For Mac users, in TextEdit, you have to convert to Plain Text format after copying then save as html. There will not be an option to save as html, you must manually save as: "name".html and confirm you want to save as html.