post source code from MS word to wordpress

  • Unknown's avatar

    I wrote below paragraph to MS word.

    [sourcecode language="cpp"]
    #include “stdafx.h”
    #include

    int _tmain(int argc, _TCHAR* argv[])
    {
    using namespace std;
    cout << “c”;
    cout << “B”;
    cout << “1” << endl;
    cin.get();
    cin.get();
    return 0;
    }
    [/sourcecode]

    But when i opened my wordpres web site, they show me a raw html tags. This is a result paragraph of the above code paragraph in wordpress edit mode. In the other words, they show me html tag in source code box in normal wordpress view. how can i fix it or go around it? just pasting code from visual studio to ms word and publishing it to wordpress isn’t good quality. So I want to know other way to go through it.

    [sourcecode language="cpp"]

    #include “stdafx.h”

    #include

    </span></p><p>
    </p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”>int _tmain(int argc, _TCHAR* argv[])
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”>{
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”> using namespace std;
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”> cout << “c”;
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”> cout << “B”;
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”> cout << “1” << endl;
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”> cin.get();
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”> cin.get();
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”> return 0;
    </span></p><p><span style=”color:blue; font-family:돋움체; font-size:9pt”>}
    </span></p><p><span style=”color:blue”><span style=”font-family:돋움체; font-size:9pt”>
    </span><span style=”color:black; font-family:나눔고딕; font-size:10pt”>[/sourcecode]

  • Hi calanchue,

    Copying and pasting from MS Word to the WordPress dashboard brings along a lot of messy formatting issues (as you found out). This support document might help you out:

    Microsoft Word

    You may find it cleaner to use a text editor to write your code instead of a word processor. I hope that helps!

  • Unknown's avatar

    also see here:
    http://chemprofdave.wordpress.com/2014/06/02/conversion-from-word-mostly-solved/

    But I think what you want is to save your Word file as “text only” and then open it with Notepad (windows) or TextEdit (Mac). Then make sure you are using the “Paste As Text” (suitcase icon) in the WordPress dashboard.

  • The topic ‘post source code from MS word to wordpress’ is closed to new replies.