Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            doc.Clear();

            doc.Style.Font = new Font("Tahoma", 16);

            // add comment
            RenderParagraph desc = new RenderParagraph();

            desc.Content.Add(new ParagraphText(_desc3));
            desc.Style.Spacing.Bottom = "5mm"; // add empty space after comment
            desc.Style.BackColor      = Color.LightPink;
            doc.Body.Children.Add(desc);

            RenderTable table = CreateTable(3, 3, "Cell {0}:{1}");

            // center text in cells by vertical and horizontal
            table.Style.TextAlignHorz = AlignHorzEnum.Center;
            table.Style.TextAlignVert = AlignVertEnum.Center;
            table.ColumnSizingMode    = TableSizingModeEnum.Auto;
            table.Style.GridLines.All = LineDef.DefaultBold;
            // stretch all rows
            table.StretchRows = StretchTableEnum.AllVectors;
            // stretch all columns
            table.StretchColumns = StretchTableEnum.AllVectors;
            doc.Body.Children.Add(table);

            doc.Generate();
        }
Esempio n. 2
0
        private RenderObject CreateFieldCaption(
            C1PrintDocument doc,
            string caption,
            bool required,
            bool password)
        {
            ParagraphText   pt;
            RenderParagraph result = new RenderParagraph(doc);

            if (required)
            {
                pt = new ParagraphText("*");
                pt.Style.Parents = _requiredCharStyle;
                result.Content.Add(pt);

                pt = new ParagraphText(" ");
                pt.Style.Parents = _fieldCaptionStyle;
                result.Content.Add(pt);
            }

            pt = new ParagraphText(caption);
            pt.Style.Parents = _fieldCaptionStyle;
            result.Content.Add(pt);

            if (password)
            {
                pt = new ParagraphText("(Must be at least 5 characters)");
                pt.Style.Parents = _passwordInfoStyle;
                result.Content.Add(pt);
            }

            return(result);
        }
Esempio n. 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            const int rowCount = 60; // count of rows in table
            const int colCount = 4;  // count of columns in table

            doc.Clear();

            doc.Style.Font = new Font("Verdana", 18);

            // add comment
            RenderParagraph desc = new RenderParagraph();

            desc.Content.Add(new ParagraphText(_desc2));
            desc.Style.Spacing.Bottom = "5mm"; // add empty space after comment
            desc.Style.BackColor      = Color.LightPink;
            doc.Body.Children.Add(desc);

            // use image from dictionary
            doc.Dictionary.Add(new DictionaryImage("Checked", Image.FromFile(@"..\..\Checked.bmp")));

            RenderTable rt = new RenderTable();

            rt.Style.GridLines.All = LineDef.Default;

            for (int r = 0; r < rowCount; r++)
            {
                // create RenderImage object in the first column
                RenderImage ri = new RenderImage();
                ri.ImageName = "Checked";
                ri.Style.ImageAlign.AlignHorz = ImageAlignHorzEnum.Center;
                ri.Style.ImageAlign.AlignVert = ImageAlignVertEnum.Center;
                rt.Cells[r, 0].RenderObject   = ri;

                // generate content for all other columns
                for (int c = 1; c < colCount; c++)
                {
                    StringBuilder sb = new StringBuilder();
                    for (int i = 0; i < (c % 2 == 0 ? 2 : 1); i++)
                    {
                        sb.Append(string.Format("Line{0}\r", i));
                    }
                    rt.Cells[r, c].Text = sb.ToString();
                }

                if (r % 2 == 0)
                {
                    rt.Rows[r].Style.BackColor = Color.LightBlue;
                }
            }

            // change sizing mode of first column, it width will be determinated
            // by the width of image
            rt.Cols[0].SizingMode = TableSizingModeEnum.Auto;

            doc.Body.Children.Add(rt);

            doc.Generate();
        }
 RenderBox box(RenderParagraph p, int width = 200, int height = 600)
 {
     return(new RenderConstrainedOverflowBox(
                minWidth: width,
                maxWidth: width,
                minHeight: height,
                maxHeight: height,
                alignment: Alignment.center,
                child: p
                ));
 }
Esempio n. 5
0
 private void RenderLine(RenderParagraph par, string line)
 {
     if (ContainsRWord(line))
     {
         RenderLineWithRWords(par, line);
     }
     else
     {
         par.Content.AddText(line);
     }
 }
Esempio n. 6
0
        private RenderObject CreateAggregate1(string caption, string aggregateName, Style captionStyle, Style aggregateStyle)
        {
            RenderParagraph result = new RenderParagraph();
            ParagraphText   pt     = new ParagraphText(caption + "\r");

            pt.Style.Parents = captionStyle;
            result.Content.Add(pt);
            pt = new ParagraphText("[Aggregates!" + aggregateName + ".Value]");
            pt.Style.Parents = aggregateStyle;
            result.Content.Add(pt);

            return(result);
        }
Esempio n. 7
0
 RenderBox flexItemBox(RenderParagraph p, int width = 200, int height = 150)
 {
     return(new RenderConstrainedBox(
                additionalConstraints: new BoxConstraints(minWidth: width, maxWidth: width, minHeight: height,
                                                          maxHeight: height),
                child: new RenderDecoratedBox(
                    decoration: new BoxDecoration(
                        color: new Color(0xFFFFFFFF),
                        borderRadius: BorderRadius.all(3),
                        border: Border.all(Color.fromARGB(255, 255, 0, 0), 1)
                        ),
                    child: new RenderPadding(EdgeInsets.all(10), p
                                             )
                    )));
 }
Esempio n. 8
0
        /// <summary>
        /// Creates a RenderParagraph containing a caption (label) and an expression
        /// referencing an aggregate with the specified name, delimited by a newline.
        /// The aggregate must be added to the document's DataSchema.Aggregates separately.
        /// </summary>
        /// <param name="caption">The caption text</param>
        /// <param name="aggregateName">The aggregate name.</param>
        /// <param name="captionStyle">Style for the caption text.</param>
        /// <param name="aggregateStyle">Style for the aggregate value.</param>
        /// <param name="currency">If true, value is formatted as currency.</param>
        /// <returns>The created RenderParagraph object.</returns>
        private RenderObject CreateAggregate1(string caption, string aggregateName,
                                              C1.C1Preview.Style captionStyle, C1.C1Preview.Style aggregateStyle, bool currency)
        {
            RenderParagraph result = new RenderParagraph();
            ParagraphText   pt     = new ParagraphText(caption + "\r");

            pt.Style.Parents = captionStyle;
            result.Content.Add(pt);
            if (currency)
            {
                pt = new ParagraphText("[string.Format(\"{0:C}\",Aggregates!" + aggregateName + ".Value)]");
            }
            else
            {
                pt = new ParagraphText("[Aggregates!" + aggregateName + ".Value]");
            }
            pt.Style.Parents = aggregateStyle;
            result.Content.Add(pt);
            return(result);
        }
Esempio n. 9
0
 private void RenderLineWithRWords(RenderParagraph par, string line)
 {
     string[] words = line.Split(' ');
     foreach (string word in words)
     {
         if (reservedWords.Contains(word))
         {
             par.Content.AddText(word, Color.Blue);
         }
         else
         {
             par.Content.AddText(word);
         }
         par.Content.AddText(" ");
     }
     if (par.Content.Count > 0)
     {
         //remove trailing space
         par.Content.RemoveAt(par.Content.Count - 1);
     }
 }
Esempio n. 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            doc.Clear();

            doc.Style.Font = new Font("Verdana", 18);

            RenderParagraph desc = new RenderParagraph();

            desc.Content.Add(new ParagraphText(_desc1));
            desc.Style.Spacing.Bottom = "5mm"; // add empty space after comment
            desc.Style.BackColor      = Color.LightPink;
            doc.Body.Children.Add(desc);

            // create RenderTable object
            RenderTable rt = new RenderTable();

            for (int r = 0; r < 70; r++)
            {
                for (int c = 0; c < 3; c++)
                {
                    rt.Cells[r, c].Text = string.Format("Cell ({0}, {1})", r, c);
                }
            }
            rt.Style.GridLines.All = LineDef.Default;
            // by default columns calculated as Fixed
            rt.ColumnSizingMode = TableSizingModeEnum.Auto;
            // by default width of table is "parent.width"
            rt.Width = Unit.Auto;
            // typically by default width of render objects is parent.width
            // so we should set it to auto
            foreach (RenderObject ro in rt.Children)
            {
                ro.Width = Unit.Auto;
            }

            // add table to document
            doc.Body.Children.Add(rt);

            doc.Generate();
        }
Esempio n. 11
0
        private void button2_Click(object sender, EventArgs e)
        {
            doc.Clear();

            doc.Style.Font = new Font("Tahoma", 16);

            // add comment
            RenderParagraph desc = new RenderParagraph();

            desc.Content.Add(new ParagraphText(_desc2));
            desc.Style.Spacing.Bottom = "5mm"; // add empty space after comment
            desc.Style.BackColor      = Color.LightPink;
            doc.Body.Children.Add(desc);

            RenderTable table = CreateTable(4, 70, "Cell {0} {1} Cell Cell Cell Cell");

            table.Style.GridLines.All = LineDef.DefaultBold;
            table.StretchRows         = StretchTableEnum.LastVectorOnPage;
            doc.Body.Children.Add(table);

            doc.Generate();
        }
