We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

.PAS ----> .DOC

iNDiGLo
iNDiGLo asked
on
Medium Priority
610 Views
Last Modified: 2010-04-04
I want to be able to copy/export my Color Syntax Highlighted .PAS files to a Microsoft Word Document and keep the same colors and formatting that I see when I'm in Delphi. Reason: I am converting some files into .PDF files and I need a .DOC file.  If I highlight all the text in a .PAS file and paste it into Microsoft Word I loose all the color and formatting and all the text ends up being aligned to the left edge. I'm so frustrated....
Comment
Watch Question

You need to convert it to RTF. Doing that will preserve all the syntax highlighting and colours. There are some pascal to rtf converters on DSP (http://sunsite.icm.edu.pl/delphi/)  (though the DSP search pageb is down at the moment 'cause it is being updated. I'll dig out a URL for you when it comes back.

Cheers,

Raymond.
Heres a URL to a .PAS to RTF converter which will preserve syntax highlighting etc. Word will then read the RTF directly...

http://home.sol.no/~stenvart/delphi/makehtml.html

Cheers,

Raymond.

Here's another related one:

http://www1.omnitel.net/proga/cm20.zip

Cheers,

Raymond.

Author

Commented:
Thanks for the two links but they don't exactly do it. The first one doesn't work on the entire file. It only works on about 80% of the file. Its buggy. The second file is great for creating rules to highlight your text in delphi but again you can't get the information COLOR SYNTAX HIGHLIGHTED into an RTF file.

Commented:
Maybe you can view this article, if you can get the code on the webpage to work, you may get what you want.
http://216.22.198.171/Articles/981027d.html
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Commented:
Ohh, I'm previos answers too long.
It's make by different way.
Lookig by lexical analizators!!! It's very easy... in any cases.

Specification example:

NQUOTE    [^']

%%

[a-zA-Z]([a-zA-Z0-9])*  begin
                      //test yytext value for keyword
                      //else it's identifier
                      //prepare output file like RTF
                       end;

'({NQUOTE}|'')+'        return(STRING);
"{"                     begin
                        //it is coment
                        c := get_char;
                        while c <> '}' do
                               c := get_char;
                        end;
                       begin
                        //put characters to output stream
                        end;

mail in difficults: slautin@yahoo.com

Commented:
I think that write lexical analizer manually -  not best way.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.