On Thu, 2006-03-02 at 13:49 -0700, Shane Johnson wrote:
> I could use some help please.
>     I am trying to mimic something I did all the time in Excel and need 
> to do in Calc.  I need to export a calc file as a space delimited text 
> file with the column width set at:
> Column 1 22 Characters
> Column 2 1 Character
> Column 3 5 Characters
> 
>     I have searched the mail archives and can't find anything on this.  
> I have tried save as a CSV files and formatting it as fixed width but I 
> can't get it to work right.  With Excel I would just get the data into 
> the columns I needed and then size the columns by the number of 
> characters that I needed in the column and then export it to a space 
> delimited file.  Please let me know the best way to do this.  If I need 
> to use something besides inches for the measurement of the column width 
> I can do that but I need to know how to figure out how to do it.  I 
> appreciate your help.

As you've found, Calc appears only to allow setting column width in
standard length units and not characters. Obviously Calc uses some value
for the character width and I assume it varies depending on the
character set chosen. Since csv export is assuming fixed-width
characters, you can measure it yourself.

Set a very wide column width of a known size, e.g. 10 inches or 25cm
etc. Save it, and count the characters actually exported. Then calculate
your character "pitch" (number of characters per inch etc). I found mine
was 129 characters in a 10 inch column - or 0.0775 in per character - or
a little more than 12 pitch. It doesn't appear to use the font setting
in Calc, but presumably you are setting your font to Courier or some
other fixed width font anyway so that what you see is almost what you
get. Standard courier is 12 pitch IIRC, so it will be close.

Use this value to calculate your column widths. Pretty laborious but I
was able to set up  22, 1, and 10 character fixed width columns in a
test table. Calc doesn't add column delimiters for fixed-width export,
so I added a dummy column 1 character (0.08") wide for column
delimiting.

This seems to be the only way. If you need absolute guaranteed widths
where accidents could cost money, then post-filter the csv using an
plain text formatting tool.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to