Click here to Skip to main content
15,890,882 members
Home / Discussions / C#
   

C#

 
JokeRe: use my windows application both offline and online. when it connect to internet ,it should synchronize my data and should visible to everybody those who use this software Pin
Richard MacCutchan22-Jun-13 1:12
mveRichard MacCutchan22-Jun-13 1:12 
QuestionRe: use my windows application both offline and online. when it connect to internet ,it should synchronize my data and should visible to everybody those who use this software Pin
jithintbr22-Jun-13 1:16
jithintbr22-Jun-13 1:16 
AnswerRe: use my windows application both offline and online. when it connect to internet ,it should synchronize my data and should visible to everybody those who use this software Pin
jithintbr22-Jun-13 1:17
jithintbr22-Jun-13 1:17 
AnswerRe: use my windows application both offline and online. when it connect to internet ,it should synchronize my data and should visible to everybody those who use this software Pin
OriginalGriff22-Jun-13 1:00
mveOriginalGriff22-Jun-13 1:00 
GeneralRe: use my windows application both offline and online. when it connect to internet ,it should synchronize my data and should visible to everybody those who use this software Pin
jithintbr22-Jun-13 1:15
jithintbr22-Jun-13 1:15 
GeneralRe: use my windows application both offline and online. when it connect to internet ,it should synchronize my data and should visible to everybody those who use this software Pin
OriginalGriff22-Jun-13 1:20
mveOriginalGriff22-Jun-13 1:20 
AnswerRe: use my windows application both offline and online. when it connect to internet ,it should synchronize my data and should visible to everybody those who use this software Pin
Pete O'Hanlon22-Jun-13 4:15
mvePete O'Hanlon22-Jun-13 4:15 
QuestionError while saving XLS file. Pin
Member 1002654421-Jun-13 3:58
Member 1002654421-Jun-13 3:58 
hi,
i am trying to create an .xls file from a data table and saving it in application local folder. all this i am doing for a web application. everything is fine until i end with an error. so please look into below error and help me out with a solution

Error :

Microsoft Excel cannot access the file 'E:\Syed Project\E-Comply_Project\E-Comply Source Code\COC_Export\'. There are several possible reasons:

. The file name or path does not exist.
. The file is being used by another program.
. The workbook you are trying to save has the same name as a currently open workbook.


Code :

public void DTToExcel(System.Data.DataTable dt, string filePath)
{
try
{
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook xlWorkBook;
Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet;
object misValue = System.Reflection.Missing.Value;


xlWorkBook = xlApp.Workbooks.Add(misValue);
xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);


string data = string.Empty;
for (int i = 0; i <= dt.Rows.Count - 1; i++)
{
for (int j = 0; j <= dt.Columns.Count - 1; j++)
{
data = dt.Rows.ItemArray[j].ToString();
xlWorkSheet.Cells[i + 1, j + 1] = data;
}
}
xlWorkBook.SaveAs(filePath + "\\" + "BOM_Matched_ExcelReport.xls", Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
xlWorkBook.Close(true, misValue, misValue);
xlApp.Quit();
releaseObject(xlWorkSheet);
releaseObject(xlWorkBook);
releaseObject(xlApp);
}catch(Exception Ex)
{ throw Ex; }
}


Thanks & Regards,
Sateesh kumar Singupuram

sateesh kumar singupuram
AnswerRe: Error while saving XLS file. Pin
Simon_Whale21-Jun-13 4:01
Simon_Whale21-Jun-13 4:01 
GeneralRe: Error while saving XLS file. Pin
Member 1002654421-Jun-13 4:09
Member 1002654421-Jun-13 4:09 
GeneralRe: Error while saving XLS file. Pin
Simon_Whale21-Jun-13 4:27
Simon_Whale21-Jun-13 4:27 
QuestionASP.NET and MATLAB deployment over web server Pin
Mridul Bagani21-Jun-13 3:44
Mridul Bagani21-Jun-13 3:44 
AnswerRe: ASP.NET and MATLAB deployment over web server Pin
Eddy Vluggen21-Jun-13 7:26
professionalEddy Vluggen21-Jun-13 7:26 
QuestionEditing Group Policies Using C# Pin
piyushhgupta20-Jun-13 7:06
piyushhgupta20-Jun-13 7:06 
AnswerRe: Editing Group Policies Using C# Pin
Pete O'Hanlon20-Jun-13 22:22
mvePete O'Hanlon20-Jun-13 22:22 
GeneralRe: Editing Group Policies Using C# Pin
piyushhgupta23-Jun-13 21:07
piyushhgupta23-Jun-13 21:07 
AnswerRe: Editing Group Policies Using C# Pin
Rajesh Anuhya21-Jun-13 1:03
professionalRajesh Anuhya21-Jun-13 1:03 
QuestionAfter the application is closed, get the last used Path in a textbox when application start again Pin
anubhavprabakar19-Jun-13 22:43
anubhavprabakar19-Jun-13 22:43 
AnswerRe: After the application is closed, get the last used Path in a textbox when application start again Pin
Keith Barrow19-Jun-13 23:44
professionalKeith Barrow19-Jun-13 23:44 
GeneralRe: After the application is closed, get the last used Path in a textbox when application start again Pin
anubhavprabakar20-Jun-13 0:25
anubhavprabakar20-Jun-13 0:25 
GeneralRe: After the application is closed, get the last used Path in a textbox when application start again Pin
Keith Barrow20-Jun-13 2:47
professionalKeith Barrow20-Jun-13 2:47 
GeneralMessage Closed Pin
20-Jun-13 2:33
gadi.sridhar20-Jun-13 2:33 
GeneralRe: After the application is closed, get the last used Path in a textbox when application start again Pin
Eddy Vluggen20-Jun-13 2:50
professionalEddy Vluggen20-Jun-13 2:50 
GeneralRe: After the application is closed, get the last used Path in a textbox when application start again Pin
BobJanova21-Jun-13 1:04
BobJanova21-Jun-13 1:04 
GeneralRe: After the application is closed, get the last used Path in a textbox when application start again Pin
Keith Barrow21-Jun-13 2:27
professionalKeith Barrow21-Jun-13 2:27 

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.