Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Excel Cell Formatting Using ASP

Posted on 2003-03-04
Medium Priority
Last Modified: 2008-02-01
I need to retrieve data from a database and write such data to an excel file.
1 )
How can I set a cell's bottom border thicker in an excel file using ASP?

I know that in VB we can set it by using:

However, it can't work in ASP, "Runtime error occurs".

How can I set a cell in my custom format, e.g. "_(* #,##0_);_(* (#,##0);_(* ""??_);_(@_)", using ASP?

If the item price is 0, I want to set it to blank.
If the total price is 0, I want to set it to "-".

Anyone can help?

Question by:karina
LVL 15

Expert Comment

ID: 8069506

Im not sure if this is what youa re looking for... But anyway try to chekc it out might help...


Accepted Solution

lavinder earned 400 total points
ID: 8069725
Hi karina

1) I think "runtime error" is due to absence of typelibrary in your asp page, you are using excel constants, and their corresponding values are available in the typelib only. Therefore i suggest you place the following line at top of your asp page.
<!--METADATA NAME="Microsoft Excel 9.0 Object Library" TYPE="TypeLib" UUID="{00020813-0000-0000-C000-000000000046}"-->

2) For any cell if value is 0, and you want to display -, use this
 Selection.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"

happy programming!!

Author Comment

ID: 8069850
Thank you lavinder, I did it.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question