Converting source files to something nicely formatted, and printable?


D

DanielESFA

Hey :)

Gonna hand in my programming project tomorrow, and I have to print all code
of my KDevelop project. Kwrite, which is the editor in KDevelop, formats
the code very nicely, with automatic indentation on line breaks, but when I
print it, that indentation isn't preserved.

I was thinking there might be some tool to convert code files into something
nicely formatted, that can be easily printed, or even better, imported into
openoffice writer?

Thanks in advance,
Daniel :)
 
Ad

Advertisements

K

Karl Heinz Buchegger

DanielESFA said:
Hey :)

Gonna hand in my programming project tomorrow, and I have to print all code
of my KDevelop project. Kwrite, which is the editor in KDevelop, formats
the code very nicely, with automatic indentation on line breaks, but when I
print it, that indentation isn't preserved.

I was thinking there might be some tool to convert code files into something
nicely formatted, that can be easily printed, or even better, imported into
openoffice writer?

2 important things when dealing with source code:
* make sure you selected a fixed with font, such as 'Courier'
* make sure tab-s expand to the same number of spaces.
Best would be to not have any tab-s in a source code but to
replace them with spaces (a small self written utility can do this
very easily).

If those 2 simple rules are considered, 99.9% of your problems, when moving
source code to somewhere else (including the printer), will be solved.
 
D

DanielESFA

Karl said:
2 important things when dealing with source code:
* make sure you selected a fixed with font, such as 'Courier'
* make sure tab-s expand to the same number of spaces.
Best would be to not have any tab-s in a source code but to
replace them with spaces (a small self written utility can do this
very easily).

If those 2 simple rules are considered, 99.9% of your problems, when
moving source code to somewhere else (including the printer), will be
solved.

Yes, thanks, but the problem is to get the automatic indentation on line
breaks to "go through" to the print, also. As it is now, it does not... :)
 
K

Karl Heinz Buchegger

DanielESFA said:
Yes, thanks, but the problem is to get the automatic indentation on line
breaks to "go through" to the print, also. As it is now, it does not... :)

The automatic indentation most probably inserted tab-s instead of spaces.
Check this and replace them with spaces.

As said: If the above 2 rules are considered. I didn't say that you current
tools do that, but there might be a way to force them to. Eg. my editor
has an option "insert spaces".
 
Ad

Advertisements

D

DanielESFA

Karl said:
The automatic indentation most probably inserted tab-s instead of spaces.
Check this and replace them with spaces.

No, actually, it's not hard-coded indentation like that, it just wraps lines
so that they follow the indentation on the wrapped line also...
As said: If the above 2 rules are considered. I didn't say that you
current tools do that, but there might be a way to force them to. Eg. my
editor has an option "insert spaces".

Hmm, I re-checked my options, but I don't have such an option here... I'll
check other editors, like emacs...

Thanks.
 
Ad

Advertisements

D

DanielESFA

DanielESFA said:
Hey :)

Gonna hand in my programming project tomorrow, and I have to print all
code of my KDevelop project. Kwrite, which is the editor in KDevelop,
formats the code very nicely, with automatic indentation on line breaks,
but when I print it, that indentation isn't preserved.

I was thinking there might be some tool to convert code files into
something nicely formatted, that can be easily printed, or even better,
imported into openoffice writer?

Thanks in advance,
Daniel :)

Nevermind, I wrote a small program to do it for me. ;)

Cheers,
Daniel :)
 

Top