[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: odswrite: Determining sheet range?

From: PhilipNienhuis
Subject: Re: odswrite: Determining sheet range?
Date: Wed, 16 Jul 2014 13:54:13 -0700 (PDT)

Peter P. wrote
> * PhilipNienhuis <

> pr.nienhuis@

> > [2014-07-16 02:17]:
>> Peter P. wrote
>> > Hi, I am trying to write a cell array back to an .ods file. The ods
>> > function requires me to pass a range parameter like "A1:M12" as
>> > argument. An empty range is not possible. I wonder how this range can
>> > be automatically determined from the array dimensions, which in my
>> > case is variable. I would like to build a workaround dealing with all
>> > letters in the alphabeth trying to find a translation.
>> I'm not sure what you exactly want.
>> Which ods function?
> Sorry, I had only stated that in the subject of my email. It is
> odswrite.
>> You can add an empty string (two consecutive quotes or double quotes) to
>> odswrite.m / oct2ods.m:
> <file_ptr_struct>
>  = oct2ods (
> <array>
> , 
> <file_ptr_struct>
> , 
> <sheetname>
> , '')
>> or
>> odswrite (
> <filename>
> , 
> <array>
> , 
> <sheetname>
> , '', 
> <intf>
> )
>> implying these functions will take cell A1 as top left array cell and
>> find
>> the range to write from the actual array dimensions.
>> That is: it should work like that. If not, please file a bug report.
> Thank you, I tried this again with an empty string "" and ''
> and although the spreadsheet (number 3 in my case, 1 and 2 exist
> already ) gets created, it is empty. 
> Will file a bug report on that.
> j
>> Note that writing .ods files with the OCT interface doesn't seem to work
>> in
>> io-2.2.2 (I'm working at that).
> Ah, good to know! I am on 2.2.2-1 here, and I am having quite good
> results using OCT, besides the "zip" bug I just reported. Thank you
> for your valuable work on this! It is greatly appreciated.
>> >> odswrite ('test_1.ods', {"a", "b"; 1, 2; 3, 4}, "WS1", "", "otk")
>> Creating file test_1.ods
>> ans =  1>> odsfinfo ("test_1.ods")
>>   1: WS1                              (Used range ~ A1:B3)
>> ans = Calc Document
> So it seems to be OTK specific. What do I have to install in order to
> be able to use the otk interface btw? The octave-java package?

No the octave-java package won't work in Octave 3.8.0 and higher.
Try (in Octave)

octave_config_info ("features").JAVA

If the result is 1 you're OK; if 0 you're out of luck.

If 1,  the easiest (and fastest) is the JOD (jOpenDocument) interface. You
can find the .jar file here:

(try version 13)
Add the .jar file to the javaclasspath using:

javaaddpath ('/full path/to/jopendocument.jar')

Spreadsheet I/O to/from .ods should work OOTB then.

>> If you want to do manually sort out ranges, there's a function
>> calccelladdress.m in the io package (which in fact is invoked by many
>> spreadsheet I/O functions there).
> Niiice! Thank you for pointing this one out, which will serve as a
> workaround for now!

There are two html files in the io package directory in subdir doc/ with
more extensive instructions. I never had time to convert those to texinfo,
so you'll have to make do with a browser
You can find the path to those files using (in Octave)

strrep (which ("odswrite"), "odswrite.m", "doc")


View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

[Prev in Thread] Current Thread [Next in Thread]