Format Excel column as text [duplicate] - c#

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
C# extract formatted text from Excel through OLEDB
Can i somehow format an excel column and it's data as text, before fetching the data from it ?
I'm using C# and .NET Framework 4.0

You can prefix the number by ' for example '100 will be shown as text.

Option 1
You can can try myCell.Style.NumberFormat = "#"
Here is an example online that should help give you an idea on how to use it:
Example
Option 2
Alternatively you could try grabing myCell.Text instead of myCell.Value. Value is what is actually stored in the cell, whereas Text is what is displayed.

Related

How can I update table data? [duplicate]

This question already has answers here:
string.Replace (or other string modification) not working
(4 answers)
Closed 1 year ago.
how I update this data(In Image) for visualization
-------- "31-Jan" to "31 :: Jan"
Pls, guide me.
My Data
You can not change that format at database. Your expected format you can use for visualization purpose. From the databases level it save as what format you used in DDL(data definition language).

c# send output to tab delimited file from a list [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
.NET & Tab-Delimited files
I have a list that has 2 columns: FirstName, LastName.
I am not sure how to send it to a tab delimited file showing the headers.
I know I need to look through the list but not sure how to produce the tab delimited file.
My path to the file output is: C:\emailfile.txt
Take a look at FileHelpers - you can use this library to create you tab delimited file.

Best way to print a datagridview with all rows and all columns? [duplicate]

This question already has answers here:
Printing a .NET DataGridView
(9 answers)
Closed 8 years ago.
I need to add some functionality to be able to print whatever is displayed in datagridview. I tried to use bitmap class but it does not seem to be printing all the rows and columns. It looks like a screenshot and missing some columns and rows.
Anybody knows any better way to handle this? Thanks so much.
There are some examples/utilities on CodeProject:
http://www.codeproject.com/KB/printing/PrintingOfDataGridView.aspx
http://www.codeproject.com/KB/printing/GridPrintPreviewSolution.aspx
http://www.codeproject.com/KB/printing/GridPrintPreviewSolution2.aspx
http://www.codeproject.com/KB/printing/DGVPrinter.aspx
Check this link :
How To Print a Data Grid in C# and .NET
And Have you tried creating local report (rdlc and using Reportviewer)?
This will also help you to create custom reports..
Regards

How to convert 26750 string to 26,750 format in c# [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
.NET String.Format() to add commas in thousands place for a number
Hi Guys,
I have got 26750 in my string variable, something like below:
string str = "26750";
Now before showing on page, I want it to be converted into "26,750" format using c#. This value can increase as well as decrease also according to the result, so my format should work in both the cases.
Please suggest!
EDIT:
As I have written I have got string type value in my variable, I am trying with below code, but it is not working for me.
spnMiles.InnerHtml = String.Format("{0:n}", Miles);
It is not changing to the number format.
Please suggest!
This question should answers yours:
.NET String.Format() to add commas in thousands place for a number

How to convert number to arabic word in .Net? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicates:
Is there an easy way to create ordinals in C#?
How can I convert an integer into its verbal representation?
Hi All,
How to convert number to arabic word?
I want output like:
1: First
2: Second,
201: Two hundred first etc
I have try some code but it words for 1..21,23...31,33...41,43..49,51... and then after it does not work.
Is there any special logic for converting 2 in arabic?
Please give me some idea for converting number to word.
Thanks,
Naresh
Please check this previous SO Post on how to change numbers into words.

Categories