public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(RowCells != null ? RowCells.ToStepValue() : "$"); parameters.Add(IsHeading != null ? IsHeading.ToStepValue() : "$"); return(string.Join(", ", parameters.ToArray())); }
/// <summary> /// Layouts the calendar. /// </summary> private void LayoutCalendar() { var cellWidth = this.Bounds.Size.Width / (float)mColumns; float headerHeight = (DSCalendarTheme.CurrentTheme.DayStyle == CalendarDayStyle.Header) ? DSCalendarTheme.CurrentTheme.HeaderHeight : 0; float left = 0.0f; int loop = 0; if (DSCalendarTheme.CurrentTheme.DayStyle == CalendarDayStyle.Header) { while (loop < mColumns) { var cell = mHeaderCells[loop]; cell.Frame = new RectangleF(left, 0, cellWidth, headerHeight).Integral(); var intDay = 0; if (DSCalendarTheme.CurrentTheme.WeekStart == CalendarWeekStart.Sunday) { intDay = (int)EnumHelper.ConvertSundayDayToDay((WeekDayFromSunday)loop); } else { intDay = loop; } switch (DSCalendarTheme.CurrentTheme.HeaderDayDisplayMode) { case CalendarDayDisplayMode.Full: { cell.Text = DSCalendarEnglish.CurrentLanguage.DayStrings[intDay]; } break; case CalendarDayDisplayMode.Short: { cell.Text = DSCalendarEnglish.CurrentLanguage.ShortStringForDay(intDay); } break; default: { cell.Text = String.Empty; } break; } left += cellWidth; loop++; } } float cellHeight = (this.Bounds.Size.Height - headerHeight) / (float)NumberOfRows; var today = DateTime.Now; var cleanedToday = new DateTime(today.Year, today.Month, today.Day); var datePos = 0; foreach (List <DSCalendarCell> row in RowCells) { left = 0.0f; loop = 0; while (loop < mColumns) { var aDate = Dates[datePos]; var aCellInfo = new DSCalendarCellInfo() { Date = aDate }; aCellInfo.IsFirstRow = (RowCells.IndexOf(row) == 0); aCellInfo.IsFocus = (aCellInfo.Date == cleanedToday); if ((aDate >= FirstDay) && (aDate <= LastDay)) { aCellInfo.IsCurrent = true; } switch (DSCalendarTheme.CurrentTheme.MonthDisplayMode) { case CalendarMonthDisplayMode.FirstOnly: { if (aDate.Equals(FirstDay)) { aCellInfo.ShowMonth = true; } } break; case CalendarMonthDisplayMode.OnChange: { if ((datePos == 0 && loop == 0) || aDate.Equals(FirstDay) || (aDate > LastDay && aDate.Day == 1)) { aCellInfo.ShowMonth = true; } } break; } var cell = row[loop]; cell.Events = Data[aDate]; cell.Frame = new RectangleF(left, headerHeight, cellWidth, cellHeight).Integral(); cell.CellInfo = aCellInfo; if (aCellInfo.Date == mSelectedDate) { cell.IsSelected = true; } left += cellWidth; loop++; datePos++; } headerHeight += cellHeight; } }
public TaskCollectionData ReadTaskData(Stream stream, List <Model.TemplateConfig> configs, List <TemplateSheet> sheetConfigs) { LoginUserInfo userinfo = WebHelper.GetCurrentUser();; Workbook dataBook = new Workbook(stream); TaskCollectionData tcd = new TaskCollectionData(); tcd.Sheets = new List <DataSheet>(); StringBuilder sb = new StringBuilder(); sheetConfigs.ForEach(sheetconfig => { DataSheet sheet = new DataSheet(); sheet.SheetName = sheetconfig.TemplateSheetName; sheet.Rows = new List <DataRows>(); var firstRow = sheetconfig.RowNum; var firstColumn = sheetconfig.ColumnNum; var currentSheet = dataBook.Worksheets[sheet.SheetName]; if (currentSheet != null) { var currentConfigs = configs.FindAll(x => x.TemplateSheetID == sheetconfig.ID).OrderBy(x => x.SortIndex).ToList(); for (int i = 0; i <= currentSheet.Cells.MaxDataRow; i++) { if (i >= firstRow) { DataRows dr = new DataRows(); dr.Cells = new List <RowCells>(); //获取数据 for (int j = 0; j <= currentSheet.Cells.MaxDataColumn; j++) { if (j >= firstColumn - 1) { int cellIndex = j - (firstColumn - 1); RowCells cell = new RowCells(); cell.Index = cellIndex; if (currentConfigs.Count >= cellIndex + 1) { var config = currentConfigs[cellIndex]; var cellValue = GetCellValue(currentSheet, i, j, config); cell.Type = config.FieldType; cell.Formula = config.CellFormula; cell.IsFormula = currentSheet.Cells[i, j].IsFormula; cell.Value = cellValue; dr.Cells.Add(cell); } } } if (dr.Cells.Count == 0 || !dr.Cells.Any(x => !string.IsNullOrEmpty(x.Value))) { goto BreakLoop; } var hasError = dr.Cells.FindAll(cell => { var config = currentConfigs[cell.Index]; return(config != null && config.IsRequired == 1 && string.IsNullOrEmpty(cell.Value)); }) .Select(cell => { var config = currentConfigs[cell.Index]; return(config); }) .ToList(); if (hasError.Count > 0) { sb.AppendLine(string.Format("【{1}】数据列:【{0}】为必填列", string.Join(",", hasError.GroupBy(c => c.FieldName).Select(c => c.Key)), currentSheet.Name)); } sheet.Rows.Add(dr); } continue; BreakLoop: { break; } } tcd.Sheets.Add(sheet); } }); if (sb.Length > 0) { sb.AppendLine("请仔细核对"); throw new Exception(sb.ToString()); } var noDataSheets = tcd.Sheets.Where(t => !t.Rows.Any()).ToList(); if (noDataSheets.Any()) { throw new Exception(string.Format("【{0}】未检测到有效数据行", string.Join("、", noDataSheets.Select(s => s.SheetName)))); } return(tcd); }
internal Row(Table table) { Table = table; Id = table.GetNextId(); Cells = new RowCells(); }
public void AddCellRange(List <SpreadsheetCell> cells) { RowCells.AddRange(cells); }
public void AddCell(SpreadsheetCell cell) { RowCells.Add(cell); }