Bug 130020 - No warning displayed even if error/warning code was set when spreadsheet data fails to save to dBASE format
Summary: No warning displayed even if error/warning code was set when spreadsheet data...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.0.0 target:6.4.1
Keywords:
: 130019 (view as bug list)
Depends on:
Blocks: Save
  Show dependency treegraph
 
Reported: 2020-01-15 17:16 UTC by Athos
Modified: 2023-08-25 10:55 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshots (215.04 KB, image/png)
2020-01-15 17:20 UTC, Athos
Details
sample ODS file to test with (9.16 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-08-25 10:55 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Athos 2020-01-15 17:16:36 UTC
Description:
CALC spreadsheet failed to save to dBASE format.
If the second row of a given column contains only numbers, it is incorrectly saved.
In this case, you treat the column as a number type and place a zero in the character type cell.
Screenshots link: prnt.sc  qo5h99
https://prnt.sc/qo5h99

Steps to Reproduce:
1. FILE / Save as / dBASE (*.dbf) type ( valami.dbf )
2. Just Use dBASE formatum
3. Export dBASE format: (DOS/OS2-852)
4. Click OK.
5. Close file
6. Open last document  ( valami.dbf )


Actual Results:
Zero digits appear in the character cell

Expected Results:
You should have saved the original content.


Reproducible: Always


User Profile Reset: No



Additional Info:
This error is present in all versions.
Comment 1 Athos 2020-01-15 17:20:00 UTC
Created attachment 157164 [details]
screenshots
Comment 2 Eike Rathke 2020-01-15 17:53:07 UTC
*** Bug 130019 has been marked as a duplicate of this bug. ***
Comment 3 Eike Rathke 2020-01-15 18:12:26 UTC
You can't have columns of mixed types in dBase. If the first data row's cell has numeric content then numeric/Decimal type is assumed, similar for boolean/Logical and Date. However, you can force a field to type Text/Character by appending ",C" (without quotes) to the field name, so in your case that would be "CODE1,C". Then numeric cell content is converted to text for export.

All columns' data could be scanned whether they contain mixed types and then switch to Character type, but.. that's rather a data layout error.
Comment 4 Eike Rathke 2020-01-15 18:40:14 UTC
ScDocShell::DBaseExport() for this case even sets SCWARN_EXPORT_DATALOST error code, but for some yet unknown reason a message is not displayed or the error not propagated later.
Comment 5 Eike Rathke 2020-01-16 14:34:01 UTC
At least since 5.3 (don't have earlier versions at hand).
Comment 6 Athos 2020-01-16 15:15:10 UTC
(In reply to Eike Rathke from comment #3)
> You can't have columns of mixed types in dBase. If the first data row's cell
> has numeric content then numeric/Decimal type is assumed, similar for
> boolean/Logical and Date. However, you can force a field to type
> Text/Character by appending ",C" (without quotes) to the field name, so in
> your case that would be "CODE1,C". Then numeric cell content is converted to
> text for export.
> 
> All columns' data could be scanned whether they contain mixed types and then
> switch to Character type, but.. that's rather a data layout error.

The ",C" post-field-name addition is not a bad idea, but doing hundreds or 1000 columns is a big job.
It would be better if you took the dBASE data field type from the table column type.
Comment 7 Eike Rathke 2020-01-20 15:02:56 UTC
There is no such thing as a "table column type" in a spreadsheet.
Comment 8 Commit Notification 2020-01-20 23:25:41 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6a308d2bfaf1d756aa4cfca6a40b80cf5e88e5fa

Propagate warning error code from dBASE export, tdf#130020

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2020-02-04 06:27:22 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/02ca7b1c92a801004a42c92c59f4bbfc70ec19eb

Propagate warning error code from dBASE export, tdf#130020

It will be available in 6.4.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 QA Administrators 2022-02-04 03:41:37 UTC Comment hidden (obsolete)
Comment 11 BogdanB 2023-08-19 04:41:20 UTC
Eike, I have seen your commits here, is this bug solved? Or still things to do?
Comment 12 Eike Rathke 2023-08-24 19:06:45 UTC
I don't remember.. but assume it's resolved.
Comment 13 Stéphane Guillou (stragu) 2023-08-25 10:54:16 UTC
Testing with:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 91358f11ee7e87c8c8290b9507f64d8f90aac3ea
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

I can see the warning when a mixed column with numbers and characters will be converted to a numeric-only column (replacing strings by 0).

No warning back in 5.4. Was the same in OOo 3.3, so marking as inherited.

Marking as fixed by Eike. Thanks!
Comment 14 Stéphane Guillou (stragu) 2023-08-25 10:55:29 UTC
Created attachment 189143 [details]
sample ODS file to test with

See effect of saving as dbase on first column.