Esempio n. 1
0
        /// <summary>
        /// Outputs a primary heading for the template type followed by each of the templates within
        /// the template type (defined by the templates parameter).
        /// </summary>
        /// <param name="typeName">The template type's name</param>
        /// <param name="detailsText">The details text describing the template type.</param>
        /// <param name="templates">The templates contained within the template type for this ig.</param>
        private void AddTemplateTypeSection(string typeName, string detailsText, List <Template> templates)
        {
            var notRetiredTemplates = templates.Where(y => y.Status != this.retiredStatus);

            if (notRetiredTemplates.Count() > 0)
            {
                // Add a Entry Level Templates heading
                Paragraph entryLevelHeading = new Paragraph(
                    new ParagraphProperties(
                        new ParagraphStyleId()
                {
                    Val = Properties.Settings.Default.TemplateTypeHeadingStyle
                }),
                    new Run(
                        new Text(typeName)));
                this.document.MainDocumentPart.Document.Body.AppendChild(entryLevelHeading);

                if (!string.IsNullOrEmpty(detailsText))
                {
                    OpenXmlElement element = detailsText.MarkdownToOpenXml(this._tdb, this.document.MainDocumentPart);
                    OpenXmlHelper.Append(element, this.document.MainDocumentPart.Document.Body);
                }

                if (typeName.ToLower() == "document-level templates")
                {
                    RequiredAndOptionalSectionsTableGenerator.Append(this._tdb, this.tables, this.hyperlinkTracker, this.templates);
                }

                foreach (Template cTemplate in notRetiredTemplates)
                {
                    this.AddTemplate(cTemplate);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Outputs a primary heading for the template type followed by each of the templates within
        /// the template type (defined by the templates parameter).
        /// </summary>
        /// <param name="typeName">The template type's name</param>
        /// <param name="detailsText">The details text describing the template type.</param>
        /// <param name="templates">The templates contained within the template type for this ig.</param>
        private void AddTemplateTypeSection(IGSettingsManager.IGTemplateType templateType, List <Template> templates)
        {
            var notRetiredTemplates = templates.Where(y => y.Status != this.retiredStatus);

            if (notRetiredTemplates.Count() > 0)
            {
                // Add a Entry Level Templates heading
                Paragraph entryLevelHeading = new Paragraph(
                    new ParagraphProperties(
                        new ParagraphStyleId()
                {
                    Val = Properties.Settings.Default.TemplateTypeHeadingStyle
                }),
                    new Run(
                        new Text(templateType.Name)));
                this.document.MainDocumentPart.Document.Body.AppendChild(entryLevelHeading);

                if (!string.IsNullOrEmpty(templateType.DetailsText))
                {
                    OpenXmlElement element = templateType.DetailsText.MarkdownToOpenXml(this._tdb, this.document.MainDocumentPart);
                    OpenXmlHelper.Append(element, this.document.MainDocumentPart.Document.Body);
                }

                // Generate the required and optional sections document table overview if the export settings indicate
                // it should be generated AND provide both a document and section template type id
                bool generateRandOSectionsTable =
                    this.exportSettings.GenerateRequiredAndOptionalSectionsTable &&
                    this.exportSettings.DocumentTemplateTypeId != null &&
                    this.exportSettings.SectionTemplateTypeId != null &&
                    this.exportSettings.DocumentTemplateTypeId == templateType.TemplateTypeId;

                if (generateRandOSectionsTable)
                {
                    RequiredAndOptionalSectionsTableGenerator.Append(
                        this._tdb,
                        this.tables,
                        this.hyperlinkTracker,
                        this.templates,
                        this.exportSettings.DocumentTemplateTypeId.Value,
                        this.exportSettings.SectionTemplateTypeId.Value);
                }

                foreach (Template cTemplate in notRetiredTemplates)
                {
                    this.AddTemplate(cTemplate);
                }
            }
        }