Bug 149760 - Allow to define column widths for fixed-width CSV export from export filter's token 5
Summary: Allow to define column widths for fixed-width CSV export from export filter's...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL: https://forumooo.ru/index.php/topic,9233
Depends on:
Blocks: CSV-Export
  Show dependency treegraph
Reported: 2022-06-28 13:09 UTC by Mike Kaganski
Modified: 2024-03-27 05:28 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2022-06-28 13:09:03 UTC
As mentioned in bug 149759, currently token 5 of CSV filter parameter string [1] is import-only. Still it would be nice if this token could be used for export, when fixed-width export is used (FIX in token 1). In than case, the token could take a simplified form of "0/30/48/97" to define the position at which to start the respective column, or maybe "10/10/5/50" to define width in characters for each column.

Currently, converting to CSV from command line could produce a "glued" columns, like

  col1  col2 col3
  abc   ghi  jkl
  abcdefghi  jk

where the "abcdef" is not separate from "ghi" in the second data row. (The actual result could be worse, with all rows having glued data, so it would be impossible to tell one column from another.) The export takes the widths from the "physical" column width in lcl_ScDocShell_GetFixedWidthString. So the new feature, if implemented, would make that code consider the passed column widths when present.

[1] https://help.libreoffice.org/7.4/en-US/text/shared/guide/csv_params.html
Comment 1 Mike Kaganski 2022-06-28 14:21:17 UTC
OTOH, this would go against the "store as close to document model as possible" principle, with the calculated column width in character approximating the column width as it was imported being the closest possible for the given format.
Comment 2 Stéphane Guillou (stragu) 2024-03-26 23:53:09 UTC
Makes sense to me, maybe as an option off by default if you think it doesn't fit that principle?