Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner

Using AUTOSetProperty to set column of values in Excel

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
Highlighted
Black Belt

I see one user say "known bug

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? 

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner

Steve,

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
Highlighted
Black Belt

I don't see Intel making a

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 

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner

Steve,

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
Highlighted
Black Belt

Probably an implementation

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.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos