Converting excel to text file - Issue with wrapping text

G

giridar

Hi,

I want to convert an excel file to a .prn file.

Here I need to retain the column width of all the columns in the excel
as it is. I could do that by changing the autoformat to None.

But the issue is when i try to save it as .prn file, it wraps up the
text in the .prn file. the maximum length it goes without wrapping in
the notepad is 236 character size.

I am not really sure how to convert it to a .prn file retain column
width without the wrapping in the text file.

any suggestions would be highly appreciated.

Thanks,
Giri
 
D

dderolph

How do you convert an excel file to a .prn file? Do you mean you selec
Print to file when you use the Print command? I did that but I can'
tell whether it's a .prn file; I don't see the .prn extension, eve
from a DOS view.

Also, when I print to file from Excel, I can't open that file wit
Notepad.

What about saving as a text file via Save As | Text? I just saved
Excel sheet with a string of 398 characters in one cell. Then,
opened it in Notepad. It displays as one line. Of course, Word Wrap
under Format in Notepad, is disabled
 
G

giridar

actually if you open an excel file and then do a

"SAVE AS " and give the file type as "FORMATTED TEXT (SPACE DELIMITED
, it would save it as a .PRN file.

secondly i am not trying to save a 309 character from a single cell.

wat i am trying to do is something like this.

col1 (50chars ) col2 say(50) col3 .................



then i want the same spacings to be maintained in the notepad too.

It starts giving this wrapping issue when the size of columsn togethe
exceed 236 in the excel.

In the notepad the wordwrap is disabled.

Hope this explains my problem
 
D

dderolph

I understand how a .prn file is created now. I tried to duplicate wha
you're doing and I also find that Notepad limits the number o
characters it will allow to be displayed on one line.

However, as I mentioned in my previous post, saving the file as Tex
(Tab delimited) does create a file for which Notepad will displa
longer lines.

So, the only thing I can suggest is to try using a different fil
format, something other than .prn
 
G

giridar

well

as you said the trying other than .prn would help get it in a singl
line.

But it would defeat the original purpose i.e., to retain the colum
lengths as defined in excel.

If i use tab delimited type, the original column spacing is no
reflected in the text file being created.

Since this is to be used for input of a program load, the spacing ha
to be retained in the text file.

If you would know of any other format which if i use while saving th
excel with "SAVE AS " would allow the column width to be retained an
still store in single line without wrapping, please let me know
 
D

David DeRolph

Are you sure the program to which you want to load this data cannot be
configured to recognize some other format such as .csv?

If not, I think you might neet to use a different text editor. For example,
here's one from a Google search on text editors. See
http://www.textpad.com/. The specifications page says, "
a.. The 32-bit edition can handle file sizes up to the limits of virtual
memory. The 16-bit edition is limited to files of up to 32,500 lines, with a
maximum line length of 4096 bytes."

Also, you could probably find a freeware text editor that might serve your
purpose.
 
D

Dave Peterson

There are limitations with saving as a .prn file (especially 240 characters per
line). If you try it and it doesn't quite work:

You have a few choices (try against a copy of your worksheet):

I'd either concatenate the cell values into another column:

=LEFT(A1&REPT(" ",5),5) & LEFT(B1&REPT(" ",4),4) & TEXT(C1,"000,000.00")

(You'll have to modify it to match what you want.)

Then I'd copy and paste to notepad and save from there. Once I figured out that
ugly formula, I kept it and just unhide that column when I wanted to export the
data.

If that doesn't work for you, maybe you could do it with a macro.

Here's a link that provides a macro:
http://google.com/[email protected]

=======
And in win98's version of notepad, I could get at least 1025 characters per line
before it wrapped (automatically).

But that was just a display problem. I saved the file, reopened in a nicer text
editor (UltraEdit) and saw my line at 2500 characters with no line wrapping.
 
G

Greg Evensen

Hi,
You need to set your paper size in the printer setup
to be wider for the Generic/Text Only printer. This is
because Excel is drawing each character to the device
context of the printer, and when it detects it has reached
the right margin, it wraps the line. Using a larger
paper size and/or using landscape mode will increase
the number of characters that will fit on a line.

Some programs just have the effect of cutting the
line off at the right margin because they assume the
line will fit. You may also try using a smaller font
size so that each character escapes less when the app
is drawing to the device context.

A device context is an in-memory drawing surface,
like a sheet of paper with a coordinate system based on
the resolution of the device, that a program uses to
draw to either a bitmap, screen, or printer.

Automate "print to file" with Virtual Port Monitor
http://www.alphatronics.com/AVPMon.html

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top