Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Text Import 1

Status
Not open for further replies.

zzfive03

Programmer
Jun 11, 2001
267
Hello, I have a scirpt that takes data out of a data base and saves it to a text file with tab delimits (for excel). Is there a way I can add features to the data elements to make they appear colored or bold in excel??

Any examples would be great.
Mark
 
Hey Mark,

I'm new here but I'm going to give this a try.

As far as I know, there's no way to format a tab delimited file. One method I have used for exporting formatted data is to create an asp page which presents the results you want formatted how you would like to view it (shaded cells in an html table, bold type, etc.). In my case, I used a form to select the month's records I wanted to download.

Once you are satisfied with the way the results are displayed, add the following piece of code at the top of your page:

Code:
<% Server.ScriptTimeout = 600 
Response.Contenttype=&quot;application/vnd.ms-excel&quot;
Response.AddHeader &quot;content-disposition&quot;,&quot;attachment;filename=Your_Filename.xls&quot;
%>

Change the filename to your suit your needs. When the page is executed, the file is created and your download starts. Don't use stylesheets in the asp page or you will receive an error upon opening the Excel file.

Hope that helps.

JP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top