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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: 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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

771 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