I have developed a C# windows application. It reads data from an excel file and writes to a new excel work book. Created an EXE for this WinApp. If i run the application or EXE from the local machine, its working fine. Saving the new excel into my C drive. I copied the msi and exe files to another machine and installed the msi.
Following error is raising while running the exe from those machines. "Error in saving file".
Note:- No problem in reading the files. I checked it by browsing different type of files like .jpg, .doc, etc., In this scenario it asks us to browse the relevant file.
my code:
existingFileToWrite1 = @"C:\\LeadOwners-IN";
using (packageToWrite1 = new ExcelPackage(existingFileToWrite1))
{
worksheetToWrite.Cells["A1"].Value = "Lead Owners Mail";
worksheetToWrite.Cells["B1"].Value = "TotalLeads-" + sRegion.Trim();
worksheetToWrite.Cells["C1"].Value = sLInfo + "1-" + sRegion.Trim();
worksheetToWrite.Cells["D1"].Value = sLInfo + "2-" + sRegion.Trim();
worksheetToWrite.Cells["E1"].Value = sLInfo + "3-" + sRegion.Trim();
worksheetToWrite.Cells["F1"].Value = sLInfo + "4-" + sRegion.Trim();
worksheetToWrite.Cells["G1"].Value = sLInfo + "5-" + sRegion.Trim();
worksheetToWrite.Cells["H1"].Value = sLInfo + "6-" + sRegion.Trim();
worksheetToWrite.Cells["I1"].Value = sLInfo + "7-" + sRegion.Trim();
worksheetToWrite.Cells["J1"].Value = sLInfo + "8-" + sRegion.Trim();
worksheetToWrite.Cells["K1"].Value = sLInfo + "9-" + sRegion.Trim();
worksheetToWrite.Cells["L1"].Value = sLInfo + "10-" + sRegion.Trim();
worksheetToWrite.Cells["C" + Iteration1].Value = sFull1.Substring(0, sFull1.Length);
worksheetToWrite.Cells["D" + Iteration1].Value = string.Empty;
worksheetToWrite.Cells["E" + Iteration1].Value = string.Empty;
worksheetToWrite.Cells["F" + Iteration1].Value = string.Empty;
worksheetToWrite.Cells["G" + Iteration1].Value = string.Empty;
worksheetToWrite.Cells["H" + Iteration1].Value = string.Empty;
worksheetToWrite.Cells["I" + Iteration1].Value = string.Empty;
worksheetToWrite.Cells["J" + Iteration1].Value = string.Empty;
worksheetToWrite.Cells["K" + Iteration1].Value = string.Empty;
worksheetToWrite.Cells["L" + Iteration1].Value = string.Empty;
packageToWrite1.Save();
}
Please advice me on this to get the solution. Thanks in advance.