Esempio n. 12
0
        private void button3_Click(object sender, EventArgs e)
        {
            doc.Clear();

            // add comment
            RenderParagraph desc = new RenderParagraph();

            desc.Style.Font = new Font("Tahoma", 18);
            desc.Content.Add(new ParagraphText(_desc3));
            desc.Style.Spacing.Bottom = "5mm"; // add empty space after comment
            desc.Style.BackColor      = Color.LightPink;
            doc.Body.Children.Add(desc);

            RenderTable rt = new RenderTable();

            for (int r = 0; r < 5; r++)
            {
                for (int c = 0; c < 60; c++)
                {
                    rt.Cells[r, c].Text = string.Format("Cell {0}:{1}", r, c);
                }
            }
            // use not solid grid lines
            rt.Style.GridLines.All = new LineDef("1mm", Color.Gray, DashStyle.Dash);
            rt.Style.TextAngle     = 90;
            rt.ColumnSizingMode    = TableSizingModeEnum.Auto;
            rt.RowSizingMode       = TableSizingModeEnum.Fixed;
            rt.Width             = Unit.Auto;
            rt.Height            = "page.height - prev.height"; // table will use all available height on page
            rt.SplitHorzBehavior = SplitBehaviorEnum.SplitIfNeeded;
            foreach (RenderObject ro in rt.Children)
            {
                ro.Width = Unit.Auto;
            }
            doc.Body.Children.Add(rt);

            doc.Generate();
        }
Esempio n. 13
0
        private void MakeDoc1(C1PrintDocument doc)
        {
            doc.Style.Font = new Font("Tahoma", 16);

            RenderText rt = new RenderText();

            rt.Text =
                "The RenderText and RenderParagraph objects provide the TabPositions property " +
                "that allows to define the positions of tabs in the text. " +
                "This property works similar to tabs in MS Word. " +
                "The following text has 2 tab positions: in the middle of the page, and " +
                "at the right edge of the page.";
            rt.Style.Borders.Bottom = LineDef.DefaultBold;
            rt.Style.Spacing.Bottom = "3mm";
            rt.Style.TextAlignHorz  = AlignHorzEnum.Justify;
            doc.Body.Children.Add(rt);

            RenderParagraph rp = new RenderParagraph();

            // add the tab in the middle of object
            rp.TabPositions.Add(new C1.C1Preview.TabPosition("width / 2", TabAlignmentEnum.Center));
            // add the tab at the right edge of object
            rp.TabPositions.Add(new C1.C1Preview.TabPosition("width", TabAlignmentEnum.Right));
            for (int i = 0; i < 3; i++)
            {
                rp.Content.AddText("left text", Color.Red);
                rp.Content.AddText("\t");
                rp.Content.AddText("center text", Color.Green);
                rp.Content.AddText("\t");
                rp.Content.AddText("right text", Color.Blue);
                // forces a new line
                rp.Content.AddText("\r");
            }

            doc.Body.Children.Add(rp);
        }
Esempio n. 14
0
        private void MakeDoc1(C1PrintDocument doc)
        {
            // create the title of document
            RenderParagraph rp = new RenderParagraph();

            rp.Content.AddText("You can get coordinates and sizes of individual characters in a text block using the ");
            rp.Content.AddText("GetCharRect()", Color.Blue);
            rp.Content.AddText(" method of RenderText and RenderParagraph classes.\r\n");
            rp.Content.AddText("In the following example each character has a red rectangle drawn around it.");
            rp.Style.Font           = new Font("Verdana", 15);
            rp.Style.Spacing.Bottom = "3mm";
            rp.Style.Borders.Bottom = LineDef.DefaultBold;
            rp.Style.TextAlignHorz  = AlignHorzEnum.Justify;
            doc.Body.Children.Add(rp);

            rp            = new RenderParagraph();
            rp.Style.Font = new Font("Arial", 36);
            rp.Content.Add(new ParagraphText("Normal text", TextPositionEnum.Normal));
            rp.Content.Add(new ParagraphText("Super script text\r\n", TextPositionEnum.Superscript));
            rp.Content.Add(new ParagraphText("Sub script text\r\n", TextPositionEnum.Subscript));
            rp.Content.Add(new ParagraphText("Normal text. ", TextPositionEnum.Normal));
            rp.Content.Add(new ParagraphText("Sub script. ", TextPositionEnum.Subscript));
            rp.Content.Add(new ParagraphText("Super script. ", TextPositionEnum.Superscript));
            rp.Content.Add(new ParagraphText("Normal text.\r\n"));
            rp.Content.Add(new ParagraphText("Normal text Normal text Normal text Normal text Normal text Normal text Normal text Normal text."));
            doc.Body.Children.Add(rp);

            // To use the GetCharRect method, we must first generate
            // the document so that character positions are calculated.
            // The generation will be later repeated with drawing
            // red rectangles around the individual characters.
            doc.Generate();

            int textLength = rp.TextLength;
            // Fragments contain info about the rendered objects:
            // get the first fragment of rp object
            RenderParagraphFragment rpf = (RenderParagraphFragment)rp.Fragments[0];

            // go over all characters in the text
            for (int i = 0; i < textLength; ++i)
            {
                // get the coordinates of character,
                // they will be returned in C1PrintDocument.ResolvedUnit units
                RectangleD charRect = rpf.GetCharRect(i);

                // make a rectangle around the char
                RenderRectangle r = new RenderRectangle();
                // specify all coordinates of rectangle
                r.X      = new Unit(rpf.Bounds.Left + charRect.Left, doc.ResolvedUnit);
                r.Y      = new Unit(rpf.Bounds.Top + charRect.Top, doc.ResolvedUnit);
                r.Width  = new Unit(charRect.Width, doc.ResolvedUnit);
                r.Height = new Unit(charRect.Height, doc.ResolvedUnit);
                // set shape (rectangle) coordinates, they are specified
                // relative to object
                r.Rectangle.X      = 0;
                r.Rectangle.Y      = 0;
                r.Rectangle.Width  = r.Width;
                r.Rectangle.Height = r.Height;
                r.Style.ShapeLine  = new LineDef("1pt", Color.Red);
                // add the rectangle to the object
                doc.Body.Children.Add(r);
            }
        }
Esempio n. 15
0
        private void MakeDoc1(C1PrintDocument doc)
        {
            // create the document title
            RenderParagraph docTitle = new RenderParagraph();

            docTitle.Content.AddText("This document demonstates the use of ");
            docTitle.Content.AddText("RenderToc", Color.Blue);
            docTitle.Content.AddText(" object to create the table of content.");
            doc.Body.Children.Add(docTitle);

            // in this cycle we generate the document chapters, each chapter
            // has some parts, each chapter and part has an entry in the RenderToc object
            const int chapterCount = 10; // chapter count
            const int partCount    = 5;  // parts count

            // generate sample text that will serve as introduction to chapter
            StringBuilder chapterIntroduction = new StringBuilder("Introduction");

            for (int i = 0; i < 40; i++)
            {
                chapterIntroduction.Append(" introduction");
            }
            chapterIntroduction.Append(".\r\n");

            // generate sample text that will be displayed as content of part of chapter
            StringBuilder partContent = new StringBuilder("Content of part");

            for (int i = 0; i < 80; i++)
            {
                partContent.Append(" content of part");
            }
            partContent.Append(".\r\n");

            // create an instance of RenderToc object
            RenderToc toc = new RenderToc();

            toc.BreakAfter = BreakEnum.Page;

            // Create styles for chaprters and parts
            Style chapterTitleStyle = doc.Style.Children.Add();

            chapterTitleStyle.Font           = new Font("Verdana", 15, FontStyle.Bold);
            chapterTitleStyle.BackColor      = Color.LightSteelBlue;
            chapterTitleStyle.Spacing.Bottom = "5mm";
            Style partTitleStyle = doc.Style.Children.Add();

            partTitleStyle.Font           = new Font("Tahoma", 13);
            partTitleStyle.Spacing.Top    = "3mm";
            partTitleStyle.Spacing.Bottom = "1mm";

            // loop over chapters
            for (int c = 1; c < chapterCount; c++)
            {
                // each chapter will be represented as a RenderArea object
                RenderArea chapter = new RenderArea();
                if (c < chapterCount - 1)
                {
                    chapter.BreakAfter = BreakEnum.Page;
                }

                RenderText chapterTitle = new RenderText(string.Format("Chapter {0}", c), chapterTitleStyle);
                chapter.Children.Add(chapterTitle);
                chapter.Children.Add(new RenderText(chapterIntroduction.ToString(), AlignHorzEnum.Justify));

                // add item for the chapter to the RenderToc
                toc.AddItem(chapterTitle.Text, chapterTitle, 1);

                // loop over the current chapter's parts
                for (int p = 1; p < partCount; p++)
                {
                    RenderText partTitle = new RenderText(string.Format("Chapter {0} part {1}", c, p), partTitleStyle);
                    chapter.Children.Add(partTitle);
                    chapter.Children.Add(new RenderText(partContent.ToString(), AlignHorzEnum.Justify));

                    // add item for the chapter part to the RenderToc
                    toc.AddItem(string.Format("Part {0}", p), partTitle, 2);
                }

                // add the chapter to the document
                doc.Body.Children.Add(chapter);
            }

            // insert the RenderToc into the document immediatedly after the title
            doc.Body.Children.Insert(1, toc);
        }
