Click here to Skip to main content
16,009,057 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to integrate facebook on a site? Pin
alexa_adrian200115-Jul-11 2:32
alexa_adrian200115-Jul-11 2:32 
GeneralRe: How to integrate facebook on a site? Pin
DaveAuld17-Jul-11 20:10
professionalDaveAuld17-Jul-11 20:10 
GeneralRe: How to integrate facebook on a site? Pin
alexa_adrian200117-Jul-11 20:43
alexa_adrian200117-Jul-11 20:43 
Questionhow can i add row to table dynamically? Pin
buffering8314-Jul-11 19:57
buffering8314-Jul-11 19:57 
AnswerGridview Pin
David Mujica15-Jul-11 2:41
David Mujica15-Jul-11 2:41 
Questionm working on a project of serial communication related matters in asp.net .. plz help me out Pin
ajay singh rajawat13-Jul-11 21:15
ajay singh rajawat13-Jul-11 21:15 
AnswerRe: m working on a project of serial communication related matters in asp.net .. plz help me out Pin
Richard MacCutchan13-Jul-11 23:27
mveRichard MacCutchan13-Jul-11 23:27 
QuestionGoogle Map in asp.net Pin
lalit1413-Jul-11 20:37
lalit1413-Jul-11 20:37 
AnswerRe: Google Map in asp.net Pin
Pete O'Hanlon13-Jul-11 22:25
mvePete O'Hanlon13-Jul-11 22:25 
QuestionCan we show validation message differently in MVC3 Pin
Jagz W13-Jul-11 19:02
professionalJagz W13-Jul-11 19:02 
AnswerRe: Can we show validation message differently in MVC3 Pin
Anurag Gandhi13-Jul-11 20:44
professionalAnurag Gandhi13-Jul-11 20:44 
QuestionPartial views(.ascx) in MVC in vs2008 or 2010 Pin
siva45513-Jul-11 16:47
siva45513-Jul-11 16:47 
AnswerRe: Partial views(.ascx) in MVC in vs2008 or 2010 Pin
Anurag Gandhi13-Jul-11 20:57
professionalAnurag Gandhi13-Jul-11 20:57 
QuestionProblem hosting a Silverlight movie properly in aspx and html Pin
Vimalsoft(Pty) Ltd13-Jul-11 8:30
professionalVimalsoft(Pty) Ltd13-Jul-11 8:30 
QuestionURL Rewriting ?? Pin
Sanjay Kunjam13-Jul-11 5:03
Sanjay Kunjam13-Jul-11 5:03 
AnswerRe: URL Rewriting ?? Pin
Not Active13-Jul-11 5:27
mentorNot Active13-Jul-11 5:27 
GeneralRe: URL Rewriting ?? Pin
Sanjay Kunjam13-Jul-11 5:36
Sanjay Kunjam13-Jul-11 5:36 
Questionexport dataset to excel without using htmltextwriter Pin
sujitdeshpande_1913-Jul-11 3:49
sujitdeshpande_1913-Jul-11 3:49 
QuestionImport Data From sql to Excel using Microsoft.Office.Interop Pin
sujitdeshpande_1912-Jul-11 22:18
sujitdeshpande_1912-Jul-11 22:18 
Hi

I am generating a excel file using Microsoft.Office.Interop.excel but the problem is the two excel file gets generated.one is with the file name that i had set. and other is with the name sheet1.xls. So please help me.
this is the code i am doing.+

public void excelgenerate(DataSet ds)
{
try
{

//Microsoft.Office.Interop.Excel.ApplicationClass excel = new ApplicationClass();

//excel.Application.Workbooks.Add(true);
Microsoft.Office.Interop.Excel.Application oAppln;
//declaring work book
Microsoft.Office.Interop.Excel.Workbook oWorkBook;
//declaring worksheet
Microsoft.Office.Interop.Excel.Worksheet oWorkSheet;
oAppln = new Microsoft.Office.Interop.Excel.Application();
oWorkBook = (Microsoft.Office.Interop.Excel.Workbook)(oAppln.Workbooks.Add(true));
//oWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)oWorkBook.ActiveSheet;
int i = 0;
foreach (System.Data.DataTable table in ds.Tables)
{
//oWorkSheet = new Microsoft.Office.Interop.Excel.Worksheet();

oWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)(oWorkBook.Worksheets.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing));
if (i == 0)
{
oWorkSheet.Name = "ActionPickListReport";
}
else
{
oWorkSheet.Name = "second";
}
oWorkSheet.Activate();


//oWorkBook.Worksheets.Add(null, null, 1, null);
//DataTable table = DATASETNAME.Tables[0];
int ColumnIndex = 0;

foreach (DataColumn col in table.Columns)
{
ColumnIndex++;

oWorkSheet.Cells[1, ColumnIndex] = col.ColumnName;
}
int rowIndex = 0;
foreach (DataRow row in table.Rows)
{
rowIndex++;
ColumnIndex = 0;
foreach (DataColumn col in table.Columns)
{
ColumnIndex++;
oWorkSheet.Cells[rowIndex + 1, ColumnIndex] = row[col.ColumnName].ToString();
}
}


// Worksheet worksheet = (Worksheet)oAppln.ActiveSheet;
//worksheet.Activate();
i++;
}

string fileName = "ActionPickReport.xls"; //System.Guid.NewGuid().ToString().Replace("-", "") + ".xls";
// string uploadfld = Server.MapPath("upload");
fileName = "C:\\Temp\\" + fileName;
//string strFile = "d://" + fileName;
//oWorkBook.Save();
oWorkBook.SaveAs(fileName, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, null, null, false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, false, false,null, null,null);
//oWorkBook._SaveAs(fileName, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, "abc", "abc", false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, false, false, null, null);
oAppln.Quit();

}
catch (Exception ex)
{

}
finally { }
}
SuggestionRe: Import Data From sql to Excel using Microsoft.Office.Interop Pin
Shameel12-Jul-11 23:44
professionalShameel12-Jul-11 23:44 
QuestionValidating Email without the use of regular Expression ? Pin
Rameez Raja12-Jul-11 20:14
Rameez Raja12-Jul-11 20:14 
SuggestionRe: Validating Email without the use of regular Expression ? Pin
Blue_Boy12-Jul-11 21:07
Blue_Boy12-Jul-11 21:07 
AnswerEmail validation WebService Pin
David Mujica13-Jul-11 2:52
David Mujica13-Jul-11 2:52 
QuestionXML Deserialization Pin
indian14312-Jul-11 9:58
indian14312-Jul-11 9:58 
QuestionOnFocus server side event for textbox in datagrid Pin
minckle12-Jul-11 8:53
minckle12-Jul-11 8:53 

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.