Example #1
0
 /// <summary>
 /// Add a new section to the SectionSelector
 /// </summary>
 /// <param Name="section">The section to add</param>
 /// <param Name="weight">The weight to assign to it</param>
 public void AddSection(Section section, int weight)
 {
     _Sections.Add(section, weight);
 }
Example #2
0
 /// <summary>
 /// Create a new DocGenerator with given start symbol and target window
 /// </summary>
 /// <param Name="startSymbol">The symbol to start generation on</param>
 /// <param Name="window">The window to attach the documents to</param>
 public DocGenerator(Section startSymbol, Window window)
 {
     StartSymbol = startSymbol;
     Window = window;
 }
Example #3
0
        /// <summary>
        /// Generate a set of documents
        /// </summary>
        /// <param name="numDocs">How many documents to create</param>
        /// <returns>The documents</returns>
        private Document[] SampleDocs(int numDocs)
        {
            //Generate Sections
            Section title = new Section(new Font("Century Gothic", 22), Color.FromArgb(128, 0, 0), 1, 0);
            Section h1 = new Section(new Font("Century Gothic", 16), Color.FromArgb(128, 0, 0), 1, 0);
            Section h2 = new Section(new Font("Century Gothic", 13), Color.FromArgb(128, 0, 0), 1, 0);
            Section h3 = new Section(new Font("Century Gothic", 11, FontStyle.Bold), Color.FromArgb(128, 0, 0), 1, 0);
            Section text1 = new Section(new Font("Century Gothic", 11), 4, 2);
            Section text2 = new Section(new Font("Century Gothic", 11), 4, 2);
            Section text3 = new Section(new Font("Century Gothic", 11), 4, 2);

            //Fill out selectors

            //Title Selector
            title.NextSection.TerminateWeight = 0;
            title.NextSection.AddSection(h1, 4);
            title.NextSection.AddSection(text1, 1);

            //H1 Selector
            h1.NextSection.TerminateWeight = 0;
            h1.NextSection.AddSection(text1, 2);
            h1.NextSection.AddSection(text2, 1);
            h1.NextSection.AddSection(h2, 2);

            //H2 Selector
            h2.NextSection.TerminateWeight = 0;
            h2.NextSection.AddSection(text2, 2);
            h2.NextSection.AddSection(text3, 1);
            h2.NextSection.AddSection(h3, 2);

            //H3 Selector
            h3.NextSection.TerminateWeight = 0;
            h3.NextSection.AddSection(text3, 1);

            //Text1 Selector
            text1.NextSection.TerminateWeight = 1;
            text1.NextSection.AddSection(text1, 4);
            text1.NextSection.AddSection(h1, 1);

            //Text2 Selector
            text2.NextSection.TerminateWeight = 2;
            text2.NextSection.AddSection(text2, 8);
            text2.NextSection.AddSection(h1, 1);
            text2.NextSection.AddSection(h2, 1);

            //Text3 Selector
            text3.NextSection.TerminateWeight = 3;
            text3.NextSection.AddSection(text3, 12);
            text3.NextSection.AddSection(h1, 1);
            text3.NextSection.AddSection(h2, 1);
            text3.NextSection.AddSection(h3, 1);

            //Generate the documents
            DocGenerator docGen = new DocGenerator(title, this);
            return docGen.GenerateDocSet(numDocs);
        }