MonthCalendar's attributes
Exemplo n.º 1
0
        // Private Methods

        private void addCells(IEnumerable <MonthTableCell> monthCells)
        {
            int number = 0;

            foreach (var cell in monthCells)
            {
                number++;
                if (number == 36)
                {
                    if (cell.DayNumber == 0)
                    {
                        return;
                    }
                }

                if (cell.DayNumber == 0)
                {
                    var empryCell = new PdfPCell();
                    setCommonPdfPCellProperties(empryCell);
                    _mainTable.AddCell(empryCell);
                    continue;
                }

                cell.DescriptionCell = createCellDescription(cell);
                if (cell.DescriptionCell == null)
                {
                    if (CalendarAttributes.CellsCustomizer != null)
                    {
                        CalendarAttributes.CellsCustomizer(cell);
                    }

                    _mainTable.AddCell(cell.NumberCell);
                }
                else
                {
                    var cellTable = new PdfPTable(1)
                    {
                        WidthPercentage = 100,
                        RunDirection    = runDirection
                    };
                    cell.NumberCell.Border      = 0;
                    cell.DescriptionCell.Border = 0;
                    cell.DescriptionCell.HorizontalAlignment = (int)CalendarAttributes.DescriptionHorizontalAlignment;

                    if (CalendarAttributes.CellsCustomizer != null)
                    {
                        CalendarAttributes.CellsCustomizer(cell);
                    }

                    cellTable.AddCell(cell.NumberCell);
                    cellTable.AddCell(cell.DescriptionCell);
                    var tableCell = new PdfPCell(cellTable);
                    setCommonPdfPCellProperties(tableCell);
                    _mainTable.AddCell(tableCell);
                }
            }
        }
 /// <summary>
 /// Displaying current cell's data as a MonthCalendar.
 /// Calendar's cell data type should be CalendarData. Use DaysInfoToCalendarData.MapToCalendarDataList to map list of the DayInfo's to the list of CalendarData's.
 /// </summary>
 /// <param name="data">MonthCalendarField's data.</param>
 public void MonthCalendar(CalendarAttributes data)
 {
     _columnItemsTemplate = new MonthCalendarField
     {
         MonthCalendarFieldData = data
     };
 }