Esempio n. 16
0
        private void RenderCode(string code)
        {
            // reinitialize
            c1PrintDocument1.Clear();
            c1PrintDocument1.Style.Font = new Font("Calibri", 10);
            c1PrintDocument1.PageLayout.PageSettings.TopMargin    = new Unit(.2, UnitTypeEnum.Inch);
            c1PrintDocument1.PageLayout.PageSettings.RightMargin  = new Unit(.2, UnitTypeEnum.Inch);
            c1PrintDocument1.PageLayout.PageSettings.BottomMargin = new Unit(.2, UnitTypeEnum.Inch);
            c1PrintDocument1.PageLayout.PageSettings.LeftMargin   = new Unit(.2, UnitTypeEnum.Inch);

            string[] lines = code.Split('\n');

            RenderParagraph par = new RenderParagraph();

            foreach (string line in lines)
            {
                //check for comments
                if (line.Contains("//") && !line.Contains("http"))
                {
                    string[] words = line.Split(new string[] { "//" }, 2, StringSplitOptions.None);
                    //string comment = line.Substring(line.LastIndexOf("//"));
                    if (words.Length >= 2)
                    {
                        RenderLine(par, words[0]);
                        words[1] = "//" + words[1];
                        par.Content.AddText(words[1], Color.Green);
                    }
                    else if (words.Length == 1)
                    {
                        words[0] = "//" + words[0];
                        par.Content.AddText(words[0], Color.Green);
                    }
                }
                //check for strings
                else if (line.Contains("\""))
                {
                    string[] words = line.Split('"');
                    if (words.Length >= 2)
                    {
                        for (int i = 0; i < words.Length; i += 2)
                        {
                            RenderLine(par, words[i]);
                            if ((i + 1) <= words.Length - 1)
                            {
                                words[i + 1] = "\"" + words[i + 1] + "\"";
                                par.Content.AddText(words[i + 1], Color.Maroon);
                            }
                        }
                    }
                }
                //check for reserved words
                else if (ContainsRWord(line))
                {
                    RenderLineWithRWords(par, line);
                }
                else
                {
                    par.Content.AddText(line);
                }
                //if (line == lines[31])
                // break;
            }
            c1PrintDocument1.Body.Children.Add(par);
            c1PrintDocument1.Generate();
#if (false) // for testing only
            c1PrintDocument1.Save(@"Test.c1d");
#endif
        }
