From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Easy Table changes column width

I am using Excel Easy Table to insert

an array into an excel report template I already have.  When I do this, the column width on the excel report changes.  How do I get the column width to not change?

0 Kudos
Message 1 of 6
(4,075 Views)

I usually use an add-on toolkit for writing to Excel. It's fairly easy to use and never causes such issues, but it's not free. You can find it here: http://www.aledyne.com/product/spreadsheet-express/

It has a 30-day trial period. I also want to add that I'm not affiliated with Aledyne Engineering in any way, I'm just their happy customer.

Certified LabVIEW Architect (CLA), LabVIEW 2015.
0 Kudos
Message 2 of 6
(4,059 Views)

Thank you for the recomendation!  Unfortunately, I doubt my employer will go for that (but I will try).

 

Alternatively, do you know another way to solve this?  I have setting my desired colulmn width in excel then using the "protect sheet" option in excel.

 

This prevents any Report Generation > Excel Specific functions from operating.

 

In addition, I have tried font manipulation which also seems to not drive the change in column width from LabVIEW.

 

Thanks

0 Kudos
Message 3 of 6
(4,030 Views)

There is another VI called Append Table to Report.vi. There is a column width setting where you can can elect to not have the column change widths if you are using a template. For an example of how this VI is used you open the Excel Report-Conditionally Formatted Spreadsheet.vi Example from the LabVIEW Help Menu.

 

Matt G.
Product Manager
National Instruments
Message 4 of 6
(4,023 Views)

@Gryffindor wrote:

There is another VI called Append Table to Report.vi. There is a column width setting where you can can elect to not have the column change widths if you are using a template. For an example of how this VI is used you open the Excel Report-Conditionally Formatted Spreadsheet.vi Example from the LabVIEW Help Menu.

 


Append Table to Report.vi is used in the Easy Table.vi. If the column width is not specified (using default value of 1) the default width will be used (12.86 units when I tried it).

 

The simple workaround is to select your template range, right-click it, go to the protection tab and uncheck "Locked".

Then right-click the sheet tab, select protect sheet and allow the user to do everything except "format columns". Save your template.

 

When you run the code Excel will now throw error 0x800A03EC. Use the General Error Handler.vi to cancel this error on match.

 

Ben64

Message 5 of 6
(4,016 Views)

@ben64 wrote:

@Gryffindor wrote:

There is another VI called Append Table to Report.vi. There is a column width setting where you can can elect to not have the column change widths if you are using a template. For an example of how this VI is used you open the Excel Report-Conditionally Formatted Spreadsheet.vi Example from the LabVIEW Help Menu.

 


Append Table to Report.vi is used in the Easy Table.vi. If the column width is not specified (using default value of 1) the default width will be used (12.86 units when I tried it).

 

 

Ben64


I looked at the help file for the Append Table To Report.vi (first thing I should have done) and it specifies that if you are using a template set the column width input to -1 to let it unchanged.
Ben64
Message 6 of 6
(3,994 Views)