Click here to Skip to main content
15,902,492 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: get control id from the content page Pin
Jesse Squire16-Mar-07 3:49
Jesse Squire16-Mar-07 3:49 
GeneralRe: get control id from the content page Pin
srinandan..16-Mar-07 3:58
srinandan..16-Mar-07 3:58 
GeneralRe: get control id from the content page Pin
Jesse Squire16-Mar-07 5:37
Jesse Squire16-Mar-07 5:37 
GeneralRe: get control id from the content page Pin
srinandan..18-Mar-07 21:08
srinandan..18-Mar-07 21:08 
QuestionMysterious Web User Controls Related Problem Pin
powered_by_xanax16-Mar-07 2:54
powered_by_xanax16-Mar-07 2:54 
QuestionHow to transfer data from HTML table to excel or through dataset to excel. Pin
AjayKrSh16-Mar-07 2:53
AjayKrSh16-Mar-07 2:53 
AnswerRe: How to transfer data from HTML table to excel or through dataset to excel. Pin
Jesse Squire16-Mar-07 3:27
Jesse Squire16-Mar-07 3:27 
GeneralRe: How to transfer data from HTML table to excel or through dataset to excel. Pin
AjayKrSh16-Mar-07 3:48
AjayKrSh16-Mar-07 3:48 
Thnx for your reply....
i got this article from net but still not even able to create an object of application...i have included ref of excel object too...dont knw why Application object in first line now created...



code is as follows:-

In this article, we are going to see how to open a write a dataset to a excel file and open the excel file in the browser.

In order for this to work, there is an important modification in web.config file. We have to add <identity impersonate="true"> else you will get an 'Access is denied' error.

In the application, we have to add a reference for a COM component called "Microsoft Excel 9.0 object library".

Now we have to just loop through the dataset records and populate to each cell in the excel.

Code:

private void createDataInExcel(DataSet ds)

{

Application oXL;

_Workbook oWB;

_Worksheet oSheet;

Range oRng;

string strCurrentDir = Server.MapPath(".") + "\\reports\\";

try

{

oXL = new Application();

oXL.Visible = false;

//Get a new workbook.

oWB = (_Workbook)(oXL.Workbooks.Add( Missing.Value ));

oSheet = (_Worksheet)oWB.ActiveSheet;

//System.Data.DataTable dtGridData=ds.Tables[0];

int iRow =2;

if(ds.Tables[0].Rows.Count>0)

{

// for(int j=0;j
GeneralRe: How to transfer data from HTML table to excel or through dataset to excel. Pin
Jesse Squire16-Mar-07 3:54
Jesse Squire16-Mar-07 3:54 
Questionlistbox and arrays Pin
Kunal P16-Mar-07 2:47
Kunal P16-Mar-07 2:47 
Questionbrowser's back button Pin
yogita charhate16-Mar-07 2:27
yogita charhate16-Mar-07 2:27 
AnswerRe: browser's back button Pin
Kunal P16-Mar-07 2:40
Kunal P16-Mar-07 2:40 
GeneralRe: browser's back button Pin
yuvachandra16-Mar-07 2:48
yuvachandra16-Mar-07 2:48 
GeneralRe: browser's back button Pin
Kunal P16-Mar-07 4:45
Kunal P16-Mar-07 4:45 
GeneralRe: browser's back button Pin
yogita charhate16-Mar-07 4:13
yogita charhate16-Mar-07 4:13 
GeneralRe: browser's back button Pin
Kunal P16-Mar-07 4:48
Kunal P16-Mar-07 4:48 
QuestionSetting _DEBUG for web project Pin
Leo Smith16-Mar-07 2:26
Leo Smith16-Mar-07 2:26 
AnswerRe: Setting _DEBUG for web project Pin
Jesse Squire16-Mar-07 2:56
Jesse Squire16-Mar-07 2:56 
GeneralRe: Setting _DEBUG for web project Pin
Leo Smith16-Mar-07 4:16
Leo Smith16-Mar-07 4:16 
QuestionServer Error Pin
vijay_8316-Mar-07 2:22
vijay_8316-Mar-07 2:22 
AnswerRe: Server Error Pin
ca8msm16-Mar-07 2:30
ca8msm16-Mar-07 2:30 
AnswerRe: Server Error Pin
coolestCoder16-Mar-07 2:32
coolestCoder16-Mar-07 2:32 
Questioncan i poup messagebox ihrough codeing Pin
nikhil123416-Mar-07 2:17
nikhil123416-Mar-07 2:17 
AnswerRe: can i poup messagebox ihrough codeing Pin
RichardGrimmer16-Mar-07 2:20
RichardGrimmer16-Mar-07 2:20 
AnswerRe: can i poup messagebox ihrough codeing Pin
coolestCoder16-Mar-07 2:33
coolestCoder16-Mar-07 2:33 

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.