Esempio n. 17
0
        /// <summary>
        /// Fills specified control with a Day style.
        /// </summary>
        /// <param name="doc"></param>
        public static void MakeDay(C1PrintDocument doc)
        {
            doc.Clear();

            doc.DocumentInfo.Title = "Daily style";
            doc.DocumentInfo.Subject = "Day";
            AddNamespaces(doc);

            AddHeadersFooters(doc);
            doc.Tags["FooterRight"].Value = "[GeneratedDateTime]";
            doc.Tags["DateHeadingsFont"].Value = new Font("Segoe UI", 24, FontStyle.Bold);

            doc.DocumentStartingScript +=
                "Dim tasksNumber As Integer = 0 \r\n" +
                "If Document.Tags!IncludeTasks.Value Then\r\n" +
                "   tasksNumber = tasksNumber + 1 \r\n" +
                "End If\r\n" +
                "If Document.Tags!IncludeBlankNotes.Value Then\r\n" +
                "   tasksNumber = tasksNumber + 1 \r\n" +
                "End If\r\n" +
                "If Document.Tags!IncludeLinedNotes.Value Then\r\n" +
                "   tasksNumber = tasksNumber + 1 \r\n" +
                "End If\r\n" +
                "If tasksNumber = 1 Then\r\n" +
                "   Document.Tags!TaskHeight.Value = New Unit(\"100%\")\r\n" +
                "ElseIf tasksNumber = 2 Then\r\n" +
                "   Document.Tags!TaskHeight.Value = New Unit(\"50%\")\r\n" +
                "Else\r\n" +
                "   Document.Tags!TaskHeight.Value = New Unit(\"33.3%\")\r\n" +
                "End If\r\n" +
                "Dim dateAppointments As New DateAppointmentsCollection(Tags!StartDate.Value, Tags!EndDate.Value, Tags!Appointments.Value, Tags!CalendarInfo.Value, True, True)\r\n" +
                "If Tags.IndexByName(\"DateAppointments\") = -1 Then\r\n" +
                "   Dim tagApps As Tag\r\n" +
                "   tagApps = New Tag(\"DateAppointments\", dateAppointments)\r\n" +
                "   tagApps.SerializeValue = False\r\n" +
                "   Tags.Add(tagApps)\r\n" +
                "Else\r\n" +
                "   Tags!DateAppointments.Value = dateAppointments\r\n" +
                "End If\r\n" +
                "Dim startT As Date = Tags!StartTime.Value  \r\n" +
                "Dim endT As Date = Tags!EndTime.Value  \r\n" +
                "If startT > endT Then\r\n" +
                "   Tags!StartTime.Value = endT \r\n" +
                "   Tags!EndTime.Value = startT \r\n" +
                "End If";

            // RenderArea representing the single page
            RenderArea raPage = new RenderArea();
            raPage.DataBinding.DataSource = new Expression("Document.Tags!DateAppointments.Value");
            raPage.DataBinding.Sorting.Expressions.Add("Fields!Date.Value");
            raPage.BreakBefore = BreakEnum.Page;
            raPage.Width = "100%";
            raPage.Height = "100%";
            raPage.Stacking = StackingRulesEnum.InlineLeftToRight;

            #region ** day header
            // day header
            RenderArea raDayHeader = new RenderArea();
            raDayHeader.Style.Borders.All = LineDef.Default;
            raDayHeader.Width = "100%";
            raDayHeader.Height = "28mm";
            raDayHeader.Stacking = StackingRulesEnum.InlineLeftToRight;

            RenderText rt = new RenderText("[CDate(Fields!Date.Value).ToString(\"D\", Document.Tags!CalendarInfo.Value.CultureInfo)]");
            rt.FormatDataBindingInstanceScript =
                "RenderObject.Style.Font = Document.Tags!DateHeadingsFont.Value\r\n" +
                "Dim startDate As Date = RenderObject.Original.Parent.Parent.DataBinding.Fields!Date.Value\r\n" +
                "Document.Tags!StartTime.Value = startDate.Add(Document.Tags!StartTime.Value.TimeOfDay)\r\n" +
                "Document.Tags!EndTime.Value = startDate.Add(Document.Tags!EndTime.Value.TimeOfDay)\r\n" +
                "Document.Tags!MonthCalendar.Value = New Date(startDate.Year, startDate.Month, 1) \r\n" +
                "startDate = Document.Tags!StartTime.Value\r\n" +
                "Document.Tags!DayHours.Value = New Dictionary(of Date, Date)\r\n" +
                "While startDate < Document.Tags!EndTime.Value\r\n" +
                "	Document.Tags!DayHours.Value.Add(startDate, startDate)\r\n" +
                "	startDate = startDate.AddMinutes(30)\r\n" +
                "End While";
            rt.Style.TextAlignVert = AlignVertEnum.Center;
            rt.Style.Spacing.Left = "2mm";
            rt.Height = "100%";
            rt.Width = "parent.Width - 38mm";

            raDayHeader.Children.Add(rt);

            RenderArea monthCalendar = new RenderArea();
            monthCalendar.Stacking = StackingRulesEnum.InlineLeftToRight;
            monthCalendar.Style.Spacing.Left = "1mm";
            monthCalendar.Style.Spacing.Right = "3mm";
            monthCalendar.Style.Spacing.Top = "0.5mm";
            monthCalendar.Width = "36mm";

            rt = new RenderText("[CDate(Document.Tags!MonthCalendar.Value).ToString(\"MMMM yyy\", Document.Tags!CalendarInfo.Value.CultureInfo)]");
            rt.FormatDataBindingInstanceScript =
                "Dim startDate As Date = Document.Tags!MonthCalendar.Value\r\n" +
                "Dim endDate As Date = startDate.AddMonths(1).AddDays(-1)\r\n" +
                "While startDate.DayOfWeek <> Document.Tags!CalendarInfo.Value.WeekStart \r\n" +
                "    startDate = startDate.AddDays(-1)\r\n" +
                "End While\r\n" +
                "Document.Tags!WeekNumber.Value = New List(of Date)\r\n" +
                "While startDate <= endDate\r\n" +
                "	Document.Tags!WeekNumber.Value.Add(startDate)\r\n" +
                "	startDate = startDate.AddDays(7)\r\n" +
                "End While";
            rt.Style.TextAlignHorz = AlignHorzEnum.Center;
            rt.Style.Font = new Font("Segoe UI", 8);
            rt.Width = "100%";
            monthCalendar.Children.Add(rt);

            rt = new RenderText(" ");
            rt.Style.Font = new Font("Arial", 7f);
            rt.Style.WordWrap = false;
            rt.Width = "12.5%";
            monthCalendar.Children.Add(rt);

            rt = new RenderText("[Document.Tags!CalendarInfo.Value.CultureInfo.DateTimeFormat.GetShortestDayName(CDate(Fields!Date.Value).DayOfWeek)]");
            rt.DataBinding.DataSource = new Expression("New DateAppointmentsCollection(Document.Tags!WeekNumber.Value(0), Document.Tags!WeekNumber.Value(0).AddDays(6), Document.Tags!Appointments.Value, True)");
            rt.DataBinding.Sorting.Expressions.Add("Fields!Date.Value");
            rt.Style.Borders.Bottom = LineDef.Default;
            rt.Style.Font = new Font("Arial", 7f);
            rt.Style.TextAlignHorz = AlignHorzEnum.Center;
            rt.Style.WordWrap = false;
            rt.Width = "12.5%";
            monthCalendar.Children.Add(rt);

            RenderArea raWeek = new RenderArea();
            raWeek.DataBinding.DataSource = new Expression("Document.Tags!WeekNumber.Value");
            raWeek.Style.Font = new Font("Arial", 7f);
            raWeek.Width = "100%";
            raWeek.Stacking = StackingRulesEnum.InlineLeftToRight;

            rt = new RenderText("[Document.Tags!CalendarInfo.Value.CultureInfo.Calendar.GetWeekOfYear(CDate(Fields!Date.Value), System.Globalization.CalendarWeekRule.FirstDay, Document.Tags!CalendarInfo.Value.WeekStart)]");
            rt.Style.Borders.Right = LineDef.Default;
            rt.Style.TextAlignHorz = AlignHorzEnum.Right;
            rt.Style.WordWrap = false;
            rt.Width = "12.5%";
            raWeek.Children.Add(rt);

            rt = new RenderText("[CDate(Fields!Date.Value).ToString(\"%d\", Document.Tags!CalendarInfo.Value.CultureInfo)]");
            rt.DataBinding.DataSource = new Expression("New DateAppointmentsCollection(Parent.Fields!Date.Value, CDate(Parent.Fields!Date.Value).AddDays(6), Document.Tags!Appointments.Value, True)");
            rt.DataBinding.Sorting.Expressions.Add("Fields!Date.Value");
            rt.FormatDataBindingInstanceScript =
                "If RenderObject.Original.DataBinding.Fields!Date.Value.Month <> Document.Tags!MonthCalendar.Value.Month Then\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Hidden\r\n" +
                "Else If RenderObject.Original.DataBinding.Fields!HasAppointments.Value Then\r\n" +
                "    RenderObject.Style.FontBold = true\r\n" +
                "End If";
            rt.Style.TextAlignHorz = AlignHorzEnum.Right;
            rt.Width = "12.5%";
            raWeek.Children.Add(rt);
            monthCalendar.Children.Add(raWeek);

            raDayHeader.Children.Add(monthCalendar);

            raPage.Children.Add(raDayHeader);
            #endregion

            #region ** day
            // day
            RenderArea raDayBody = new RenderArea();
            raDayBody.FormatDataBindingInstanceScript =
                "If Not (Document.Tags!IncludeTasks.Value Or Document.Tags!IncludeBlankNotes.Value Or Document.Tags!IncludeLinedNotes.Value) Then\r\n" +
                "    RenderObject.Width = \"100%\" \r\n" +
                "End If";
            raDayBody.Style.Spacing.Top = "0.5mm";
            raDayBody.Style.Borders.All = LineDef.Default;
            raDayBody.Width = "75%";
            raDayBody.Height = "parent.Height - 28mm";
            raDayBody.Stacking = StackingRulesEnum.BlockTopToBottom;

            #region ** all-day events
            // RenderArea representing the single day
            RenderArea raDay = new RenderArea();
            raDay.DataBinding.DataSource = new Expression("Document.Tags!DateAppointments.Value(Parent.Fields!Date.Value, CDate(Parent.Fields!Date.Value))");
            raDay.DataBinding.Sorting.Expressions.Add("Fields!Date.Value");
            raDay.Stacking = StackingRulesEnum.InlineLeftToRight;
            raDay.Height = "Auto";

            RenderText status = new RenderText(" ");
            status.FormatDataBindingInstanceScript =
                "If IsNothing(RenderObject.Original.DataBinding.Parent.Fields!BusyStatus.Value) Then\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Collapse\r\n" +
                "Else \r\n" +
                "    RenderObject.Style.Brush = RenderObject.Original.DataBinding.Parent.Fields!BusyStatus.Value.Brush.Brush \r\n" +
                "End If";
            status.Width = "100%";
            status.Height = "1.5mm";
            raDay.Children.Add(status);

            // RenderArea representing the single appointment
            RenderArea raApp = new RenderArea();
            raApp.Style.Spacing.All = "0.5mm";
            raApp.Style.Spacing.Left = "1.25cm";
            raApp.FormatDataBindingInstanceScript =
                "If RenderObject.Original.DataBinding.Fields!AllDayEvent.Value Then\r\n" +
                "    RenderObject.Style.Borders.All = LineDef.Default\r\n" +
                "ElseIf DateDiff(DateInterval.Second, CDate(Document.Tags!StartTime.Value), CDate(RenderObject.Original.DataBinding.Fields!Start.Value)) >= 0 Then\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Collapse\r\n" +
                "End If\r\n" +
                "If Not IsNothing(RenderObject.Original.DataBinding.Fields!Label.Value) Then\r\n" +
                "    RenderObject.Style.Brush = CType(RenderObject.Original.DataBinding.Fields!Label.Value, Label).Brush.Brush\r\n" +
                "End If";
            raApp.Stacking = StackingRulesEnum.InlineLeftToRight;
            // Set the text's data source to the data source of the containing  RenderArea - this indicates that the render object is bound to the current group in the specified object:
            raApp.DataBinding.DataSource = new Expression("Parent.Fields!Appointments.Value");
            raApp.DataBinding.Sorting.Expressions.Add("Fields!Start.Value");
            raApp.DataBinding.Sorting.Expressions.Add("Fields!Subject.Value");

            rt = new RenderText();
            rt.Text = "[IIf(DateDiff(DateInterval.Second, CDate(DataBinding.Parent.Fields!Date.Value), CDate(Fields!Start.Value)) < 0, \"> \", String.Empty) & " +
                "IIf(Fields!AllDayEvent.Value, \"\", String.Format(Document.Tags!CalendarInfo.Value.CultureInfo, \"{0:t} {1:t}\", " +
                "IIf(DateDiff(DateInterval.Second, CDate(DataBinding.Parent.Fields!Date.Value), CDate(Fields!Start.Value)) < 0, DataBinding.Parent.Fields!Date.Value, Fields!Start.Value), " +
                "IIf(DateDiff(DateInterval.Second, CDate(DataBinding.Parent.Fields!Date.Value.AddDays(1)), CDate(Fields!End.Value)) > 0, DataBinding.Parent.Fields!Date.Value.AddDays(1), Fields!End.Value)))]";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            rt = new RenderText();
            rt.Text = " [Fields!Subject.Value] ";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            rt = new RenderText();
            rt.FormatDataBindingInstanceScript =
                "RenderObject.Visibility = IIf(Not String.IsNullOrEmpty(RenderObject.Original.DataBinding.Parent.Fields!Location.Value), VisibilityEnum.Visible, VisibilityEnum.Collapse)";
            rt.Text = "[\" (\" & Fields!Location.Value & \")\"]";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            raDay.Children.Add(raApp);

            raDayBody.Children.Add(raDay);
            #endregion

            #region ** slots
            raDay = new RenderArea();
            raDay.DataBinding.DataSource = new Expression("Document.Tags!DateAppointments.Value(Parent.Fields!Date.Value, CDate(Parent.Fields!Date.Value))");
            raDay.DataBinding.Sorting.Expressions.Add("Fields!Date.Value");
            raDay.Stacking = StackingRulesEnum.InlineLeftToRight;
            raDay.Height = "parent - prev.height - next.height";

            RenderArea raTimeSlot = new RenderArea();
            raTimeSlot.FormatDataBindingInstanceScript =
                "RenderObject.Height = New Unit((100/CLng(Document.Tags!DayHours.Value.Count) - 0.005).ToString(\"#.###\", System.Globalization.CultureInfo.InvariantCulture) & \"%\")";
            raTimeSlot.DataBinding.DataSource = new Expression("Document.Tags!DayHours.Value");
            raTimeSlot.Width = "100%";
            raTimeSlot.Height = "0.5cm";
            raTimeSlot.Stacking = StackingRulesEnum.InlineLeftToRight;

            RenderParagraph rp = new RenderParagraph();
            rp.FormatDataBindingInstanceScript =
                "Document.Tags!SlotAppointments.Value = Document.Tags!DateAppointments.Value.GetIntervalAppointments(RenderObject.Original.DataBinding.Parent.Fields!Key.Value, RenderObject.Original.DataBinding.PArent.Fields!Key.Value.AddMinutes(30), False)\r\n" +
                "RenderObject.Visibility = IIf(RenderObject.Original.DataBinding.Parent.Fields!Key.Value.Minute = 0, VisibilityEnum.Visible, VisibilityEnum.Hidden)\r\n" +
                "Dim headerFont As Font = Document.Tags!DateHeadingsFont.Value\r\n" +
                "RenderObject.Style.Font = New Font(headerFont.FontFamily, headerFont.Size * 2 / 3)";
            rp.Width = "1.65cm";
            rp.Style.TextAlignHorz = AlignHorzEnum.Right;
            rp.Style.Borders.Top = LineDef.Default;
            rp.Style.Padding.Right = "1mm";
            rp.Height = "100%";
            ParagraphText pt = new ParagraphText("[IIf(String.IsNullOrEmpty(Document.Tags!CalendarInfo.Value.CultureInfo.DateTimeFormat.AMDesignator), CDate(Fields!Key.Value).ToString(\"%H\"), CDate(Fields!Key.Value).ToString(\"%h\"))]");
            pt.Style.FontBold = true;
            pt.Style.Padding.Right = "1mm";
            rp.Content.Add(pt);
            rp.Content.Add(new ParagraphText("[IIf(String.IsNullOrEmpty(Document.Tags!CalendarInfo.Value.CultureInfo.DateTimeFormat.AMDesignator), \"00\", CDate(Fields!Key.Value).ToString(\"tt\", Document.Tags!CalendarInfo.Value.CultureInfo).ToLower())]", TextPositionEnum.Superscript));
            raTimeSlot.Children.Add(rp);

            RenderArea slot = new RenderArea();
            slot.Width = "parent.width - prev.width - prev.left";
            slot.Height = "100%";
            slot.Style.Borders.Top = LineDef.Default;
            slot.Style.Borders.Left = LineDef.Default;
            slot.Stacking = StackingRulesEnum.InlineLeftToRight;

            // RenderArea representing the single appointment
            raApp = new RenderArea();
            // Set the text's data source to the data source of the containing  RenderArea - this indicates that the render object is bound to the current group in the specified object:
            raApp.DataBinding.DataSource = new Expression("Document.Tags!SlotAppointments.Value");
            raApp.DataBinding.Sorting.Expressions.Add("Fields!Start.Value");
            raApp.DataBinding.Sorting.Expressions.Add("Fields!Subject.Value");
            raApp.Style.Spacing.All = "0.5mm";
            raApp.FormatDataBindingInstanceScript =
                "RenderObject.Width = New Unit((100/CLng(Document.Tags!SlotAppointments.Value.Count) - 0.005).ToString(\"#.###\", System.Globalization.CultureInfo.InvariantCulture) & \"%\")\r\n" +
                "If Not IsNothing(RenderObject.Original.DataBinding.Fields!Label.Value) Then\r\n" +
                "    RenderObject.Style.Brush = CType(RenderObject.Original.DataBinding.Fields!Label.Value, Label).Brush.Brush\r\n" +
                "End If";
            raApp.Width = "10%";
            raApp.Height = "100%";
            raApp.Stacking = StackingRulesEnum.InlineLeftToRight;

            rt = new RenderText();
            rt.Text = "[String.Format(Document.Tags!CalendarInfo.Value.CultureInfo, \"{0:t}-{1:t}\", Fields!Start.Value, Fields!End.Value).ToLower()]";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            rt = new RenderText();
            rt.Text = " [Fields!Subject.Value] ";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            rt = new RenderText();
            rt.FormatDataBindingInstanceScript =
                "RenderObject.Visibility = IIf(Not String.IsNullOrEmpty(RenderObject.Original.DataBinding.Parent.Fields!Location.Value), VisibilityEnum.Visible, VisibilityEnum.Collapse)";
            rt.Text = "[\" (\" & Fields!Location.Value & \")\"]";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            slot.Children.Add(raApp);

            raTimeSlot.Children.Add(slot);

            raDay.Children.Add(raTimeSlot);
            raDayBody.Children.Add(raDay);
            #endregion

            #region ** late appointments
            raDay = new RenderArea();
            raDay.DataBinding.DataSource = new Expression("Document.Tags!DateAppointments.Value(Parent.Fields!Date.Value, CDate(Parent.Fields!Date.Value))");
            raDay.DataBinding.Sorting.Expressions.Add("Fields!Date.Value");
            raDay.Style.Borders.Top = LineDef.Default;
            raDay.Stacking = StackingRulesEnum.InlineLeftToRight;
            raDay.Height = "Auto";

            // RenderArea representing the single appointment
            raApp = new RenderArea();
            raApp.Style.Spacing.All = "0.5mm";
            raApp.Style.Spacing.Left = "1.25cm";
            raApp.FormatDataBindingInstanceScript =
                "If DateDiff(DateInterval.Second, CDate(Document.Tags!EndTime.Value), CDate(RenderObject.Original.DataBinding.Fields!Start.Value)) >= 0 Then\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Visible\r\n" +
                "Else\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Collapse\r\n" +
                "End If\r\n" +
                "If Not IsNothing(RenderObject.Original.DataBinding.Fields!Label.Value) Then\r\n" +
                "    RenderObject.Style.Brush = CType(RenderObject.Original.DataBinding.Fields!Label.Value, Label).Brush.Brush\r\n" +
                "End If";
            raApp.Stacking = StackingRulesEnum.InlineLeftToRight;
            // Set the text's data source to the data source of the containing  RenderArea - this indicates that the render object is bound to the current group in the specified object:
            raApp.DataBinding.DataSource = new Expression("Parent.Fields!Appointments.Value");
            raApp.DataBinding.Sorting.Expressions.Add("Fields!Start.Value");
            raApp.DataBinding.Sorting.Expressions.Add("Fields!Subject.Value");

            rt = new RenderText();
            rt.Text = "[IIf(DateDiff(DateInterval.Second, CDate(DataBinding.Parent.Fields!Date.Value), CDate(Fields!Start.Value)) < 0, \"> \", String.Empty) & " +
                "IIf(Fields!AllDayEvent.Value, \"\", String.Format(Document.Tags!CalendarInfo.Value.CultureInfo, \"{0:t} {1:t}\", " +
                "IIf(DateDiff(DateInterval.Second, CDate(DataBinding.Parent.Fields!Date.Value), CDate(Fields!Start.Value)) < 0, DataBinding.Parent.Fields!Date.Value, Fields!Start.Value), " +
                "IIf(DateDiff(DateInterval.Second, CDate(DataBinding.Parent.Fields!Date.Value.AddDays(1)), CDate(Fields!End.Value)) > 0, DataBinding.Parent.Fields!Date.Value.AddDays(1), Fields!End.Value)))]";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            rt = new RenderText();
            rt.Text = " [Fields!Subject.Value] ";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            rt = new RenderText();
            rt.FormatDataBindingInstanceScript =
                "RenderObject.Visibility = IIf(Not String.IsNullOrEmpty(RenderObject.Original.DataBinding.Parent.Fields!Location.Value), VisibilityEnum.Visible, VisibilityEnum.Collapse)";
            rt.Text = "[\" (\" & Fields!Location.Value & \")\"]";
            rt.Width = "Auto";
            raApp.Children.Add(rt);

            raDay.Children.Add(raApp);

            raDayBody.Children.Add(raDay);
            #endregion

            raPage.Children.Add(raDayBody);
            #endregion

            #region ** tasks
            // tasks
            RenderArea include = new RenderArea();
            include.FormatDataBindingInstanceScript =
                "If Document.Tags!IncludeTasks.Value Or Document.Tags!IncludeBlankNotes.Value Or Document.Tags!IncludeLinedNotes.Value Then\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Visible \r\n" +
                "Else\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Collapse \r\n" +
                "End If";
            include.Width = "25%";
            include.Height = "parent.Height - 28mm";

            RenderArea raTasks = new RenderArea();
            raTasks.FormatDataBindingInstanceScript =
                "If Not Document.Tags!IncludeTasks.Value Then\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Collapse \r\n" +
                "End If\r\n" +
                "RenderObject.Height = Document.Tags!TaskHeight.Value";
            raTasks.Style.Borders.All = LineDef.Default;
            raTasks.Style.Spacing.Top = "0.5mm";
            raTasks.Style.Spacing.Left = "0.5mm";
            raTasks.Width = "100%";

            rt = new RenderText();
            rt.Text = "Tasks";
            rt.Style.Padding.Left = "2mm";
            rt.Style.Borders.Bottom = LineDef.Default;
            raTasks.Children.Add(rt);
            include.Children.Add(raTasks);

            RenderArea raNotes = new RenderArea();
            raNotes.FormatDataBindingInstanceScript =
                "If Not Document.Tags!IncludeBlankNotes.Value Then\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Collapse \r\n" +
                "End If\r\n" +
                "RenderObject.Height = Document.Tags!TaskHeight.Value";
            raNotes.Style.Borders.All = LineDef.Default;
            raNotes.Style.Spacing.Top = "0.5mm";
            raNotes.Style.Spacing.Left = "0.5mm";
            raNotes.Width = "100%";

            rt = new RenderText();
            rt.Text = "Notes";
            rt.Style.Padding.Left = "2mm";
            rt.Style.Borders.Bottom = LineDef.Default;
            raNotes.Children.Add(rt);
            include.Children.Add(raNotes);

            raNotes = new RenderArea();
            raNotes.FormatDataBindingInstanceScript =
                "If Not Document.Tags!IncludeLinedNotes.Value Then\r\n" +
                "    RenderObject.Visibility = VisibilityEnum.Collapse \r\n" +
                "End If\r\n" +
                "RenderObject.Height = Document.Tags!TaskHeight.Value";
            raNotes.Style.Borders.All = LineDef.Default;
            raNotes.Style.Spacing.Top = "0.5mm";
            raNotes.Style.Spacing.Left = "0.5mm";
            raNotes.Width = "100%";

            rt = new RenderText();
            rt.Text = "Notes";
            rt.Style.Padding.Left = "2mm";
            rt.Style.Borders.Bottom = LineDef.Default;
            raNotes.Children.Add(rt);

            RenderTable lines = new RenderTable();
            lines.Rows.Insert(0, 1);
            lines.Rows[0].Height = "0.5cm";
            TableVectorGroup gr = lines.RowGroups[0, 1];
            gr.Header = TableHeaderEnum.None;
            List<int> lst = new List<int>(60);
            for (int i = 0; i < 60; i++)
            {
                lst.Add(i);
            }
            gr.DataBinding.DataSource = lst;
            lines.Style.GridLines.Horz = LineDef.Default;
            lines.RowSizingMode = TableSizingModeEnum.Fixed;

            raNotes.Children.Add(lines);

            include.Children.Add(raNotes);

            raPage.Children.Add(include);
            #endregion

            doc.Body.Children.Add(raPage);

            AddCommonTags(doc);

            Tag newTag = new Tag("Appointments", null, typeof(IList<Appointment>));
            newTag.ShowInDialog = false;
            newTag.SerializeValue = false;
            doc.Tags.Add(newTag);
            newTag = new Tag("WeekNumber", null, typeof(List<DateTime>));
            newTag.SerializeValue = false;
            newTag.ShowInDialog = false;
            doc.Tags.Add(newTag);
            newTag = new Tag("DayHours", null, typeof(Dictionary<DateTime, DateTime>));
            newTag.SerializeValue = false;
            newTag.ShowInDialog = false;
            doc.Tags.Add(newTag);
            newTag = new Tag("MonthCalendar", null, typeof(DateTime));
            newTag.ShowInDialog = false;
            doc.Tags.Add(newTag);
            newTag = new Tag("StartDate", DateTime.Today, typeof(DateTime));
            newTag.InputParams = new TagDateTimeInputParams();
            doc.Tags.Add(newTag);
            newTag = new Tag("EndDate", DateTime.Today.AddDays(1), typeof(DateTime));
            newTag.InputParams = new TagDateTimeInputParams();
            doc.Tags.Add(newTag);

            newTag = new Tag("StartTime", DateTime.Today.AddHours(7), typeof(DateTime));
            newTag.InputParams = new TagDateTimeInputParams();
            ((TagDateTimeInputParams)newTag.InputParams).Format = DateTimePickerFormat.Time;
            doc.Tags.Add(newTag);
            newTag = new Tag("EndTime", DateTime.Today.AddHours(19), typeof(DateTime));
            newTag.InputParams = new TagDateTimeInputParams();
            ((TagDateTimeInputParams)newTag.InputParams).Format = DateTimePickerFormat.Time;
            doc.Tags.Add(newTag);

            newTag = new Tag("HidePrivateAppointments", false, typeof(bool));
            newTag.ShowInDialog = false;
            doc.Tags.Add(newTag);
            newTag = new Tag("TaskHeight", new Unit("33.3%"), typeof(Unit));
            newTag.ShowInDialog = false;
            doc.Tags.Add(newTag);
            newTag = new Tag("SlotAppointments", null, typeof(List<Appointment>));
            newTag.SerializeValue = false;
            newTag.ShowInDialog = false;
            doc.Tags.Add(newTag);

            newTag = new Tag("IncludeTasks", false, typeof(bool));
            newTag.ShowInDialog = true;
            newTag.InputParams = new TagBoolInputParams();
            newTag.Description = "Include Tasks";
            doc.Tags.Add(newTag);
            newTag = new Tag("IncludeBlankNotes", false, typeof(bool));
            newTag.ShowInDialog = true;
            newTag.InputParams = new TagBoolInputParams();
            newTag.Description = "Include Notes (blank)";
            doc.Tags.Add(newTag);
            newTag = new Tag("IncludeLinedNotes", false, typeof(bool));
            newTag.ShowInDialog = true;
            newTag.InputParams = new TagBoolInputParams();
            newTag.Description = "Include Notes (lined)";
            doc.Tags.Add(newTag);
        }
