Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 05/31/2012 09:17 AM, berritorre wrote:
Hi Andreas,

I thought I had posted loads of trivial example data. What could be a

Actually if you are referring to:

"So here would be a csv file with delimiter:


As a fixed length ascii file it should look like this:
"

it didn't make it through to the list. However, when viewed from nabble
<http://nabble.documentfoundation.org/Problem-when-exporting-exporting-from-CALC-to-a-fixed-length-csv-td3986825.html>

 I see:

<quote>
So here would be a csv file with delimiter:

1;12;123;1234;12;12345
2;2;2;22;2;22222
3;33;33;333;3;3333
4;4;444;4;44;444
5;55;5;5555;5;55


As a fixed length ascii file it should look like this:

11212312341212345
2 2  2  22 222222
333 33 333 3 3333
4 4444   444  444
555  55555 5   55


But unfortunately, LibreOffice inserts some a space in front of each column.

 1 12 123 1234 12 12345
 2  2   2   22  2 22222
 3 33  33  333  3  3333
 4  4 444    4 44   444
 5 55   5 5555  5    55

</quote>

Yes, as expected:

<Export text files
The Export text files dialog allows you to define the export options for
text files. The dialog will be displayed if you save spreadsheet data as
file type "Text CSV", and if the Edit filter settings check box is
marked in the Save As dialog.>
...
<Fixed column width
Exports all data fields with a fixed width.
The width of a data field in the exported text file is set to the
current width of the corresponding column.
Values are exported in the format as currently seen in the cell.
If a value is longer than the fixed column width, it will be exported as
a ### string.
If a text string is longer than the fixed column width, it will be
truncated at the end.
The alignment Left, Centered, and Right will be simulated by inserted
blanks.>


problem is that you read this in your email program and I am writing the
posts in Nabble, where I can format the example texts and the show nicely,
because I have formatted them with a fixed length font by using the option
"raw text". In your email program it might actually look all skewed and is
difficult to read.

Got it.


Your's is too trivial though. ;-)

Because it doesn't take into account that while there might be 4 digits
reserved for the column, the length of the data in the column might vary
from 1-4 digits. And here is the problem. There are spaces inserted to align
the digits into the column. In theory zeros could be added, but in this case
this is not possible. There must be spaces.

I guess that you are redefining the meaning of a .csv file. While there
are no ' absolute standards' that I am aware of, this is close:

https://www.ietf.org/rfc/rfc4180.txt
Also see:
<https://en.wikipedia.org/wiki/Comma-separated_values#Lack_of_a_standard>
<https://en.wikipedia.org/wiki/Delimiter-separated_values>

E.g. it can't be:


but must be


<quote>
E.g. it can't be:

1234
0001
0002
0010
0999


but must be

1234
   1
   2
  10
 999
</quote>


I think Paul got my problem. LibreOffice shouldn't add any spaces in the
first place, as long as it is not told to do. Because the spaces actually do
not exist in the data and are only added for exporting the spreadsheet.

I think you are misunderstanding the tool and attempting to make it
something that it is not. You might be able to do this with a macro (as
suggested by Andreas, but I fail to see how this is Calc's fault/issue.





-- 
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.