06-12-2014 10:40 AM
Problem 1 of 2 (2 is in the same project but a different function so will place in separate post)
Using LV 2013 on Windows 7 with Excel 2010
I have a routine where I insert assorted data into an Excel spreadsheet based on a pre-formatted Excel template. Problem is, when one group of data is placed in the range of cells (ends up being a column because of the way the data array is formatted) that particular column width is reduced.
Because once of the cells automatically formats as the Excel Date / Time format (as desired) the narrower width of the cell makes the value unreadable. (Just like when a real numerical value is longer than the cell is wide, all you see is hash marks)
I verified my column width in the template is where it should be, it definitely is reduced when the data is entered. I also tried using the “Excel Set Cell Dimension.vi” to change the cell width back to what I need but it does not work. Not sure why. When I tried placing the function at the beginning of the routine, I think it created an error and the rest of the report/excel functions failed to work. I didn’t monitor the error wire to confirm this.
My next approach will be to write a macro in the template file and call this at the end to fix the cell width but this seems like the long way around.
Any thoughts on the best way to fix this? Or why the “Excel Set Cell Dimension” function does not work?
Thanks…..
06-12-2014 10:42 AM
Can't you go back and change the width of the entire column?
06-12-2014 10:52 AM
That is basically what I tried to do. By placing a "-1" in the row input to the vi, it indicates to select all rows.
06-12-2014 11:15 AM
It sounds like you are using the Report Generation Toolkit which I do not use.
Have you looked inside that VI and look what it is doing?
http://msdn.microsoft.com/en-us/library/office/ff837430%28v=office.14%29.aspx
06-12-2014 11:19 AM
Am using report toolkit. Have not looked inside the vi(s) but will do so to see if I can pull out some functions that I can manipuate to work my issue.
Will report back when I figure something out. Probably next monday, off work tomorrow, Whoo Hoo
Thanks......
06-12-2014 12:23 PM
@dacad wrote:
off work tomorrow, Whoo Hoo
06-12-2014 03:24 PM
This is what I observed:
The Set Cell Dimension.vi is using the occupied range as a reference, if you wire (-1,0) to the start input it will format the first column of the occupied range meaning that if you only have data in column C it will format this column. If you wire (-1,3) like anybody would believe is the right thing to do it will format column F, an offset of 3 from column C.
Hope this help.
Ben64