Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28384 Discussions

Using AUTOSetProperty to set column of values in Excel

mfinnis
New Contributor II
446 Views

A question for someone from Intel: Any chance of getting the known bug in using AUTOSetProperty to set a column of values in Excel fixed?

It's been raised at least twice in this forum in the past

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/274181

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/475051

and is still present in v2017 update 8.

The bug is that attempting to set a column of values using AUTOSetProperty with an array results in the first value of the array being written to each cell in the column range. Setting a row works ok as does reading a column of values using AUTOGetProperty.

0 Kudos
5 Replies
Steve_Lionel
Honored Contributor III
446 Views

I see one user say "known bug" but didn't say where the bug was (could be in Excel?) or who knew it. AutoSetProperty has no idea which application is being used or what the call does - it just calls into the COM method. Do you have evidence that this is a bug in AutoSetProperty itself? 

0 Kudos
mfinnis
New Contributor II
446 Views

Steve,

No, you're right. Perhaps I should have asked if there was any chance the issue could be looked it. It did occur to me after I posted that the bug might well be in Excel though Excel has been under constant development and it might be expected that the bug would have been spotted.

I posted after having spent some time trying to write a column of data to an Excel spreadsheet, scratching my head, checking the Intel documentation, checking the Excel Object Model, searching the web. Eventually I ended up at the forum where I found the links above. (I know, I should have come here first.). I didn't find any other reference to the problem other than in using AUTOSetProperty. If the issue can't be resolved maybe a note in the Intel documentation indicating that this is a 'known bug' might save someone wasting a couple of hours rediscovering it in the future.

0 Kudos
Steve_Lionel
Honored Contributor III
446 Views

I don't see Intel making a claim of a "known bug" if they don't actually have such a bug identified.  While I was at Intel, the only issues I heard of with AutoSetProperty are the ones described in https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/733247 

0 Kudos
mfinnis
New Contributor II
446 Views

Steve,

Again you are right. My original post resulted from having spent a frustrating afternoon going round in circles until finally chancing on the links above. I've had another look at the problem and it would appear that Excel is expecting a 2D array when setting the value property of a range object containing a column of cells. So the issue arises not from a bug after all but because AUTOSetProperty doesn't accept multi-dimensional arrays. (Is that a COM thing or an implementation thing? If the latter I'd amend my original question to Intel to: Any chance of modifying AUTOSetProperty to accept multi-dimensional arrays? If the former I'll withdraw the question.)

This may all be old news that I've missed but in case anyone comes across this post looking to write a column of values to an Excel worksheet it can be done though (as yet) not using AUTOSetProprty. A column (or 2D range) of values can be set by using the Range_SetValue subroutine generated by the Visual Fortran Module Wizard. A 2D safe array should contain the values to be set and a variant containing a pointer to the safe array is the 'value' passed to the Range_SetValue routine. (For anyone interested I've attached a  routine that implements it for a real array - it works ok for me on a Win32 platform.)

(Presumably something similar is going on under the hood of AUTOSetProperty. If so, I would have thought it a fairly minor modification to allow multi-dimensional arrays to be used.)

0 Kudos
Steve_Lionel
Honored Contributor III
445 Views

Probably an implementation thing, though I would have to study it. I suggest filing a feature request with Intel. You would have to worry about row-major vs. column-major.

0 Kudos
Reply