LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save and excel file in html format

I have the _Workbook  SaveAs property node for the excel activex in labview and want to save the workbook or worksheet in html format. Both for the workbook and worksheet a "FileFormat" property exists, however, I don't know how to enter html in it. Would anyone have a working example or know how I can do this? Thanks.
0 Kudos
Message 1 of 6
(3,862 Views)
From the online help:

FileFormat    Optional Variant. The file format to use when you save the file. For a list of valid choices, see the FileFormat property. For an existing file, the default format is the last file format specified; for a new file, the default is the format of the version of Excel being used.

The valid choices are here



Message Edited by smercurio_fc on 03-14-2008 03:33 PM
0 Kudos
Message 2 of 6
(3,859 Views)
I tried using xlHtml which appears in the help documentation, but it just errors out. I'm not sure how to or which choice to choose from the link you provided. I want to simply save the file as an html the same way I would do it manually. Do I use the _Workbook or _Worksheet Method?
0 Kudos
Message 3 of 6
(3,852 Views)
You should do it on the Workbook object, though I don't see why it wouldn't work on the Worksheet as well. I opened the Write Table to XL example that ships with LabVIEW and plopped down a Save As Invoke node before the Close Invoke node, and wired 44 to the FileFormat input and fed in a path and it worked.
0 Kudos
Message 4 of 6
(3,848 Views)
How did you know how to use 44? Is 44 always going to be html or will that change. I just don't understand where 44 came from. My concern is that this might change in the future.
0 Kudos
Message 5 of 6
(3,845 Views)
The FileFormat is just an integer, and the Excel automation interface defines the enumeration xlFileFormat just for this (this is stated in the documentation for the SaveAs method). If you go to the link I provided in my earlier response you will see a whole list of constants. If you scroll down and click the plus symbol next to xlFileFormat you will see the values for each of the available file formats. You will see xlHtml, with a value of 44. Again, this is all in the documentation for Excel.

Can it change in the future? Well, Microsoft defines this, so, yeah, it can change. Smiley Wink However, it's unlikely to change.


Message Edited by smercurio_fc on 03-14-2008 04:16 PM
0 Kudos
Message 6 of 6
(3,842 Views)