public IXLRangeColumn SetDataType(XLCellValues dataType) { DataType = dataType; return this; }
public IXLRow SetDataType(XLCellValues dataType) { DataType = dataType; return this; }
public IXLColumns SetDataType(XLCellValues dataType) { _columns.ForEach(c => c.DataType = dataType); return this; }
public IXLRangeRows SetDataType(XLCellValues dataType) { _ranges.ForEach(c => c.DataType = dataType); return this; }
public static void SetValue(IXLWorksheet ws, int row, int column, object value, XLCellValues valueDataType) { ws.Cell(row, column).SetValue(value).SetDataType(valueDataType); }
public IXLRangeColumn SetDataType(XLCellValues dataType) { DataType = dataType; return(this); }
public CellValue(object v, XLCellValues t) { Value = v; Type = t; }
public CellValue() { Value = null; Type = XLCellValues.Text; }
public void ProcessRequest(HttpContext context) { var cnn = context.Request.QueryString["cnn"]; var mvx = new CMvx(); mvx.RegisterSingleton <IConfiguracionDeConexion, frmMainMenu.ConfiguracionDeConexion>(new frmMainMenu.ConfiguracionDeConexion(cnn)); mvx.RegisterType <IBaseDeDatosServicio, BaseDeDatosServicio>(); mvx.RegisterType <IManifiestoServicio, ManifiestoServicio>(); XLWorkbook workbook = new XLWorkbook(); IXLWorksheet worksheet = workbook.Worksheets.Add("Cargar Manifiesto"); worksheet.Protect("Mobility2016$$"); var servicio = mvx.Resolve <IManifiestoServicio>(); var templateExcel = servicio.GenerarColumnasParaTemplate(); int i = 1; foreach (var columna in templateExcel) { XLCellValues tipo = XLCellValues.Text; object defaultValue = string.Empty; if (columna.VALUE.Trim() == "Fecha visita") { tipo = XLCellValues.DateTime; defaultValue = DateTime.Now.Date; } else if (columna.VALUE == "Hora recomendada visita") { tipo = XLCellValues.TimeSpan; defaultValue = new TimeSpan(); } else if (columna.VALUE == "Cantidad") { tipo = XLCellValues.Number; defaultValue = 0; } else if (columna.VALUE == "Número documento") { tipo = XLCellValues.Number; defaultValue = 0; } else if (columna.VALUE == "GPS cliente") { tipo = XLCellValues.Text; defaultValue = ""; } for (int j = 2; j < 3; j++) { worksheet.Cell(j, i).DataType = tipo; worksheet.Cell(j, i).Value = defaultValue; } worksheet.Cell(1, i).DataType = XLCellValues.Text; worksheet.Cell(1, i).Value = columna.VALUE; worksheet.Cell(1, i).Style.Font.Bold = true; worksheet.Cell(1, i).Style.Fill.BackgroundColor = XLColor.BabyBlueEyes; worksheet.Cell(1, i).Style.Alignment.SetHorizontal(XLAlignmentHorizontalValues.Center); worksheet.Column(i).Style.Protection.SetLocked(false); worksheet.Column(i).Width = 20; i++; } worksheet.Row(1).Style.Protection.SetLocked(true); MemoryStream s = (MemoryStream)GetStream(workbook); HttpResponse response = HttpContext.Current.Response; response.ClearContent(); response.Clear(); response.ContentType = "text/plain"; response.AddHeader("Content-Disposition", "attachment; filename=Load_Manifest.xlsx;"); response.BinaryWrite(s.ToArray()); response.Flush(); response.End(); }