[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: |
Tue, 15 Jul 2014 23:17:13 -0700 (PDT) |
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?
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.
Note that writing .ods files with the OCT interface doesn't seem to work in
io-2.2.2 (I'm working at that).
>> 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 = OpenOffice.org Calc Document
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).
Philip
--
View this message in context:
http://octave.1599824.n4.nabble.com/odswrite-Determining-sheet-range-tp4665541p4665550.html
Sent from the Octave - General mailing list archive at Nabble.com.