Bug 86336 - FILEOPEN Calc ignores custom template when opening csv file
Summary: FILEOPEN Calc ignores custom template when opening csv file
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected) release
Hardware: All All
: low minor
Assignee: Not Assigned
Depends on:
Blocks: CSV-Import
  Show dependency treegraph
Reported: 2014-11-16 10:51 UTC by FS
Modified: 2021-02-27 04:59 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

Example CSV file for testing (62 bytes, text/csv)
2014-11-17 12:31 UTC, FS

Note You need to log in before you can comment on or make changes to this bug.
Description FS 2014-11-16 10:51:41 UTC
Current behaviour: Calc ignores a custom template set as default when opening a CSV file.

Expected behaviour: When opening a CSV file and with a custom template set as default, Calc uses that custom template to display the csv file.

Steps to reproduce:

1. Create a custom calc template:
a. Create a new Calc file;
b. Modify the default style, e.g. set a different font;
c. Save the file as template using menu File -> Templates -> Save as template

2. Set as default template:
-> Menu File -> Templates -> Manage, select your template, "Set as default" button.

3. Verify that Calc knows and applies the new default template:
-> Close and re-open Calc. The new file should use the custom style set in step 1.c.

4. Open a CSV file with Calc. Calc won't use the custom style set in step 1.c. -> Problem!

There are some workarounds (see http://superuser.com/questions/302107/how-to-set-the-default-font-in-libreoffice-calc/302133#302133 at the end), but it would be nice if Calc would apply custom templates in a consistent way.
Comment 1 Joel Madero 2014-11-16 20:19:38 UTC
Ubuntu 14.10 x64
LibreOffice release

Confirmed (NEW)
Minor - slows down professional quality work but does not prevent it.
Low - default for minor bugs.

(please don't change the severity/importance without knowing what they are used for).

It would be good to upload a csv file so it's faster to test this.

Thanks for reporting! Indeed a little frustrating.
Comment 2 FS 2014-11-17 12:31:46 UTC
Created attachment 109614 [details]
Example CSV file for testing

Sample CSV file added to ease testing.
Comment 3 Aprax 2015-09-17 08:42:41 UTC
I can confirm that the Options > LibreOffice > Fonts doesn't respect the Font Settings for HTML, Basic and SQL Sources.

Even though I've specified that Times New Roman should be used with Size = 8, it consistenly uses Liberation Sans and the result is HUGE characters.

I've also tried using the Replacement Table to convert Liberation Sans to Times New Roman but this doesn't work either.

In my case, I have an sql database from which I want to extract rows of data from a specific table to a csv file (there's no option for an ods file). 
Each day a scheduled job performs the extaction and then clears the data from the table, I open the csv and copy data for that day and 'Paste Special' without formats into an odt file which uses Times New Roman 8 point.

The amount of data (columns & rows) is small so the HUGE font is not a big problem, it's just irritating.
It would be much nicer if the csv file used the TNR 8 point format.
Comment 4 Quazgar 2017-07-06 17:42:44 UTC
Relevant ask.lo.org questions, sometimes with workaround as proposed answer:
- https://ask.libreoffice.org/en/question/3256/
- https://ask.libreoffice.org/en/question/27342/
- https://ask.libreoffice.org/en/question/108336/
Comment 5 Tux 2017-07-11 07:28:50 UTC
This is still the case in 40m0

Though this is no major bug, it really slows down my work. (re)generating CSV files and checking them in LO (using the Reload functionality) will reset the font to something non-sensible on every reload.

Could we al least have an option to NOT change the font settings on reload please?
Comment 6 QA Administrators 2018-07-21 02:39:26 UTC Comment hidden (obsolete)
Comment 7 FS 2018-07-21 16:49:31 UTC
Still present in Version: (x64)
Build-ID: 54c8cbb85f300ac59db32fe8a675ff7683cd5a16
Comment 8 QA Administrators 2019-07-22 02:44:14 UTC Comment hidden (obsolete)
Comment 9 [REDACTED] 2019-11-20 22:28:31 UTC
Still present in

Build ID: a64200df03143b798afd1ec74a12ab50359878ed
CPU threads: 8; OS: Linux 4.12; UI render: default; VCL: kde5; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded
Comment 10 Mike Kaganski 2020-04-06 12:58:09 UTC
Using a custom template in this case is not correct.
Custom template is a complete document (with full set of options available to Calc, including formatting, sheets number and *content*), that copy is used when creating a new document. It is neither applicable to opening existing documents (of any kind), nor appropriate because possible template content (values pre-existing in cells, or more than a single sheet) and formatting would not save back to the CSV - so opening a CSV with all that fancy formatting would suggest users to customize the view, save, and expect it to be kept.

If one wants to have some fixed layout for a CSV, one should consider adding the CSV linked as a sheet into an ODS, being able then to apply any formatting available.

The question about applicability of "Font Settings for HTML, Basic and SQL Sources" mentioned in comment 3 is different from the one raised here; it might be reasonable, but needs own proposal.

Comment 11 Mike Kaganski 2020-08-25 09:40:50 UTC
Closing NOTABUG, just as tdf#131274 (see comment 10 here, and bug 131274 comment 3, for rationale). Ignoring custom template in this case is expected, normal, and not a bug (and should not be ever changed).

If needed, CSV import should get more own settings, and they need to stick, which is a different issue (tdf#74580 is partially about this).
Comment 12 Ayanna Munoz 2020-10-23 06:51:12 UTC Comment hidden (spam)
Comment 13 Ivan 2021-02-26 23:00:05 UTC
At present, it appears that template customization is the only way of setting default styles in openoffice.

This is important e.g., to add more than font customizations. For example, I need to increase padding by default. (That's how I ended up here; I don't need to customize fonts.)

Saving a file as ODS (even if the CSV is linked) creates a problem. Libreoffice does not adjust column and row sizes properly when padding is adjusted, and that translates into columns and rows being too small. When an ODS file with a CSV linked as a sheet is opened, the file is outdated until it is refreshed. Column heights and widths are correct until the file is refreshed. So, either way, you need to adjust visibility settings.

Methods that require opening libreoffice first are very inconvenient, because if you are e.g., processing many files in the file manager, you need to open libreoffice, find the file, and import it, as opposed to being able to just double click on it.

So, I'll go back to the original question: What would be the way to customize the default style then, such that it applies to all files open, including CSV files?
Comment 14 Ivan 2021-02-26 23:01:03 UTC
In my prior comment: %s/openoffice/libreoffice/g

Sorry. Old habits die hard.
Comment 15 Mike Kaganski 2021-02-27 04:59:48 UTC
(In reply to Ivan from comment #13)
> So, I'll go back to the original question: What would be the way to
> customize the default style then, such that it applies to all files open,
> including CSV files?

There will *never* be a way "that applies to all files open". Calc will always use the formatting information from file when exists. It is not going to change.

The *limited* customization of CSV look and feel would be possible, as per comment 11.