Writing to .xlsm files with COM-Interface

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Writing to .xlsm files with COM-Interface

TimotheusNemitz
Hello,
I would like to write to .xlsm files with xlswrite. The COM interface is
available.
https://wiki.octave.org/IO_package says, that the COM interface is the only
interface which might be able to write to xlsm-files, but not for every
EXCEL version.
I'm using Octave 5.1.0, IO Package 2.4.12 and Office 365.
However, writing to a xlsm-file with xlswrite results in a xlsx file and not
in a xlsm file.

Should writing to xlsm files be possible with my Office version? Is there a
list somewhere which EXCEL versions support writing to xlsm?

Regards
T. Nemitz



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Writing to .xlsm files with COM-Interface

PhilipNienhuis
TimotheusNemitz wrote

> Hello,
> I would like to write to .xlsm files with xlswrite. The COM interface is
> available.
> https://wiki.octave.org/IO_package says, that the COM interface is the
> only
> interface which might be able to write to xlsm-files, but not for every
> EXCEL version.
> I'm using Octave 5.1.0, IO Package 2.4.12 and Office 365.
> However, writing to a xlsm-file with xlswrite results in a xlsx file and
> not
> in a xlsm file.
>
> Should writing to xlsm files be possible with my Office version? Is there
> a
> list somewhere which EXCEL versions support writing to xlsm?

There needs to be some additional code in the io package to convince Excel
to write other file formats than just .xlsx. I hit this myself when trying
to write to .xls formats.
I'm busy with tackling that issue but it'll take some time. I hope it'll be
in io-2.4.13, to be released this fall and hopefully a bit earlier.

Philip



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Writing to .xlsm files with COM-Interface

PhilipNienhuis
PhilipNienhuis wrote

> TimotheusNemitz wrote
>> Hello,
>> I would like to write to .xlsm files with xlswrite. The COM interface is
>> available.
>> https://wiki.octave.org/IO_package says, that the COM interface is the
>> only
>> interface which might be able to write to xlsm-files, but not for every
>> EXCEL version.
>> I'm using Octave 5.1.0, IO Package 2.4.12 and Office 365.
>> However, writing to a xlsm-file with xlswrite results in a xlsx file and
>> not
>> in a xlsm file.
>>
>> Should writing to xlsm files be possible with my Office version? Is there
>> a
>> list somewhere which EXCEL versions support writing to xlsm?
>
> There needs to be some additional code in the io package to convince Excel
> to write other file formats than just .xlsx. I hit this myself when trying
> to write to .xls formats.
> I'm busy with tackling that issue but it'll take some time. I hope it'll
> be
> in io-2.4.13, to be released this fall and hopefully a bit earlier.

I've pushed a few fixes for the io package [*], AFAICS writing to .xlsm
should be possible now. At least that works now on my Win7 box.

Philip

[*] http://hg.code.sf.net/p/octave/io/rev/695263c67597




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Writing to .xlsm files with COM-Interface

TimotheusNemitz
PhilipNienhuis wrote
> I've pushed a few fixes for the io package [*], AFAICS writing to .xlsm
> should be possible now. At least that works now on my Win7 box.

That sounds very promising!
Unfortunately I don't have the knowledge to create a installable tar.gz
package from the current snapshot of the repo and I'm on a machine without
admin privileges, so I can't install any build tools.
I'll test on a Win10/Office 365 machine and report back as soon as a new
release or a installable version of the current snapshot is available.

Timo





--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Writing to .xlsm files with COM-Interface

PhilipNienhuis
TimotheusNemitz wrote

> PhilipNienhuis wrote
>> I've pushed a few fixes for the io package [*], AFAICS writing to .xlsm
>> should be possible now. At least that works now on my Win7 box.
>
> That sounds very promising!
> Unfortunately I don't have the knowledge to create a installable tar.gz
> package from the current snapshot of the repo and I'm on a machine without
> admin privileges, so I can't install any build tools.
> I'll test on a Win10/Office 365 machine and report back as soon as a new
> release or a installable version of the current snapshot is available.

