We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Treat Number as Text

Thread ID:





109998 Jul 15,2013 08:10 PM UTC Jul 19,2013 06:17 AM UTC WinForms 2
Tags: XlsIO
Chris Bishop
Asked On July 15, 2013 08:10 PM UTC


I am trying to change a number in a cell to be treated as text.

The usual trick was to add an apostrophe infront of the number.

Example Cell.Text = 5 changed to Cell.Text = '5

If I do this in excel it does not show the apostrophe but treats the 5 as text instead of a number.

In XlsIO I tried Cell.Value2 = "'" + Cell.Text; but that gave me two apostrophes.

Any help would be appreciated.

Chris Bishop
Replied On July 15, 2013 08:18 PM UTC

I got what I wanted.  Cell.Value2 = "'" + CellValue2.

But what I was trying to achieve still failed.  I wanted the little green arrow to go away and in other sheets I have it was accomplished by referencing the cell that has the '5.  The original cell is flagged but any referencing cells are not.

Basically, you can ignore this post.

Rajesh A [Syncfusion]
Replied On July 19, 2013 06:17 AM UTC

Hi Chris,

  Thank you for using the Syncfusion products.

We have analyzed your code snippet and we could suspect it’s a usage issue. We have updated the possible code snippets for “converting the Number to as text” and also we have attached the sample for your reference. Please make use of this and let us know if this helps you.

Code Snippet:

sheet.IsStringsPreserved = true;

sheet["A1"].Value2 = "9";


sheet["A1"].Value2 = "'9";

sheet["A1"].CellStyle.IsFirstSymbolApostrophe = false;

Sample link: Sample - Number As Text.zip

Please let us know if you have any clarification.





This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon