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.
Unfortunately, activation email could not send to your email. Please try again.

IWorksheet Range - Select All Cells > Right-click > Format Cells > Text

Thread ID:

Created:

Updated:

Platform:

Replies:

105098 Sep 7,2012 09:53 AM Sep 10,2012 02:29 AM ASP.NET MVC (Classic) 2
loading
Tags: XlsIO
Adam Woodcock
Asked On September 7, 2012 09:53 AM

We have a legacy pivot table report that requires all cells to be formatted as text.  I'm trying to make sense of the following documentation but having trouble -

http://help.syncfusion.com/UG/Reporting/XlsIO/ASP.NET%20MVC/default.htm#!documents/numberformatting.htm

Basically, the manual steps in Excel would be

  1. Select All Cells
  2. Right-click > Format Cells
  3. Select "Text" format

Thanks for your assistance.




Adam Woodcock
Replied On September 7, 2012 11:13 AM

Once I had my IWorksheet defined.  Applying myWorkSheetName.Range.NumberFormat = "@" is what I was looking for.  

Now when I right-click in Excel > Format Cells, its applying the desired formatting.

Rajesh A [Syncfusion]
Replied On September 10, 2012 02:29 AM

Hi Adam,

Thank you for using the Syncfusion Products.

To apply the desired numberformat to all cells then, we need to mention the range. Please refer to the below code snippet which illustrates this. Also we have attached sample for you reference. Could you please try this and let us know if this helps you.

Case 1. //If we use the below code, blank cells has no effect.

      sheet.Range.NumberFormat = "@";

Case 2.  //Setting Number Format as Text.

      //WE need to mention the specified Range.         

      sheet.Range["A1:XF1000"].NumberFormat = "@";

Please find the sample for "formatting cells" from the below link and let us know if this helps you.

Sample link: Sample

Please let us know if you need any clarification.

Thanks and Regards,

Rajesh A.


CONFIRMATION

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.

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.

;