Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


December 11, 2006

Display CSV Files in an HTA

HTA provides a simple GUI interface for the Tabular Data Control
RSS
View this exclusive article with VIP access -- click here to join |
See More Task Automation Articles Here | Reprints | Or sign up for our VIP Monthly Pass!

Processing the CSV file's fields. After the HTA verifies that the file exists, it executes the getFields function. As Listing 2 shows, the getFields function populates the fields array (a global variable) with the field names from the CSV file. The function uses the FileSystemObject's Open-TextFile method to open the CSV file and read its first line, then closes the CSV file. Next, it empties the fields array by setting its length property to zero. The function uses the split method to return an array of substrings, using the comma (,) character as a delimiter. Be aware that the get-Fields function uses the split method to parse the first line of the CSV file, so the function will fail if a field name contains a comma (even if it's enclosed in quotes).

The getFields function then uses the for statement to iterate the array of substrings that the split method creates. If the useHeader function returns true (which will be the case if you've selected the check box), the function uses the replace method to remove any double-quote (") characters from the field name. Next, the function determines whether the field name contains the colon (:) character, indicating a field type. (I'll discuss field types in a moment.) If the field name contains a colon, the getFields function removes the colon and the remainder of the string so that only the field name is added to the fields array. For example, if the field is named Size:Int, the fields array will contain only Size (the :Int is not part of the field's name). . . .

Reader Comments
nice

KWhite December 19, 2006 (Article Rating: )


There is no code in the zip file other than a couple excerpts.

testme December 28, 2006 (Article Rating: )


The HTA script is missing from the zip file. The zip only includes the two functions.

OldDog January 02, 2007 (Article Rating: )


Nice but where is the rest of the code.

Moongate January 04, 2007 (Article Rating: )


very usefull for my csv data files

rwdavisjr January 24, 2007 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
CES 2009: Ballmer Announces Windows 7, Windows Live, Live Search Milestones

During his first-ever Consumer Electronics Show (CES) 2009 keynote address last night in Las Vegas, Microsoft CEO Steve Ballmer announced the pending public availability of a feature-complete Windows 7, the final version of Windows Live Essentials, and ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

10 Reasons to Deploy Windows Vista

The decision to upgrade your XP systems to Vista is simple when you consider features such as easier backup, a great desktop search, and vastly improved security options. ...


Related Articles Finding Stale Accounts in Active Directory

Task Automation Whitepapers Essential Guide to E-discovery and Recovery for Microsoft Exchange

Continuous Data Protection and Recovery for Microsoft Exchange

Protecting (You and) Your Data with Exchange Server 2007

Related Events Virtualization 101

Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing