help-octave
[Top][All Lists]
Advanced

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

Re: Create an XLSX using the COM interface


From: Philip Nienhuis
Subject: Re: Create an XLSX using the COM interface
Date: Thu, 30 Oct 2014 15:39:31 -0700 (PDT)

ijourneaux wrote
> Philip
> I have been trying to troubleshooting why I am seeing this error.
> 
> In __COM_spsh_close__.m
>  
>        if (xls.changed == 2)
>           ## Probably a newly created, or renamed, Excel file
>          printf ("1.Saving file %s ...\n", fname);
>           xls.workbook.SaveAs (fname);
> 
> The call to SaveAs generates an exception
> 
> I have confirmed that I have a valid file name
> (e:/MicroStick+DO_NOT_OPEN.xlsx) and that Excel can create an xlsx file of
> the same name in the  folder. It is not a permissions issue unless the
> permission affects Octave alone.

<Subject line corrected and adapted>

All I can say is that at that very moment Excel tries to create the file on
disk (until then all data are in memory only). It is clearly (for me) an
Excel problem.

In the io pkg's private dir there's a function __COM_spsh_open__.m.  Almost
at the top there's a statement with DisplayAlerts, that is meant to suppress
Excel's interactive messages. If you set the value to 1, I think Excel will
tell you what issues it encounters during the io packages operations.
More to the point here (I suppose), in private/__COM_spsh_close__.m, you
might try to copy the similar statement (at the bottom) that re-enables
Excel's messages, to the top of the function.
Be aware that Excel can hang as its messages can be hidden behind other
windows until you find them and click "OK" or "Cancel" or so.

How to get there:

>> cd (strrep (which ('xlsopen'), 'xlsopen.m', 'private'))
>> addpath (pwd)
>> edit __COM_spsh_open__.m
>> edit __COM_spsh_close__.m

and after editing these private functions, do:

>> clear -f; rehash

before trying xlswrite again.

FYI, the values for xls.changed can be 
3 (pristine newly created in RAM still empty file so no need to write to
disk), 
2 (new file with data ready to be created on disk), 
1 (existing file with new data) or 
0 (existing untouched file, just reading from, no need to write to disk).

Philip



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Create-an-XLSX-suing-the-OCT-interface-tp4667144p4667164.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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