Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4586458
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:38:31+00:00 2026-05-21T21:38:31+00:00

Good evening! Which types of values can be directly stored into an Excel worksheet

  • 0

Good evening!

Which types of values can be directly stored into an Excel worksheet using Range.Value2 and how do I quickly check if a particular value can?

Suppose I have an array of objects, perhaps multityped (e.g. one int, one double and one Foo stored in an object[]).

If I shall choose a range of width 3 and try to store this array using Range.Value2, this will result in an exception (of course Excel doesn’t know what is a Foo).

I came up with an idea of checking each value in the array, and, if it’s not storable, convert it to its string representation using ToString(). But how do I check if it’s initially storable?

It would be horrible to end up doing something like that:

public bool storable<T>(T value)
{
     return value is int  ||
            value is uint ||
            value is short ||
            value is byte ||
            ...
            value is string;
}

…especially knowing that each is will cast the variable to the tested type and seriously affect performance.

On the other hand, I can’t afford pre-casting each value to the string type as I sometimes want to be able to do graphs and diagrams with numeric values, not strings.

Can you tell me I am mistaken or offer me any solution to the problem?
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:38:32+00:00Added an answer on May 21, 2026 at 9:38 pm

    I think you’re going to have to do what you’re unkeen to do (all the “is” checks), unless you can somehow make your input array a bit more strongly typed. Your best bet might be just to order the casts such that the most common ones get hit first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening! I want to display a uncommon layout into a HTML Textfield, using
Good evening!! I'm using HTML input type range to create a slidebar. I would
Good evening ! I am wondering if Excel provides a built-in function that can
Good evening, I would like to have a navigation bar which is centralised to
Good evening, I'm trying to make a single php page wich can edit/delete multiple
Good Evening, I'm building a website which will will look something like this: So
Good evening! I have a little problem accessing custom classes in symfony2.1.6 using the
Good evening everyone, I am using a JavaScript to load/override content from an HTML-File
Good Evening, I'm using Drupal 6, CCK Module, and the Link Field Type. All
Good evening. I am using Yii framework and mPDF library to generate some PDF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.