Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

presenting code in documents.

Options
  • 03-03-2009 5:19pm
    #1
    Registered Users Posts: 26,579 ✭✭✭✭


    I have to stick some C code into documents (.doc files) and i hate the way it's all crappily idented and no syntax highlighted.

    is there any plug-ins you can get for word/open office (preferrably word 2003) that will indent and syntax highlight portions of the document.

    also i have a word press blog where i put some snippets of code as well, and would like to know if there's a similar thing, it's no big deal if there isn't for wordpress i can live without it, but there must be something for .doc files surely?

    i've tried googling it, but as always i tend mess up the wording of the google query and end up not getting results which i expect.


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Google Microsoft Word syntax highlighting seems to give a few good results. Or at least some good starts.


  • Registered Users Posts: 5,379 ✭✭✭DublinDilbert


    if you download dev C++ for windows (you might have it already), open the C file in it. Then you can export as a RTF file, which will give you a file which word can open. It will include the formatting + syntax colouring too.... it doesn't look too bad for reports etc..


  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    thanks guys, will try these out when i get home, no access to a windows pc here at work :pac:


  • Registered Users Posts: 7,518 ✭✭✭matrim


    I'm not 100% sure with wordpress but in HTML wrapping in a <pre> tag will keep the indenting but not syntax highlighting.

    I know wiki's and such have addons to do syntax highlighting so wordpress might have something like that too

    edit : after a quick google for "wordpress code tag" http://codex.wordpress.org/Writing_Code_in_Your_Posts


  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    cheers all i'm going to go down the dev c++ and export to rtf format. it's the least hassle solution :)


  • Advertisement
  • Closed Accounts Posts: 2,046 ✭✭✭democrates


    Does using the Courier font not do the job?
    Edit: forget that it only addresses indenting, sloppy glance at op on my part.


  • Registered Users Posts: 1,512 ✭✭✭stevire


    For C++/Delphi:
    http://www.softaward.com/635.html

    For HTML/JavaScript/VBScript/PHP:
    http://www.codeproject.com/KB/COM/wordhighlight.aspx

    Both tried and tested in Word 2003


  • Registered Users Posts: 163 ✭✭stephenlane80


    Hi,

    You can convert the code to farmatter html with this tool: http://www.carlosag.net/Tools/CodeColorizer/

    Then you can copy the formatted html into wordpress and word,

    I use latex for most of my documents which has an excelent plugin called "listing" for displaying code and stuff


  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    stevire wrote: »
    For C++/Delphi:
    http://www.softaward.com/635.html

    For HTML/JavaScript/VBScript/PHP:
    http://www.codeproject.com/KB/COM/wordhighlight.aspx

    Both tried and tested in Word 2003

    cheers just tested them now and they work too.
    Hi,

    You can convert the code to farmatter html with this tool: http://www.carlosag.net/Tools/CodeColorizer/

    Then you can copy the formatted html into wordpress and word,

    I use latex for most of my documents which has an excelent plugin called "listing" for displaying code and stuff

    i was hmmming and hawing about whether or not to use latex for my document, but i thought the learning curve and the little time i had to finish this document that i'd be safer going with word.

    i also found the using Xcode on OS X will preserve the syntax hightlighting when pasting into MS word on OS X, which is what i went for in the end because Xcode seems to hightlight C GTK+ code better than the rest.


  • Registered Users Posts: 5,618 ✭✭✭Civilian_Target


    Copy and paste from Eclipse keeps code highlighting.


  • Advertisement
  • Closed Accounts Posts: 2,039 ✭✭✭rmacm


    i was hmmming and hawing about whether or not to use latex for my document, but i thought the learning curve and the little time i had to finish this document that i'd be safer going with word.

    If it's worth anything I was in the same position when I was doing my final year project report and I decided to abandon Word and use Latex. The learning curve wasn't huge and my supervisor helped me out a bit.

    I found this tutorial pretty useful http://andy-roberts.net/misc/latex/ granted since I've started working I've been forced to learn how to use Word properly and work with styles etc which tends to make things a bit easier.


Advertisement