Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Microsoft_Word_problem

Status
Not open for further replies.

jhanus

New Member
Hello, I'll ask here because it's the best place to ask.

How to write code in word, so it doesn't cut long lines in another row, so that code remains with its original formating, like disabling word wrap in notepad or like
Code:
 tags here.
Thanks
 
The only way I know to do this is,
Insert a text box (menu insert->text box),
Select font courier in the text box,
Paste your code.

It will mess up the format slightly but inserting/deleting a few tabs should fix it.
Example attached.

Mike.
 

Attachments

  • Word.png
    Word.png
    33.6 KB · Views: 223
MS Word could work fine depending what particular font you use. Some fonts can really mess it up. If you can SELECT ALL and preview the code as you select different fonts, you'll see firsthand which fonts work without major corrections needed.
 
Using MS Word to write code is like using a screwdriver to install a nail. Proper tool for the job. Get a code writing editor. You can always cut and paste from editor to word for a design writeup. Crimson works nice, and is free. Another one you might try is Em editor. EmEditor text editor - Unicode text editor for Windows supporting large files!

I like editors that have split window options which is nice when working code.
 
Last edited:
Thx, for replays, problem is I wrote the code in WinCC C editor and now I have to insert it for project documentation.

When I wrote it I didn't think on that and now a few hundred lines are braking all over the place. I managed to fix it, somehow...
:p
 
Ahh, that is what I figured you were doing. I will have to think on that a bit. I am sure we can find an easy solution.
 
I downloaded some C code from the net. Opened it in Emeditor, copy pasted to word.

Attached are my results.
One is the word file other is from Emeditor.
 

Attachments

  • BENCH.doc
    22.5 KB · Views: 314
  • bench.txt
    1.3 KB · Views: 190
in early days of DOS we used Norton editor.
after windows have taken over, i fear Norton editor is getting some compatibility issues.

However, wordpad appears working well for these applications. No point in using Microsoft word, unless it is saved as .txt file-- there also all the tabs etc appear and i used to see some files having "par/" at end of each line.

.
 
I think Brief was the editor of the DOS days.

If you cut and paste from a txt file to Word, you can use the paste special feature to preserve tabs and spaces.
 
Last edited:
Thanks for help, I managed to make as small amount of lines to brake.
As I see it, MS word is program which makes directly a visual printable version, for example A4 format, so if there would be an option to make long unbreakable lines, how would one then print that.

Ahh, time will come, where no more obsolete paper is needed, forest will be grateful too. :)
 
Thanks for help, I managed to make as small amount of lines to brake.
As I see it, MS word is program which makes directly a visual printable version, for example A4 format, so if there would be an option to make long unbreakable lines, how would one then print that.

Ahh, time will come, where no more obsolete paper is needed, forest will be grateful too. :)

Can you post a sample of your code in txt format, just a short snipit. Unless it is proprietary.
 
, so if there would be an option to make long unbreakable lines, how would one then print that.


Do you mean lines that dont all start with a Capital letter when you press the Enter key.??
 
Can you post a sample of your code in txt format, just a short snipit. Unless it is proprietary.

Here it is, but I don't know how it will exactly help...


Do you mean lines that dont all start with a Capital letter when you press the Enter key.??

No, lines which are simply to long to fit in same row, but have to fit.
 

Attachments

  • part.txt
    3.4 KB · Views: 238
Well shoot, I am currently stumped. Looks like you have a lot of tabs in your code. When I try to copy over to word, the whole thing goes crazy. Not sure why. I will keep trying.
 
Well, I still have not figured this out, but I did notice a difference in a code file that formats well in word and your code. Here is what is found.
With Emeditor I compared character codes.
Good file Char code = U+002F, ANSI 2F
Your File Char code = CR+LF, U=000D, U+000A

Don't know what that means but it is a difference and maybe someone else knows what it means...
 
Well, I still have not figured this out, but I did notice a difference in a code file that formats well in word and your code. Here is what is found.
With Emeditor I compared character codes.
Good file Char code = U+002F, ANSI 2F
Your File Char code = CR+LF, U=000D, U+000A

Don't know what that means but it is a difference and maybe someone else knows what it means...

Hi Mike,
If the OP can program in say, Visual Basic, he could write his own 'code tidy' like Mike aka Pommie has done for assembler.

Thats what I would do.:)
 
Hi Mike,
If the OP can program in say, Visual Basic, he could write his own 'code tidy' like Mike aka Pommie has done for assembler.

Thats what I would do.:)

I am assuming his code was tidy in his editor, but it is not compatible with most text formats. I really dunno. It was apparent from the character codes that there is a difference in file format. I really don't understand it though. :eek:

You do realize vis basic is not common for embedded design and is outdated :)
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top