RadFixedDocument Table Row Height

1 Answer 89 Views
General Discussions
Harald
Top achievements
Rank 2
Harald asked on 11 Jun 2023, 03:17 PM

I want to create a RadFixedDocument with a table (see screenshot). Thereby the table is created dynamically:


Table headerTable = new Table();
            Telerik.Windows.Documents.Fixed.Model.Editing.Border headerBorder = new Telerik.Windows.Documents.Fixed.Model.Editing.Border(1, BorderStyle.Single, new RgbColor(217, 217, 217));
            headerTable.DefaultCellProperties.Borders = new TableCellBorders(headerBorder, headerBorder, headerBorder, headerBorder);
            headerTable.DefaultCellProperties.Padding = new Thickness(5, 10, 5, 10);

            TableRow headerRow = headerTable.Rows.AddTableRow();

            TableCell vacationEntitlementHeaderCell = headerRow.Cells.AddTableCell();
            vacationEntitlementHeaderCell.PreferredWidth = _maxWidth-100;
            vacationEntitlementHeaderCell.Background = new RgbColor(217, 217, 217);

            Block vacationEntitlementText = vacationEntitlementHeaderCell.Blocks.AddBlock();
            SetTextProperties(vacationEntitlementText, new RgbColor(0, 0, 0), 12, new FontFamily("Verdana"), new RgbColor(217, 217, 217));
            vacationEntitlementText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Left;
            vacationEntitlementText.VerticalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.VerticalAlignment.Center;
            vacationEntitlementText.InsertText("Urlaubsanspruch: " + _localViewModel.Document.VacationEntitlement.ToString());

            TableCell vacationPlannedHeaderCell = headerRow.Cells.AddTableCell();
            vacationPlannedHeaderCell.PreferredWidth = _maxWidth-100;
            vacationPlannedHeaderCell.Background = new RgbColor(217, 217, 217);

            Block vacationPlannedText = vacationPlannedHeaderCell.Blocks.AddBlock();
            SetTextProperties(vacationPlannedText, new RgbColor(0, 0, 0), 12, new FontFamily("Verdana"), new RgbColor(217, 217, 217));
            vacationPlannedText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Left;
            vacationPlannedText.VerticalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.VerticalAlignment.Center;
            vacationPlannedText.InsertText("Geplant: " + _localViewModel.Document.VacationDays.ToString());

            TableCell vacationFreeHeaderCell = headerRow.Cells.AddTableCell();
            vacationFreeHeaderCell.PreferredWidth = _maxWidth-100;
            vacationFreeHeaderCell.Background = new RgbColor(217, 217, 217);

            Block vacationFreeText = vacationFreeHeaderCell.Blocks.AddBlock();
            SetTextProperties(vacationFreeText, new RgbColor(0, 0, 0), 12, new FontFamily("Verdana"), new RgbColor(217, 217, 217));
            vacationFreeText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Left;
            vacationFreeText.VerticalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.VerticalAlignment.Center;
            vacationFreeText.InsertText("Freie Urlaubstage: " + _localViewModel.Document.FreeVacationsDays.ToString());

            TableCell workTimeColorCell = headerRow.Cells.AddTableCell();
            workTimeColorCell.PreferredWidth = 150;
            workTimeColorCell.Background = new RgbColor(217, 217, 217);

            Block workTimeColorText = workTimeColorCell.Blocks.AddBlock();
            SetTextProperties(workTimeColorText, new RgbColor(85, 85, 85), 24, new FontFamily("Verdana"), new RgbColor(85, 85, 85));
            workTimeColorText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Left;
            workTimeColorText.VerticalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.VerticalAlignment.Center;
            workTimeColorText.InsertText(" ");

            TableCell WorkTimeHeaderCell = headerRow.Cells.AddTableCell();
            WorkTimeHeaderCell.PreferredWidth = _maxWidth;
            WorkTimeHeaderCell.Background = new RgbColor(217, 217, 217);

            Block workTimeText = WorkTimeHeaderCell.Blocks.AddBlock();
            SetTextProperties(workTimeText, new RgbColor(0,0,0), 12, new FontFamily("Verdana"), new RgbColor(217, 217, 217));
            workTimeText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Left;
            workTimeText.VerticalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.VerticalAlignment.Center;
            workTimeText.InsertText("Arbeitstage mit hinterlegter Sollarbeitszeit");

            _editor.Position.Translate(_defaultLeftIndent, 80);
            _editor.DrawBlock(headerTable, new Size(_maxWidth, double.PositiveInfinity));

            Table table = new Table();
            Telerik.Windows.Documents.Fixed.Model.Editing.Border border = new Telerik.Windows.Documents.Fixed.Model.Editing.Border(1, BorderStyle.Single, new RgbColor(204, 204, 204));
            table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border);
            table.DefaultCellProperties.Padding = new Thickness(5, 10, 5, 10);

            TableRow valueHeaderRow = table.Rows.AddTableRow();
            TableCell monthCell = valueHeaderRow.Cells.AddTableCell();
            monthCell.PreferredWidth = 150;
            monthCell.Background = new RgbColor(217, 217, 217);

            Block month = monthCell.Blocks.AddBlock();
            SetTextProperties(month, new RgbColor(0, 0, 0), 12, new FontFamily("Verdana"), new RgbColor(217, 217, 217), true);
            month.InsertText("Monat");

            for (int i = 1; i < 32; i++)
            {
                TableCell dayCell = valueHeaderRow.Cells.AddTableCell();
                dayCell.PreferredWidth = 50;
                dayCell.Background = new RgbColor(217, 217, 217);

                Block day = dayCell.Blocks.AddBlock();
                SetTextProperties(day, new RgbColor(0, 0, 0), 12, new FontFamily("Verdana"), new RgbColor(217, 217, 217), true);
                day.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
                day.InsertText(i.ToString());
            }

            foreach (var monthItem in _localViewModel.Document.Months)
            {
                TableRow monthRow = table.Rows.AddTableRow();
                TableRow appointmentRow = table.Rows.AddTableRow();
                
                TableCell monthHeaderCell = monthRow.Cells.AddTableCell();
                monthHeaderCell.PreferredWidth = 120;
                monthHeaderCell.Background = new RgbColor(217, 217, 217);
                monthHeaderCell.RowSpan = 2;

                Block monthName = monthHeaderCell.Blocks.AddBlock();
                SetTextProperties(monthName, new RgbColor(0, 0, 0), 12, new FontFamily("Verdana"), new RgbColor(217, 217, 217));
                monthName.VerticalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.VerticalAlignment.Center;
                monthName.InsertText(monthItem.Name);

                foreach (var dayItem in monthItem.Days)
                {
                    if (dayItem.Plan == 0)
                    {
                        RgbColor background = new RgbColor(255, 255, 255);
                        TableCell monthDayCell = monthRow.Cells.AddTableCell();
                        Block dayText = monthDayCell.Blocks.AddBlock();
                        monthDayCell.PreferredWidth = 50;

                        if (dayItem.Template == Templates.U)
                        {
                            background = new RgbColor(0, 153, 188);
                        }
                        monthDayCell.Background = background;

                        SetTextProperties(dayText, new RgbColor(0, 0, 0), 8, new FontFamily("Verdana"), background);
                        dayText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
                        dayText.InsertText(dayItem.WeekdayStringShort.ToUpper());

                        TableCell appointmentDayCell = appointmentRow.Cells.AddTableCell();
                        //Block appointmentText = appointmentDayCell.Blocks.AddBlock();
                        appointmentDayCell.PreferredWidth = 50;
                        appointmentDayCell.Background = FormatAppointment(dayItem.Date);

                        //SetTextProperties(appointmentText, new RgbColor(0, 0, 0), 0, new FontFamily("Verdana"), new RgbColor(255, 255, 255));
                        //appointmentText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
                        //appointmentText.InsertText(String.Empty);
                    }
                    else
                    {
                        TableCell monthDayCell = monthRow.Cells.AddTableCell();
                        RgbColor rgbColorBackground = new RgbColor(85, 85, 85);
                        RgbColor rgbColorForeground = new RgbColor(255, 255, 255);

                        monthDayCell.Background = rgbColorBackground;
                        Block dayText = monthDayCell.Blocks.AddBlock();
                        monthDayCell.PreferredWidth = 50;

                        SetTextProperties(dayText, rgbColorForeground, 8, new FontFamily("Verdana"), rgbColorBackground);
                        dayText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
                        dayText.InsertText(dayItem.WeekdayStringShort.ToUpper());

                        TableCell appointmentDayCell = appointmentRow.Cells.AddTableCell();
                        //Block appointmentText = appointmentDayCell.Blocks.AddBlock();
                        appointmentDayCell.PreferredWidth = 50;
                        appointmentDayCell.Background = FormatAppointment(dayItem.Date);
                        
                        //SetTextProperties(appointmentText, new RgbColor(0, 0, 0), 0, new FontFamily("Verdana"), new RgbColor(255, 255, 255));
                        //appointmentText.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
                        //appointmentText.InsertText(String.Empty);
                    }
                }
            }
            
            _editor.Position.Translate(_defaultLeftIndent, 130);
            _editor.DrawBlock(table, new Size(_maxWidth, double.PositiveInfinity));
        }

How can I set the height of the empty row below each day?

1 Answer, 1 is accepted

Sort by
0
Accepted
Aleks
Telerik team
answered on 12 Jun 2023, 11:18 AM

Hi Harald,

Thank you for reaching out.

Setting height to table rows seems to be a feature request we have not yet implemented. I am afraid I cannot commit to any deadline on when this will be released, so please subscribe to the public item for any future updates.

I apologize for any issues this missing feature is causing you. Should you have any further questions, please do not hesitate to ask.

Regards,
Aleks
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Harald
Top achievements
Rank 2
commented on 15 Jun 2023, 08:03 PM

Thank you for the answer.
Tags
General Discussions
Asked by
Harald
Top achievements
Rank 2
Answers by
Aleks
Telerik team
Share this question
or