You're right, waiting until io-2.4.13 may be a bit of a stretch.
Just download the following files:

http://hg.code.sf.net/p/octave/io/file/aa01182c05ed/inst/xlsopen.m
http://hg.code.sf.net/p/octave/io/file/aa01182c05ed/inst/private/__COM_spsh_close__.m

(maybe click "raw" in the column at the left side) and swap them for the
files in the io package subdirectory. Where that is? Type:

cd (strrep (which ("xlsopen"), "xlsopen.m", ""))

... and you'll land in the relevant subdir. Replace xlsopen.m there. Then,
goto subdir 'private' and swap the other file.
Please report back if it (swapping files and writing to .xlsm) works for
you.

FYI, I've added xlFileFormats for several common file types, but on my Win7
box with Office 2013, Octave could only write all the .xls* types (incl.
.xls /BIFF8), .htm, .html, .csv (but with ";" field separators), .txt and
.prn.
Knowing Excel and its reputation a bit I think the ability to write to other
file types largely depends on the Office version at hand.
When trying to write other file types I got an error and a stray (hidden /
zombie) Excel invocation was left running;  you're warned. Somewhere I need
to add code to catch those errors, that will happen before releasing
io-2.4.13.  Plus, similar mods (for writing to other file types) are needed
for LibreOffice (invoked by a Java/UNO bridge rather than COM/ActiveX).

HTH,
Philip



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Writing to .xlsm files with COM-Interface

TimotheusNemitz
PhilipNienhuis wrote

> FYI, I've added xlFileFormats for several common file types, but on my
> Win7
> box with Office 2013, Octave could only write all the .xls* types (incl.
> .xls /BIFF8), .htm, .html, .csv (but with ";" field separators), .txt and
> .prn.
> Knowing Excel and its reputation a bit I think the ability to write to
> other
> file types largely depends on the Office version at hand.
> When trying to write other file types I got an error and a stray (hidden /
> zombie) Excel invocation was left running;  you're warned. Somewhere I
> need
> to add code to catch those errors, that will happen before releasing
> io-2.4.13.

Thanks, I can confirm writing to .xlsm files works now with the
COM-Interface on W10/O365.
If you want me to test other file types with the COM-Interface of O365, just
give me a list of file types or provide example files I should test.
Timo




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: Writing to .xlsm files with COM-Interface

PhilipNienhuis
TimotheusNemitz wrote

> PhilipNienhuis wrote
>> FYI, I've added xlFileFormats for several common file types, but on my
>> Win7
>> box with Office 2013, Octave could only write all the .xls* types (incl.
>> .xls /BIFF8), .htm, .html, .csv (but with ";" field separators), .txt and
>> .prn.
>> Knowing Excel and its reputation a bit I think the ability to write to
>> other
>> file types largely depends on the Office version at hand.
>> When trying to write other file types I got an error and a stray (hidden
>> /
>> zombie) Excel invocation was left running;  you're warned. Somewhere I
>> need
>> to add code to catch those errors, that will happen before releasing
>> io-2.4.13.
>
> Thanks, I can confirm writing to .xlsm files works now with the
> COM-Interface on W10/O365.
> If you want me to test other file types with the COM-Interface of O365,
> just
> give me a list of file types or provide example files I should test.

Good, thank you for reporting back.

I've pushed more fixes; with COM interface .dif, .xml and .pdf now also
work, at least with Office 2010 at work. In addition I pushed a few fixes
for UNO (LibreOffice) to better support extraneous formats like .fods, .uos,
.slk and also .dbf.
If you want you can try those, goto
http://hg.code.sf.net/p/octave/io/file/9750a5d3162c/inst and get xlsclose.m,
xlsopen.m, odsopen.m, odsclose.m, and __COM_spsh_close__.m and
__UNO_spsh_close__.m from private/

I think an io-2.4.13 release isn't that far away now.

Philip



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html