Beispiel #1
0
        public void CreateDocument(string projectPath)
        {
            DocumentCreator      documentCreator = new DocumentCreator(projectPath);
            string               path            = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            List <Documentation> documentations  = documentCreator.GetAllDocuments();

            this.doc = DocX.Create(path + @"\" + documentCreator.Title + ".docx");
            doc.InsertParagraph($"{documentCreator.Title}", false, new Formatting()
            {
                Size = 26, FontColor = baseColor
            });
            doc.InsertSectionPageBreak(true);
            int capitol = 1;

            foreach (Documentation documentation in documentations)
            {
                doc.InsertParagraph($"{capitol} - {documentation.Title.Replace(documentCreator.Title,"").Trim('.')}", false, new Formatting()
                {
                    Size = 22
                });
                doc.InsertParagraph(" ", false, new Formatting()
                {
                    Size = 40
                });
                int subCapitol = 1;
                foreach (KeyValuePair <string, Assembly> assembly in documentation.Pages.OrderBy(x => x.Value.Members.OrderBy(y => y.Priority).First().Priority))
                {
                    Paragraph paragraph = doc.InsertParagraph($"{capitol}.{subCapitol} - {assembly.Value.Members.First().Name}", false, new Formatting()
                    {
                        Size = 20
                    });
                    paragraph.IndentationBefore = 0.2f;
                    paragraph = doc.InsertParagraph($"Namespace: {assembly.Value.Name}", false, new Formatting()
                    {
                        Size = 14, FontColor = Color.DarkGray
                    });
                    paragraph.IndentationBefore = 0.4f;
                    foreach (AMember member in assembly.Value.Members.OrderBy(x => x.Priority))
                    {
                        WriteMember(member, false);
                    }
                    doc.InsertParagraph(" ", false, new Formatting()
                    {
                        Size = 24
                    });
                    subCapitol++;
                }
                if (capitol < documentations.Count)
                {
                    doc.InsertSectionPageBreak(true);
                }
                capitol++;
            }
            doc.Save();
        }