Esempio n. 18
0
        static public C1PrintDocument TextStyles()
        {
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();

            RenderText rtxt = new RenderText(doc);

            rtxt.Text                = "Text styles in C1PrintDocument";
            rtxt.Style.FontName      = "Arial";
            rtxt.Style.FontSize      = 18;
            rtxt.Style.FontBold      = true;
            rtxt.Style.TextAlignHorz = AlignHorzEnum.Center;
            rtxt.Style.Padding.All   = new Unit("5mm");
            doc.Body.Children.Add(rtxt);

            // setup some text styles
            Style s1 = doc.Style.Children.Add();

            s1.TextColor = Colors.Blue;
            s1.FontBold  = true;

            Style s2 = doc.Style.Children.Add();

            s2.BackColor = Colors.Chartreuse;

            Style s3 = doc.Style.Children.Add();

            s3.TextColor = Colors.Red;

            Style s4 = doc.Style.Children.Add();

            s4.FontName   = "Arial";
            s4.FontSize   = 14;
            s4.FontBold   = true;
            s4.FontItalic = true;

            Style s5 = doc.Style.Children.Add();

            s5.BackColor = s2.BackColor;
            s5.TextColor = s3.TextColor;
            s5.Font      = s4.Font;

            RenderParagraph rp = new RenderParagraph(doc);

            ParagraphObject po = new ParagraphText("In ");

            rp.Content.Add(po);
            po = new ParagraphText("C1PrintDocument");
            po.Style.AssignNonInheritedFrom(s1);
            rp.Content.Add(po);
            rp.Content.Add(new ParagraphText(", multi-style text is fully supported via "));
            rp.Content.Add(new ParagraphText("RenderParagraph", Colors.Blue));
            rp.Content.Add(new ParagraphText(" render objects."));

            rp.Content.Add(new ParagraphText("\rWithin a single paragraph, you can change "));

            po = new ParagraphText("background color,");
            po.Style.Parent = s2;
            rp.Content.Add(po);

            po = new ParagraphText(" text color,");
            po.Style.AssignNonInheritedFrom(s3);
            rp.Content.Add(po);

            po = new ParagraphText(" font,");
            po.Style.AssignNonInheritedFrom(s4);
            rp.Content.Add(po);

            po = new ParagraphText(" or all together.");
            po.Style.AssignNonInheritedFrom(s5);
            rp.Content.Add(po);

            rp.Content.Add(new ParagraphText("\rFont sub-properties such as "));
            rp.Content.Add(new ParagraphText("bold, "));
            rp.Content[rp.Content.Count - 1].Style.FontBold = true;
            rp.Content.Add(new ParagraphText("italic "));
            rp.Content[rp.Content.Count - 1].Style.FontItalic = true;
            rp.Content.Add(new ParagraphText("or "));
            rp.Content.Add(new ParagraphText("underline"));
            rp.Content[rp.Content.Count - 1].Style.FontUnderline = true;
            rp.Content.Add(new ParagraphText(" can be individually adjusted."));

            rp.Content.Add(new ParagraphText("\rText positions such as "));
            rp.Content.Add(new ParagraphText("superscript", TextPositionEnum.Superscript));
            rp.Content.Add(new ParagraphText(" and "));
            rp.Content.Add(new ParagraphText("subscript", TextPositionEnum.Subscript));
            rp.Content.Add(new ParagraphText(" are supported."));

            po = new ParagraphText("\rInline images ");
            rp.Content.Add(po);
            System.Drawing.Image inlineImage = System.Drawing.Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DemoTables.check.png"));
            po = new ParagraphImage(inlineImage);
            rp.Content.Add(po);
            po = new ParagraphText(" can be embedded in the text as well.");
            rp.Content.Add(po);

            doc.Body.Children.Add(rp);

            return(doc);
        }
