bugGNU Octave - Bugs: bug #56444, [octave forge] (io) oct2xls &...

 
 

bug #56444: [octave forge] (io) oct2xls & oct2ods misinterpret single cell range input

Submitted by:  Nicholas Jankowski <nrjank>
Submitted on:  Wed 05 Jun 2019 06:28:08 PM UTC  
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  Philip Nienhuis <philipnienhuis>
Originator Name:  Nicholas Jankowski Open/Closed:  Closed
Release:  other Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 08 Jun 2019 09:37:36 PM UTC, comment #2: 
Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Wed 05 Jun 2019 07:40:30 PM UTC, comment #1: 

A proper fix for this requires a fairly significant reshuffling of code from some functions to others. Over the years quite a bit of duplicate and unneededly distributed code crept into the io spreadsheet functions, esp. for the range and Named range parts.

Lately (= last years) I've been busy collapsing the separate xls... and ods.... functions into one set and morph the ods.... functions into mere wrappers (to deduplicate a lot of code and cut down on maintenance). Moving & simplifying the range validation, -check & -interpretation code would fit in nicely.

For now I'll add a temporary fix.

Philip Nienhuis <philipnienhuis>
Project MemberIn charge of this item.
Wed 05 Jun 2019 06:28:08 PM UTC, original submission:  

as per a discussion on the help list [1] when oct2xls is given a single cell range, it only puts data in that single cell instead of using it as the anchor location of the full data array.  This appears to be insensitive to the xls interface method.

>> pkg load io
>> chk_spreadsheet_support ()
ans = 0
>> A = int32(100*rand(5))
A =
   2  70  45  45  14
  99  79  68   5  30
  45  85   8  72  33
  99  90  47  30  10
  19  19  75  92  63
>> XLS = xlsopen('o2xtest.xlsx',1)
XLS =
  scalar structure containing the fields:
    xtype = OCT
    app = xlsx
    filename = o2xtest2.xlsx
    workbook = c:\Programs\Octave\Temp\oct-ZATASh
    changed =  3
    limits = [](0x0)
    sheets =
      scalar structure containing the fields:
        sh_names =
        {
          [1,1] = Sheet1
        }
        rid =  1
        sheetid =  1
        shId =  1
        type =  1

>> [XLS,status] = oct2xls(A,XLS, 'Sheet1', 'A1')
XLS =
  scalar structure containing the fields:
    xtype = OCT
    app = xlsx
    filename = o2xtest.xlsx
    workbook = c:\Programs\Octave\Temp\oct-ZATASh
    changed =  2
    limits = [](0x0)
    sheets =
      scalar structure containing the fields:
        sh_names =
        {
          [1,1] = Sheet1
        }
        rid =
           1   2
        sheetid =  1
        shId =  1
        type =  1

>> XLS = xlsclose(XLS)

The output file o2xtest.xlsx only has the A(1,1) value written in cell A1.  looking in the workbook temp location mentioned in the struct, the workbook.xml file only contains information for that single cell.

According to the help for oct2xls:  "If RANGE is omitted or just the top left cell of the range is specified, the actual range to be used is determined by the size of ARR.  If nothing is specified for RANGE the top left cell is assumed to be 'A1'.
...
If RANGE contains merged cells, only the elements of ARR corresponding to the top or left Excel cells of those merged cells will be written, other array cells corresponding to that cell will be ignored."

repeating the above script with the windows pkg loaded (such that chk_spreadsheet_support = 1) produces the same output. also, xlswrite produces the correct, full array when called with a single range value.

[1] http://octave.1599824.n4.nabble.com/Problem-with-oct2xls-range-tp4692945.html

Nicholas Jankowski <nrjank>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-08 philipnienhuis StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
        Release5.1.0 => other
        Summary[octave forge] (io) oct2xls misinterprets single cell range input => [octave forge] (io) oct2xls & oct2ods misinterpret single cell range input
    2019-06-05 philipnienhuis StatusNone => Confirmed
        Assigned toNone => philipnienhuis
    2019-06-05 nrjank Carbon-Copy- => Added pr.nienhuis@hccnet.nl
        Carbon-Copy- => Added ths2358@otenet.gr

    Back to the top


    Powered by Savane 3.5