[Top][All Lists]

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

Re: Control of Excel cell formating when writing via the IO package

From: Philip Nienhuis
Subject: Re: Control of Excel cell formating when writing via the IO package
Date: Mon, 8 Sep 2014 09:39:30 -0700 (PDT)

ijourneaux wrote
> I was wondering if it was possible to control the cell formatting when
> writing to Excel using the IO package?
> I am writing out floats to cells in an Excel workbook. I would prefer to
> write the entire number and use formatting to only display to a certain
> number of digits. 
> Thanks

It *is* possible, but.....
For that you have to dive in the more esoteric features of ActiveX or the
various Java libraries used in the IO package.
It isn't implemented in the io package, as that sort of code would be unduly
complicated and unmaintainable. But once again: it is possible.

The Matlab news group on usenet ( has many posts about
this subject related to ActiveX.

In Octave, what I'd do in your situation:
Once you have written your data to spreadsheet, you can use the spreadsheet
file ptr to access the newly adapted worksheet (have a look in the private
routines to see how that works). Just do not amend the code in the
read/write functions in the io package; preferrably use a dedicated private
function or function in your own workspace (current dir or so).

The documentation on this subject is usually very good. The Java packages
have extensive javadocs about how to get it together. As to ActiveX, I'd use
the Visual Basic info in Excel itself - I think it was somewhere in some
menu of Alt-F2 - you'd get an extensive on-line help with all imaginable
commands etc.

The only interface I wouldn't use for that would be OCT - that interface
directly accesses the xml files in the OOXML or ODS or gnumeric archive.
While it's already a headache to keep track of just data, styles etc. are
kept in separate xml files in those zipped/gzipped archives and indirectly
refer to the data. There's very little info on exactly how styles in OOXML
work in low-level (xml-level).
The Java-based and ActiveX/COM interfaces hide these gory details and
provide a nice API to get to what you want.


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]