LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Manipulating the cell size in an Excel spreadsheet

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…..

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 1 of 7
(3,834 Views)

 

 

Can't you go back and change the width of the entire column?

0 Kudos
Message 2 of 7
(3,832 Views)

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.

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 3 of 7
(3,826 Views)

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

0 Kudos
Message 4 of 7
(3,819 Views)

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......

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 5 of 7
(3,817 Views)

@dacad wrote:
off work tomorrow,  Whoo Hoo

 

 

 


Smiley Happy

0 Kudos
Message 6 of 7
(3,805 Views)

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

Message 7 of 7
(3,788 Views)