By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,052 Members | 1,303 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,052 IT Pros & Developers. It's quick & easy.

Return different types to Excel

P: n/a
Hi,

I'm developing an Excel Automation add-in in C#, but that's all I know
in terms of my environment. Basically, someone created a template for
me and I'm continuing in blissful ignorance. Everything works though.

Now I want to have a function that returns different types. So I have a
function like this:

public Object mytest(int i) {
if (i == 1)
return new DateTime(2006, 9, 29);
else if (i == 2)
return 8;
else if (i == 3)
return "Hello";
else
return null;
}
Two questions:

1. How can I make it, so that when the date is returned it is formatted
like a date? Can I "suggest" a format?
2. How can I return a value that will result in as empty-a-cell as
possible? Is there something better than returning ""?

Many thanks in advance!!!

Aaron Fude

Sep 29 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.