Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
GeneralRe: Converting Byte to Decimal Pin
computerpublic11-Feb-14 9:07
computerpublic11-Feb-14 9:07 
GeneralRe: Converting Byte to Decimal Pin
harold aptroot11-Feb-14 9:15
harold aptroot11-Feb-14 9:15 
GeneralRe: Converting Byte to Decimal Pin
computerpublic11-Feb-14 9:29
computerpublic11-Feb-14 9:29 
GeneralRe: Converting Byte to Decimal Pin
computerpublic11-Feb-14 10:09
computerpublic11-Feb-14 10:09 
GeneralRe: Converting Byte to Decimal Pin
harold aptroot11-Feb-14 22:03
harold aptroot11-Feb-14 22:03 
GeneralRe: Converting Byte to Decimal Pin
computerpublic12-Feb-14 7:31
computerpublic12-Feb-14 7:31 
GeneralRe: Converting Byte to Decimal Pin
harold aptroot12-Feb-14 8:55
harold aptroot12-Feb-14 8:55 
GeneralRe: Converting Byte to Decimal Pin
computerpublic12-Feb-14 9:08
computerpublic12-Feb-14 9:08 
GeneralRe: Converting Byte to Decimal Pin
harold aptroot12-Feb-14 9:16
harold aptroot12-Feb-14 9:16 
GeneralRe: Converting Byte to Decimal Pin
computerpublic12-Feb-14 9:24
computerpublic12-Feb-14 9:24 
GeneralRe: Converting Byte to Decimal Pin
harold aptroot12-Feb-14 9:49
harold aptroot12-Feb-14 9:49 
SuggestionRe: Converting Byte to Decimal Pin
Richard Deeming11-Feb-14 9:34
mveRichard Deeming11-Feb-14 9:34 
QuestionConverting Byte Array to Integer Array Pin
computerpublic11-Feb-14 4:10
computerpublic11-Feb-14 4:10 
AnswerRe: Converting Byte Array to Integer Array Pin
Pete O'Hanlon11-Feb-14 4:15
mvePete O'Hanlon11-Feb-14 4:15 
GeneralRe: Converting Byte Array to Integer Array Pin
computerpublic11-Feb-14 4:31
computerpublic11-Feb-14 4:31 
GeneralRe: Converting Byte Array to Integer Array PinPopular
Pete O'Hanlon11-Feb-14 4:42
mvePete O'Hanlon11-Feb-14 4:42 
QuestionPayment Using Visa Cards Pin
Zeyad Jalil11-Feb-14 1:58
professionalZeyad Jalil11-Feb-14 1:58 
AnswerRe: Payment Using Visa Cards Pin
V.11-Feb-14 2:18
professionalV.11-Feb-14 2:18 
AnswerRe: Payment Using Visa Cards PinPopular
OriginalGriff11-Feb-14 3:03
mveOriginalGriff11-Feb-14 3:03 
GeneralRe: Payment Using Visa Cards Pin
Dave Kreskowiak11-Feb-14 7:27
mveDave Kreskowiak11-Feb-14 7:27 
JokeRe: Payment Using Visa Cards Pin
AmitGajjar11-Feb-14 20:00
professionalAmitGajjar11-Feb-14 20:00 
GeneralRe: Payment Using Visa Cards Pin
Dave Kreskowiak12-Feb-14 4:22
mveDave Kreskowiak12-Feb-14 4:22 
GeneralRe: Payment Using Visa Cards Pin
V.11-Feb-14 20:28
professionalV.11-Feb-14 20:28 
AnswerRe: Payment Using Visa Cards Pin
GuyThiebaut11-Feb-14 9:54
professionalGuyThiebaut11-Feb-14 9:54 
QuestionIssue in Exporting Column Headers from DatagridView to Excel Pin
Mohan Subramani11-Feb-14 1:22
Mohan Subramani11-Feb-14 1:22 
Hey Guys,

I need your assistance, am struck up with an issue.
Issue: I have retrived a SQL data into a DataGridView, It has the below column header names like (Package_ID, Package_Name etc.)

I used the below code to copy the data in DataGridview to Excel.
Copying is fine, but am not getting the colum headers which are visible in my DatagridView. (Package_ID, Package_Name etc.)

Other than the Column headers all other data are getting copied.

the code i used:

private void copyAlltoClipboard()
{
dataGridView1.SelectAll();
DataObject dataObj = dataGridView1.GetClipboardContent();
if (dataObj != null)
Clipboard.SetDataObject(dataObj);
}

private void btn_Export_Click(object sender, EventArgs e)
{
copyAlltoClipboard();
Microsoft.Office.Interop.Excel.Application xlexcel;
Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;
xlexcel = new Excel.Application();
xlexcel.Visible = true;
xlWorkBook = xlexcel.Workbooks.Add(misValue);
xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
Excel.Range CR = (Excel.Range)xlWorkSheet.Cells[1, 1];
CR.Select();
xlWorkSheet.PasteSpecial(CR, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true);
}


i want my column headers also need to be copied to Excel.
Please assist.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.