bugGNU Octave - Bugs: bug #50200, ods2oct() truncates cell text at...

 
 

bug #50200: ods2oct() truncates cell text at first linefeed within the cell

Submitter:  ralf <rapete>
Submitted:  Wed 01 Feb 2017 01:15:22 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  rapete Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 03 Feb 2017 11:00:56 PM UTC, comment #7: 

Just posted a similar bug #50224 with csv2cell().

ralf <rapete>
Fri 03 Feb 2017 08:05:28 PM UTC, comment #6: 

To be sure I checked the other interfaces for multi-line text cell I/O.

For .xls / .xlsx, POI and JXL can't write multi-line text cells (reading = OK). For Apache POI I'll enter a bug report upstream; JXL isn't very actively maintained anymore AFAICS.

As to .ods, OTK can neither read nor write multi-line text cells.

I fixed the other interfaces as far as needed (minor stuff) and along the way fixed a few other bugs that had escaped attention til now.

So you see, what good stuff a bug report can bring along :-)

Philip Nienhuis <philipnienhuis>
Group Member
Wed 01 Feb 2017 09:51:13 PM UTC, comment #5: 

Thank you for reporting back.

I've pushed he fix here:
http://hg.code.sf.net/p/octave/io/rev/996fd6cba367

It'll be part of I think io-2.6.0, a major io pkg overhaul in which the ods*.m functions are turned into wrappers for the xls*.m functions in order to:
- cut down on maintenance of lots of duplicate code
- ease inclusion of the spreadsheet & ML I/O into core Octave at some point.

As far as this bug concerns, for the time being one has to make do with the patched file attached to this bug report.

Closing report.


Philip Nienhuis <philipnienhuis>
Group Member
Wed 01 Feb 2017 09:15:58 PM UTC, comment #4: 

Tried the attached OCT_ods2oct_.m on two different ods-files.

All cells with linefeeds were read in correctly.

So the fix worked.

Thanks!

ralf <rapete>
Wed 01 Feb 2017 08:52:05 PM UTC, comment #3: 

AFAICS this only happens with .ods files (for the OCT interface).

Please try attached _OCT_ods2oct_.m:

- Swap it into place in the location you get by copying the following command in the Octave terminal and then typing "pwd" (w/o dbl quotes of course):

cd (strrep (which ("ods2oct"), "ods2oct.m", "private"))

- try reding your file(s) again,
- and report back, please.

FTR, I now get:

>> [~, ~, raw] = odsread ('c:/tmp/abc.ods', 1, '', 'OCT')
Checking requested interface(s):
OCT*; (* = default interface)
raw =
{
  [1,1] = a
b
c
}
>>



(file #39643)

Philip Nienhuis <philipnienhuis>
Group Member
Wed 01 Feb 2017 06:57:13 PM UTC, comment #2: 

Thanks for the reply.

Tried xls2oct().

Like ods2oct(), it does truncate text cells at first linefeed inside the cells.

ralf <rapete>
Wed 01 Feb 2017 06:20:11 PM UTC, comment #1: 

Thanks for the bug report. I'll have a look.

This might also be the case for other spreadsheet file formats.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 01 Feb 2017 01:15:22 AM UTC, original submission:  

If there is one or more linefeeds within spreadsheet cells, then ods2oct() in package io-2.4.5 returns the content of these cells incompletely, i.e. truncated at the first linefeed.


fid=odsopen('abc.ods',0,'OCT');
T=ods2oct(fid,1);
fid=odsclose(fid);


The above code will yield T = { 'a' }, when in fact 'abs.ods' contains one cell with content "a\nb\nc". See attached abs.ods.

Operating System is Ubuntu 16.04. Octave version is 4.0.0.

ralf <rapete>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #39643:  __OCT_ods2oct__.m added by philipnienhuis (11KiB - text/x-objcsrc)
file #39636:  abc.ods added by rapete (7KiB - application/vnd.oasis.opendocument.spreadsheet - simple file that ods2oct() fails to read properly)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rapete (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-01 philipnienhuis StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2017-02-01 philipnienhuis Attached File- Added _OCT_ods2oct_.m, #39643
        CategoryOctave Package Octave Function
        StatusNone Ready For Test
        Assigned toNone philipnienhuis
        Release4.0.0 other
        Operating SystemGNU/Linux Any
    2017-02-01 rapete Attached File- Added abc.ods, #39636

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code