LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I Write Data to a *.xlxsx File Without Screwing Up the Excel File Formatting?

Solved!
Go to solution

I'd like to programatically add LabVIEW-generated data to a nicely-formatted *.xlsx file, one with all the right borders and column widths, etc.  But every time I try to add the LabVIEW data, the xlsx file formatting gets all screwed up and the file gets corrupted.  Is there a way around this?


Thanks!

 

- FB

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 1 of 7
(2,989 Views)

How are you modifying it? Are you using the XML parser? However you are doing it you have to make sure you are paying close attention to the spec in the MSDN. I have never used it but the report generation toolkit might help a lot.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 7
(2,987 Views)
Solution
Accepted by topic author diarmaede

It will probably be easier to use ActiveX to control Excel and modify the file that way if you have that option, instead of writing the XML directly.

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

Absolutely! But even that is a pain. I don't know for sure but I would imagine that the report generation toolkit uses ActiveX under the hood.

=====================
LabVIEW 2012


0 Kudos
Message 4 of 7
(2,975 Views)

@Steve Chandler wrote:

Absolutely! But even that is a pain. I don't know for sure but I would imagine that the report generation toolkit uses ActiveX under the hood.


Yes, the Report Generation Toolkit uses ActiveX automation to build Excel and Word reports.

0 Kudos
Message 5 of 7
(2,967 Views)

FB,

 

I was able to find the following link on the NI website.  I think it addresses the issue you are describing using the Excel ActiveX interface.

 

AutoFit Columns and Rows in Excel Using LabVIEW: http://digital.ni.com/public.nsf/allkb/8697100BBFA68902862571D4006D893B?OpenDocument

 

 

Regards,

Isaac S.

Regards,
Isaac S.
Applications Engineer
National Instruments
0 Kudos
Message 6 of 7
(2,946 Views)

I'm slogging my way up the ActiveX learning curve.  It's challenging, but fun.

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 7 of 7
(2,931 Views)