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

  • SEARCH
  • Home
  • 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 6685463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:03:38+00:00 2026-05-26T05:03:38+00:00

When manipulating excel cells in C# (via an COM object), should I use the

  • 0

When manipulating excel cells in C# (via an COM object), should I use the .Value or .Value2 ?
that is

 sheet.Cells[row + n, col].Value = "Hello world"

or

 sheet.Cells[row + n, col].Value2 = "Hello world"

What is the difference between them to ?

Also, how do I set a cell format to "General" ?

sheet.Cells[row + n, col].NumberFormat = "XYZ";  // Not sure what should be here

Right now when I assign a cell with the number "0,34" and even if I do

sheet.Cells[row + n, col].NumberFormat = "@"; 

I get this "little error" sign up in the left corner in each cell

  • 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-26T05:03:38+00:00Added an answer on May 26, 2026 at 5:03 am

    To answer the first question you should read this article: http://blogs.msdn.com/b/eric_carter/archive/2004/09/06/225989.aspx

    The optional parameters part doesn’t apply anymore since C# 4.0 has optional parameters.

    But there IS a difference (stated in the article)

    The only difference between this property [Value2] and the Value
    property is that the Value2 property doesn’t use the Currency and Date
    data types. You can return values formatted with these data types as
    floating-point numbers by using the Double data type.

    For the second question, have you tried setting a cell to ‘General’ and reading it out in code?

    I think it’s sheet.Cells[row + n, col].NumberFormat = "General", where "@" is pure text.

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

Sidebar

Related Questions

I have an iframe that I use to display HTML pages published from Excel.
I'm manipulating the items in a list that's a System.Management.ManagementObjectCollection . Each of these
Do you know managed tools for manipulating PowerPoint files? The tool should be 100%
I know that accessing and manipulating the DOM can be very costly, so I
Manipulating the slider until the end, the circle that represents the star disappears or
All, I'm working on an application that allows authorized users to upload Excel spreadsheets
I have trouble comparing 2 double in Excel VBA suppose that I have the
i have an excel macro that i am converting to c#. currently i am
For manipulating a database I've created a class DBAdapter() that extends SQLiteHelper...this class has
Struggling with manipulating the underlying bytes of a Bitmap object to remove the transparency

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.