Esempio n. 19
0
        /// <summary>
        /// Creates a document where almost all RenderObject types provided by C1Preview
        /// are used/demonstrated.
        /// </summary>
        /// <param name="doc">The document to add render objects to.</param>
        private void MakeDoc1(C1PrintDocument doc)
        {
            // clear the document
            doc.Clear();

            // Set up basic page headers and footers:
            doc.PageLayout.PageHeader = new RenderText("RenderObjects sample");
            doc.PageLayout.PageHeader.Style.TextAlignHorz  = AlignHorzEnum.Right;
            doc.PageLayout.PageHeader.Style.Spacing.Bottom = "0.5cm";
            doc.PageLayout.PageHeader.Style.Borders.Bottom = LineDef.Default;

            doc.PageLayout.PageFooter = new RenderText("Page [PageNo] of [PageCount]");
            doc.PageLayout.PageFooter.Style.TextAlignHorz = AlignHorzEnum.Right;
            doc.PageLayout.PageFooter.Style.Spacing.Top   = "0.5cm";
            doc.PageLayout.PageFooter.Style.Borders.Top   = LineDef.Default;


            //-------------
            // RenderArea
            //-------------
            // The general purpose container for other render objects
            // We create an area for a few RenderText objects,
            // and add it to another are which is a container for all elements in the document:
            RenderArea ra1 = new RenderArea();

            RenderArea ra2 = new RenderArea();

            // set the back color for the area so its bounds are visible
            ra2.Style.BackColor = Color.AntiqueWhite;
            // keep the area to 60% of its parent's width
            ra2.Width = "60%";

            // Add the area which will hold the render texts, to
            // the bigger area which will hold all else
            ra1.Children.Add(ra2);

            //-------------
            // RenderText
            //-------------
            // Allows to output a block of text in a single style
            // we also create an outline entry for each RenderText

            // plain text using the default style
            RenderText rt1 = new RenderText(strings.APOLOGIZE);

            doc.Outlines.Add("APOLOGIZE", rt1);

            // different font and color
            RenderText rt2 = new RenderText(strings.APPEAL, new Font("Arial", 16), Color.BlueViolet);

            doc.Outlines.Add("APPEAL", rt2);

            // right-alignged text
            RenderText rt3 = new RenderText(strings.BAROMETER, AlignHorzEnum.Right);

            doc.Outlines.Add("BAROMETER", rt3);

            // justified text in a different font
            RenderText rt4 = new RenderText(strings.BOTANY, new Font("Times New Roman", 14), AlignHorzEnum.Justify);

            doc.Outlines.Add("BOTANY", rt4);

            // text with a different style
            // styles can only exist on an object or as child styles of another style
            Style s1 = doc.Style.Children.Add();

            s1.BackColor   = Color.Chartreuse;
            s1.Padding.All = new Unit("3mm");
            s1.LineSpacing = 120;
            RenderText rt5 = new RenderText(strings.CALAMITY, s1);

            doc.Outlines.Add("CALAMITY", rt5);

            // add RenderText's to the nested area
            ra2.Children.Add(rt1);
            ra2.Children.Add(rt2);
            ra2.Children.Add(rt3);
            ra2.Children.Add(rt4);
            ra2.Children.Add(rt5);

            //---------------
            // RenderGraphics
            //---------------
            // Allows to insert arbitrary GDI+ drawings in the document
            // Note that RenderGraphics' size is by default automatically adjusted
            // to the actual size of the drawing.
            RenderGraphics rg1 = new RenderGraphics();

            rg1.Graphics.DrawArc(Pens.Red,
                                 new Rectangle(0, 0, 30, 40), 0, 135);
            rg1.Graphics.DrawEllipse(Pens.Blue, new Rectangle(20, 20, 90, 45));
            rg1.Style.Borders.All = new LineDef("1mm", Color.CornflowerBlue);
            ra1.Children.Add(rg1);
            // provide an outline entry for the RenderGraphics
            doc.Outlines.Add("RenderGraphics", rg1);

            //-------------
            // RenderEmpty
            //-------------
            // Allows to insert breaks in arbitrary locations w/out affecting other render objects
            RenderEmpty re1 = new RenderEmpty();

            re1.BreakAfter = BreakEnum.Column;
            ra1.Children.Add(re1);

            //---------------
            // RenderImage
            //---------------
            // Allows to insert images in the document. Again, by default the size
            // is determined by the size of the image
            RenderImage ri1 = new RenderImage(Image.FromStream(
                                                  GetType().Assembly.GetManifestResourceStream("RenderObjects.tn_img70.jpg")));

            ra1.Children.Add(ri1);
            doc.Outlines.Add("RenderImage", ri1);

            //---------------
            // RenderRichText
            //---------------
            // Allows to insert RTF in the document
            TextReader tr = new StreamReader(
                GetType().Assembly.GetManifestResourceStream("RenderObjects.Rich_Text_Format.rtf"));
            RenderRichText rrt1 = new RenderRichText(tr.ReadToEnd());

            tr.Close();
            ra1.Children.Add(rrt1);
            doc.Outlines.Add("RenderRichText", rrt1);

            //--------------
            // RenderPolygon
            //--------------
            // A bunch of classes derived from RenderShapeBase provide shapes -
            // lines, polygons and rectangles. Here we draw a polygon:
            RenderPolygon rpoly1 = new RenderPolygon();

            rpoly1.Line.Points = new UnitPoint[] {
                new UnitPoint("0.5cm", "0.5cm"),
                new UnitPoint("2.0cm", "1cm"),
                new UnitPoint("3.5cm", "0cm"),
                new UnitPoint("6cm", "4cm"),
                new UnitPoint("3cm", "5cm")
            };
            rpoly1.Line.Closed = true;
            // set the fill color
            rpoly1.Style.ShapeFillColor = Color.Gainsboro;
            // pad on all sides, otherwise corners may end up outside of the
            // RenderPolygon area and get clipped:
            rpoly1.Style.Padding.All = "0.5cm";
            rpoly1.Style.BackColor   = Color.Cornsilk;
            ra1.Children.Add(rpoly1);
            doc.Outlines.Add("RenderPolygon", rpoly1);

            //------------
            // RenderTable
            //------------
            // Allows to draw tables. Tables are very powerful and can be used
            // both for data presentation and as layout tools. Here we show
            // some very basic tables functionality:
            RenderTable rtbl1 = new RenderTable();

            // tables are logically infinte, just touching a cell creates it:
            for (int row = 0; row < 100; ++row)
            {
                for (int col = 0; col < 4; ++col)
                {
                    rtbl1.Cells[row, col].Text = string.Format("Cell ({0}, {1})", row, col);
                }
            }
            // column (see below, in headers) and row spans are supported,
            // as alignment within cells, borders around cells and more:
            rtbl1.Cells[8, 1].SpanRows            = 6;
            rtbl1.Cells[8, 1].Style.BackColor     = Color.Gold;
            rtbl1.Cells[8, 1].Style.TextAlignVert = AlignVertEnum.Center;
            rtbl1.Cells[8, 1].Style.TextAlignHorz = AlignHorzEnum.Center;
            rtbl1.Cells[8, 1].Style.Borders.All   = LineDef.DefaultBold;

            // table header is just a flag on some rows:
            rtbl1.Rows.Insert(0, 1);
            rtbl1.RowGroups[0, 1].PageHeader      = true;
            rtbl1.Cells[0, 0].SpanCols            = rtbl1.Cols.Count;
            rtbl1.Cells[0, 0].Text                = "This is table header";
            rtbl1.Cells[0, 0].Style.TextAlignHorz = AlignHorzEnum.Center;
            rtbl1.Cells[0, 0].Style.BackColor     = Color.LemonChiffon;
            // ditto for the table footer:
            // (again, just touching a row adds it):
            int n = rtbl1.Rows.Count;

            rtbl1.RowGroups[n, 1].PageFooter      = true;
            rtbl1.Cells[n, 0].SpanCols            = rtbl1.Cols.Count;
            rtbl1.Cells[n, 0].Text                = "This is table footer";
            rtbl1.Cells[n, 0].Style.TextAlignHorz = AlignHorzEnum.Center;
            rtbl1.Cells[n, 0].Style.BackColor     = Color.LemonChiffon;
            // by default, tables have no grid lines. add some:
            rtbl1.Style.GridLines.All = LineDef.Default;

            // Using RenderEmpty, we can add outline nodes to start and end of table:
            RenderEmpty rtbl1Beg = new RenderEmpty();
            RenderEmpty rtbl1End = new RenderEmpty();

            ra1.Children.Add(rtbl1Beg);
            ra1.Children.Add(rtbl1);
            ra1.Children.Add(rtbl1End);
            doc.Outlines.Add("Table - first row", rtbl1Beg);
            doc.Outlines.Add("Table - last row", rtbl1End);

            //---------------
            // RenderParagraph
            //---------------
            // Allows to render milti-line text, inline images, and hyperlinks within text
            // Create paragraph
            RenderParagraph rpar1 = new RenderParagraph();
            Font            f     = new Font(rpar1.Style.Font, FontStyle.Bold);

            rpar1.Content.AddText("This is a paragraph. This is normal text. ");
            rpar1.Content.AddText("This text is bold. ", f);
            rpar1.Content.AddText("This text is red. ", Color.Red);
            rpar1.Content.AddText("This text is superscript. ",
                                  TextPositionEnum.Superscript);
            rpar1.Content.AddText("This text is bold and red. ", f, Color.Red);
            rpar1.Content.AddText("This text is bold and red and subscript. ",
                                  f, Color.Red, TextPositionEnum.Subscript);
            rpar1.Content.AddText("This is normal text again. ");
            rpar1.Content.AddHyperlink(
                "This is a link to the start of the document.",
                ra1);
            rpar1.Content.AddText("Finally, here is an inline image: ");
            rpar1.Content.AddImage(this.Icon.ToBitmap());
            rpar1.Content.AddText(".");
            // Add paragraph to the area
            ra1.Children.Add(rpar1);
            // and an outline entry to point to it:
            doc.Outlines.Add("RenderParagraph", rpar1);

            // we're done. Add the outer RenderArea to the document:
            doc.Body.Children.Add(ra1);
        }
