Hi All,
Actually my problem is i have these skill set(Android(0 Months), Java(0 Months), IOS(0 Months), C++(0 Months)) in grid it is showing single line. now i am downloading this grid in Excel. after that i am not getting these skills in single line . i am getting one by one line like
please help me . how to display in single line
| Android(0 Months) |
| Java(0 Months) |
| IOS(0 Months) |
| C++(0 Months) |
Raja TPosted Nov 12, 2015, 4:14 AM
padmapriya patruniPosted Nov 12, 2015, 3:57 AM
Raja TPosted Nov 12, 2015, 2:47 AM
{
padmapriya patruniPosted Nov 12, 2015, 2:29 AM
{
var path = repositoryObject.ExcelForNotallocatedemployeeDetails();
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
byte[] fileBytes = System.IO.File.ReadAllBytes(path);
var fileName = "NotallocatedEmployeeDetails.xlsx";
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
{
try
{
string path = string.Empty;
string title = "Not allocated Employee Details";
DownloadExcelRepository repository = new DownloadExcelRepository();
var report = rmsServiceClient.GetNotallocatedemployeeDetails().ToList();
if (report != null)
{
NameValueCollection collection = new NameValueCollection();
int slNo = 0;
for (int i = 0; i < report.Count; i++)
{
DateTime CurrentDate = DateTime.Now;
DateTime cd = DateTime.Now;
DateTime dateOfJoin = (DateTime)report[i].DateOfJoin;
TimeSpan ts = CurrentDate - dateOfJoin;
double months = Math.Round(ts.Days / (365.25 / 12));
slNo = slNo + 1;
collection.Add("Sl No", Convert.ToString(slNo));
collection.Add("Employee No", report[i].EmployeeId);
collection.Add("Employee Name", report[i].EmployeeName);
collection.Add("Role", report[i].Role);
collection.Add("Bench From", @String.Format("{0:MMM d yyyy}", report[i].BenchFrom));
collection.Add("Base Location", report[i].BaseLocation);
collection.Add("Total Experience(In Months)", Convert.ToString(report[i].TotalExperience));
collection.Add("Exp in Rapid Value(In Months)", months.ToString());
collection.Add("Reporting Manager", report[i].ReportingManager);
collection.Add("Skills",report[i].Skills);
//collection.Add("Skills", string.Join(",", report[i].Skills));
collection.Add("Next Allocated Project", report[i].NextAllocatedProject);
collection.Add("Next Allocation From", @String.Format("{0:MMM d yyyy}", report[i].NextAllocationFrom));
collection.Add("Next Project PM", report[i].NextProjectPM);
}
path = repository.DownloadExcel(collection, title);
}
return path;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
{
String path = string.Empty;
try
{
path = AppDomain.CurrentDomain.BaseDirectory + "ExcelTemplate\\" + "ExcelTemplate.xlsx";
FileInfo templateFile = new FileInfo(path);
string SendExcellFiles = AppDomain.CurrentDomain.BaseDirectory + "ExcelTemplate\\SendExcellFiles\\";
if (!System.IO.Directory.Exists(SendExcellFiles))
{
System.IO.Directory.CreateDirectory(SendExcellFiles);
}
//string newFilePath = SendExcellFiles + Guid.NewGuid() + ".xlsx";
string newFilePath = SendExcellFiles + title + ".xlsx";
FileInfo newFile = new FileInfo(newFilePath);
if (newFile.Exists)
{
newFile.Delete();
newFile = new FileInfo(newFilePath);
}
using (ExcelPackage package = new ExcelPackage(newFile, templateFile))
{
ExcelWorksheet worksheet = package.Workbook.Worksheets[1];
worksheet.Cells["A4"].Value = title;
worksheet.Cells["C6"].Value = DateTime.UtcNow;
int rowvalue = 10;
int headerCount = collection.AllKeys.Distinct().Count();
int i = 1;
foreach (string key in collection.AllKeys.Distinct())
{
worksheet.Cells[rowvalue, i].Value = key;
i++;
}
i = 1;
foreach (string key in collection.AllKeys)
{
var Exelrowvalue = rowvalue + 1;
var keyvalue = collection[key].Split(',');
foreach (var item in keyvalue)
{
worksheet.Cells[Exelrowvalue, i].Value = item;
Exelrowvalue++;
}
i++;
}
package.Save();
}
return newFilePath;
}
catch (Exception ex)
{
_logger.LogError(Log4NetLogger.Category.Exception, "DownloadExcel Failed.. " + ex.Message);
return path;
}
}
Raja TPosted Nov 12, 2015, 1:45 AM
padmapriya patruniPosted Nov 12, 2015, 1:27 AM
if (report != null)
{
NameValueCollection collection = new NameValueCollection();
for (int i = 0; i < report.Count; i++)
{
collection.Add("Skills",report[i].Skills);
}
path = repository.DownloadExcel(collection, title);
}
return path;
Raja TPosted Nov 12, 2015, 1:15 AM