Esempio n. 20
0
        private C1.C1Preview.C1PrintDocument makeDoc_TextStyles()
        {
            C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();

            RenderText rtxt = new RenderText(doc);

            rtxt.Text                = "Text styles in the new C1PrintDocument";
            rtxt.Style.Font          = new Font("Arial", 18, FontStyle.Bold);
            rtxt.Style.TextAlignHorz = AlignHorzEnum.Center;
            rtxt.Style.Padding.All   = new Unit("5mm");
            doc.Body.Children.Add(rtxt);

            // setup some text styles
            Style s1 = doc.Style.Children.Add();

            s1.TextColor = Color.Blue;
            s1.Font      = new Font(s1.Font, FontStyle.Bold);

            Style s2 = doc.Style.Children.Add();

            s2.BackColor = Color.Chartreuse;

            Style s3 = doc.Style.Children.Add();

            s3.TextColor = Color.Red;

            Style s4 = doc.Style.Children.Add();

            s4.Font = new Font("Arial", 14, FontStyle.Bold | FontStyle.Italic);

            Style s5 = doc.Style.Children.Add();

            s5.BackColor = s2.BackColor;
            s5.TextColor = s3.TextColor;
            s5.Font      = s4.Font;


            RenderParagraph rp = new RenderParagraph(doc);

            ParagraphObject po = new ParagraphText("In the new ");

            rp.Content.Add(po);
            po = new ParagraphText("C1PrintDocument");
            po.Style.AssignNonInheritedFrom(s1);
            rp.Content.Add(po);
            po = new ParagraphText(" multi-style text is fully supported. You can change ", TextPositionEnum.Normal);
            rp.Content.Add(po);

            po = new ParagraphText("the background color,");
            // po.Style.AssignNonInheritedFrom(s2);
            po.Style.Parent = s2;
            rp.Content.Add(po);

            po = new ParagraphText(" text color,");
            po.Style.AssignNonInheritedFrom(s3);
            rp.Content.Add(po);

            po = new ParagraphText(" font,");
            po.Style.AssignNonInheritedFrom(s4);
            rp.Content.Add(po);

            po = new ParagraphText(" or all together.");
            po.Style.AssignNonInheritedFrom(s5);
            rp.Content.Add(po);

            po = new ParagraphText(" Superscript", TextPositionEnum.Superscript);
            rp.Content.Add(po);

            po = new ParagraphText(" and ");
            rp.Content.Add(po);

            po = new ParagraphText("Subscript", TextPositionEnum.Subscript);
            rp.Content.Add(po);

            po = new ParagraphText(" text can be rendered.");
            rp.Content.Add(po);

            po = new ParagraphText(" Additionally, images ");
            rp.Content.Add(po);
            po = new ParagraphImage(pictureBox2.Image);
            rp.Content.Add(po);
            po = new ParagraphText(" can be embedded in the text as well.");
            rp.Content.Add(po);

            doc.Body.Children.Add(rp);

            return(doc);
        }
Esempio n. 21
0
        private void MakeDoc1(C1PrintDocument doc)
        {
            doc.Style.Font = new Font("Verdana", 14);

            // create the title of the document
            RenderParagraph title = new RenderParagraph();

            title.Content.AddText("The new version of C1PrintDocumet provides the ");
            title.Content.AddText("PageLayouts", Color.Blue);
            title.Content.AddText(" property allowing to define separate page layouts for the first page, even pages, and odd pages.");
            title.Style.TextAlignHorz  = AlignHorzEnum.Justify;
            title.Style.Borders.Bottom = new LineDef("1mm", Color.Black);
            doc.Body.Children.Add(title);

            // define PageLayout for the first page
            PageLayout pl = new PageLayout();

            pl.PageSettings           = new C1PageSettings();
            pl.PageSettings.PaperKind = PaperKind.Legal;
            doc.PageLayouts.FirstPage = pl;

            // define PageLayout for even pages
            pl = new PageLayout();
            pl.PageSettings           = new C1PageSettings();
            pl.PageSettings.PaperKind = PaperKind.Letter;
            // create the page header
            RenderText ph = new RenderText();

            ph.Text = "Even page. [PageNo] / [PageCount]";
            ph.Style.Borders.All = LineDef.Default;
            ph.Style.BackColor   = Color.Beige;
            pl.PageHeader        = ph;
            // even pages will have no page footer, set it to an empty object
            pl.PageFooter             = new RenderEmpty();
            doc.PageLayouts.EvenPages = pl;

            // define PageLayout for odd pages
            pl = new PageLayout();
            // odd pages will have 2 columns
            pl.Columns.Add();
            pl.Columns.Add();
            pl.PageSettings           = new C1PageSettings();
            pl.PageSettings.PaperKind = PaperKind.Letter;
            pl.PageSettings.Landscape = true;
            // create the page header
            ph      = new RenderText();
            ph.Text = "Odd page. [PageNo] / [PageCount]";
            ph.Style.Borders.All = LineDef.DefaultBold;
            ph.Style.BackColor   = Color.LightSeaGreen;
            pl.PageHeader        = ph;
            // create the page footer
            RenderText pf = new RenderText();

            pf.Text = "Footer of odd page. [PageNo] / [PageCount]";
            pf.Style.Borders.All     = LineDef.DefaultBold;
            pf.Style.BackColor       = Color.SlateGray;
            pl.PageFooter            = pf;
            doc.PageLayouts.OddPages = pl;

            // generate the content of document
            RenderText ro = new RenderText("This is the first page of the document. It has no page header or footer, and has Legal size.");

            ro.BreakAfter = BreakEnum.Page;
            doc.Body.Children.Add(ro);

            //
            string text = "This is the house  that Jack  built.  " +
                          "This is the carrot,  " +
                          "That lay in the house  that Jack  built.  " +
                          "This is the rat,  " +
                          "That ate the carrot,  " +
                          "That lay in the house  that Jack  built.  " +
                          "This is the cat,  " +
                          "That chased the rat , that ate the carrot,  " +
                          "That lay in the house  that Jack  built.  " +
                          "This is the dog  that worried the cat,  " +
                          "That chased the rat , that ate the carrot,  " +
                          "That lay in the house  that Jack  built.  " +
                          "This is the cow  with the crumbled horn, " +
                          "That tossed the dog , that worried the cat,  " +
                          "That chased the rat , that ate the carrot,  " +
                          "That lay in the house  that Jack  built.  " +
                          "This is the maiden  all forlorn,  " +
                          "That milked  the cow  with the crumbled horn, " +
                          "That tossed the dog , that worried the cat,  " +
                          "That chased the rat , that ate the carrot,  " +
                          "That lay in the house  that Jack  built.   " +
                          "This is the man  all tattered and torn, " +
                          "That kissed  the maiden  all forlorn,  " +
                          "That milked  the cow  with the crumbled horn, " +
                          "That tossed the dog , that worried the cat,  " +
                          "That chased the rat , that ate the carrot,  " +
                          "That lay in the house  that Jack  built.  " +
                          "This is the priest  all shaven and shorn, " +
                          "That married the man  all tattered and torn, " +
                          "That kissed  the maiden  all forlorn,  " +
                          "That milked  the cow  with the crumbled horn, " +
                          "That tossed the dog , that worried the cat,  " +
                          "That chased the rat , that ate the carrot,  " +
                          "That lay in the house  that Jack  built.  " +
                          "This is the c**k  that crowed  in the morn,  " +
                          "That waked the priest  all shaven and shorn, " +
                          "That married the man  all tattered and torn, " +
                          "That kissed  the maiden  all forlorn,  " +
                          "That milked  the cow  with the crumbled horn, " +
                          "That tossed the dog , that worried the cat,  " +
                          "That chased the rat , that ate the carrot,  " +
                          "That lay in the house  that Jack  built.  " +
                          "This is the farmer  sowing the corn,   " +
                          "That kept the c**k  that crowed  in the morn,   " +
                          "That waked the priest  all shaven and shorn, " +
                          "That married the man  all tattered and torn, " +
                          "That kissed  the maiden  all forlorn,  " +
                          "That milked  the cow  with the crumbled horn, " +
                          "That tossed the dog , that worried the cat,  " +
                          "That chased the rat , that ate the carrot,  " +
                          "That lay in the house  that Jack  built.  ";

            for (int i = 0; i < 5; ++i)
            {
                doc.Body.Children.Add(new RenderText(text, AlignHorzEnum.Justify));
            }
        }
Esempio n. 22
0
        private void CreateDoc(C1PrintDocument doc)
        {
            doc.Clear();

            doc.PageLayout.PageSettings.Landscape = true;

            Style codeStyle = doc.Style.Children.Add();

            codeStyle.Font = new Font("Courier New", 12);
            Style captionStyle = doc.Style.Children.Add();

            captionStyle.Font = new Font("Tahoma", 18, FontStyle.Bold);

            RenderParagraph rp = new RenderParagraph();

            rp.Style.Borders.All = new LineDef("1mm", Color.Blue);
            rp.Style.BackColor   = Color.LightBlue;
            rp.Style.Font        = new Font("Tahoma", 16);
            rp.Content.Add(new ParagraphText("This sample demostrates using of HyperlinkPageNo tag\r\r", captionStyle));
            rp.Content.Add(new ParagraphText("It returns number of page that hyperlink points. For example:\r\r"));
            rp.Content.Add(new ParagraphText("rt = new RenderText();\r", codeStyle));
            rp.Content.Add(new ParagraphText("rt.Text = \"(C1LinkTargetDocumentLocation) Goto page: [HyperlinkPageNo]\";\r", codeStyle));
            rp.Content.Add(new ParagraphText("rt.Hyperlink = new C1Hyperlink(new C1LinkTargetDocumentLocation(rt2));\r", codeStyle));
            rp.Content.Add(new ParagraphText("rt.Style.Borders.All = LineDef.Default;\r", codeStyle));
            rp.Content.Add(new ParagraphText("doc.Body.Children.Add(rt);", codeStyle));
            rp.Content.Add(new ParagraphText("\r\rTag HyperlinkPageNo will be replaced with number of page where object rt2 is.\r"));
            rp.Content.Add(new ParagraphText("It must be taken into consideration that when the document is being resolved, it is not always possible to evaluate HyperlinkPageNo (e.g. if it references an object that has not been resolved yet). "));
            rp.Content.Add(new ParagraphText("In such cases, if the object contains many HyperlinkPageNo tags and has auto width and/or height, the calculated size may differ from the correct size as instead of actual page numbers, the string \"XXX\" is used for size calculation.\r"));
            rp.Content.Add(new ParagraphText("To minimize such errors::\r"));
            rp.Content.Add(new ParagraphText("- use absolute sizes for such objets;\r"));
            rp.Content.Add(new ParagraphText("- place hyperlinks after the objects they reference.\r\r"));
            rp.Content.Add(new ParagraphText("In this sample, the document contains two RenderParagraph objects, each of which has HyperlinkPageNo tags. "));
            rp.Content.Add(new ParagraphText("The first paragraph is placed before the table, and hence its size is slightly bigger. The other paragraph follows the table and hence its size is exactly right."));
            doc.Body.Children.Add(rp);

            doc.Style.Font = new Font("Tahoma", 16);

            // generate siple table (3 x 100)
            RenderTable rt = new RenderTable();

            for (int r = 0; r < 100; r++)
            {
                for (int c = 0; c < 3; c++)
                {
                    rt.Cells[r, c].Text = string.Format("Cell {0}:{1}", r, c);
                }
            }
            rt.Style.GridLines.All = LineDef.DefaultBold;

            // generate RenderParagraph with hyperlinks
            rp = new RenderParagraph();
            rp.Style.Borders.All = new LineDef("1mm", Color.Red);
            rp.Style.Spacing.All = "5mm";
            rp.Style.Padding.All = "1mm";
            rp.RepeatBordersVert = true;
            rp.Content.Add(new ParagraphText("Content:\r\r", new Font("Verdana", 20)));
            for (int r = 0; r < rt.Rows.Count; r++)
            {
                ParagraphText pt = new ParagraphText(string.Format("Row{0} ([HyperlinkPageNo])", r));
                pt.Hyperlink = new C1Hyperlink(new C1LinkTargetDocumentLocation(rt.Cells[r, 0]));
                rp.Content.Add(pt);
                if (r < rt.Rows.Count - 1)
                {
                    rp.Content.Add(new ParagraphText(", "));
                }
            }
            // add paragraph into document BEFORE table
            doc.Body.Children.Add(rp);
            // add table
            doc.Body.Children.Add(rt);

            // add paragraph into document AFTER table
            RenderParagraph rp2 = (RenderParagraph)rp.Clone();

            doc.Body.Children.Add(rp2);

            doc.Generate();
        }