Пример #1
0
        public DocumentationGenerator Download(DocumentType docType,
                                               string fileName,
                                               VideoForUser video)
        {
            DocumentationGenerator documentGenerator = DocumentationGenerator.Create(_domain, _fontPath, docType, fileName);

            var fields = new List <string> {
                "Отрывок текста"
            };

            if (video.HasAnyTranslation)
            {
                fields.Add("Перевод");
            }
            var tableData = new TableData(fields.Count, false);

            tableData.AddHeader(fields);
            foreach (var sentence in video.Sentences)
            {
                fields = new List <string> {
                    sentence.Item1
                };
                if (video.HasTranslation(sentence))
                {
                    fields.Add(sentence.Item2);
                }
                tableData.AddRow(fields);
            }

            documentGenerator.AddHeader(string.Format("Текст из видео «{0}»", video.Title));
            documentGenerator.AddTable(tableData);

            return(documentGenerator);
        }
Пример #2
0
        public DocumentationGenerator Download(DocumentType docType,
                                               string fileName,
                                               Dictionary <KnowledgeDataType, List <GeneratedKnowledgeItem> >
                                               generatedItems)
        {
            DocumentationGenerator documentGenerator = DocumentationGenerator.Create(_domain, _fontPath, docType,
                                                                                     fileName);

            var tables = new Dictionary <string, TableData>();

            foreach (KnowledgeDataType knowledgeDataType in generatedItems.Keys)
            {
                var tableData = new TableData(2, true);

                string tableHeader = GetTableHeader(knowledgeDataType);
                if (!string.IsNullOrEmpty(tableHeader))
                {
                    tableData.AddHeader(tableHeader, "Перевод");

                    string subHeader = GetHeader(knowledgeDataType);
                    tables.Add(subHeader, tableData);
                }

                List <GeneratedKnowledgeItem> items = generatedItems[knowledgeDataType];
                foreach (GeneratedKnowledgeItem item in items)
                {
                    var sourceTranslation = (SourceWithTranslation)item.ParsedData;
                    tableData.AddRow(sourceTranslation.Source.Text, sourceTranslation.Translation.Text);
                }
            }

            if (string.IsNullOrEmpty(Header))
            {
                Header = "Генератор знаний";
            }

            documentGenerator.AddHeader(Header, false);
            foreach (var pair in tables)
            {
                documentGenerator.AddHeader(pair.Key);
                documentGenerator.AddTable(pair.Value);
            }

            return(documentGenerator);
        }
        public DocumentationGenerator Download(DocumentType docType,
                                               string fileName,
                                               RepresentationForUser representationForUser)
        {
            DocumentationGenerator documentGenerator = DocumentationGenerator.Create(_domain, _fontPath, docType, fileName);

            var tableData = new TableData(2, true);

            tableData.AddHeader("Слово", "Перевод");
            foreach (RepresentationAreaForUser area in representationForUser.Areas)
            {
                tableData.AddRow(area.Source.Text, area.Translation.Text);
            }

            documentGenerator.AddHeader(string.Format("Визуальный словарь на тему «{0}»", representationForUser.Title));
            documentGenerator.AddTable(tableData);

            return(documentGenerator);
        }
Пример #4
0
        public DocumentationGenerator Download(DocumentType docType,
                                               string fileName,
                                               List <SourceWithTranslation> elemsWithTranslations)
        {
            DocumentationGenerator documentGenerator = DocumentationGenerator.Create(_domain, _fontPath, docType,
                                                                                     fileName);

            var tableData = new TableData(2, true);

            tableData.AddHeader(TableHeader, "Перевод");
            foreach (SourceWithTranslation elem in elemsWithTranslations)
            {
                tableData.AddRow(elem.Source.Text, elem.Translation.Text);
            }

            documentGenerator.AddHeader(Header);
            documentGenerator.AddTable(tableData);

            return(documentGenerator);
        }
Пример #5
0
        public DocumentationGenerator Download(DocumentType docType,
                                               string fileName,
                                               List <SourceWithTranslation> words)
        {
            DocumentationGenerator documentGenerator = DocumentationGenerator.Create(_domain, _fontPath, docType, fileName);

            var tableData = new TableData(2, true);

            tableData.AddHeader("Слово", "Перевод");
            foreach (SourceWithTranslation word in words)
            {
                tableData.AddRow(word.Source.Text, word.Translation.Text);
            }

            if (string.IsNullOrEmpty(Header))
            {
                Header = "Минилекс Гуннемарка";
            }

            documentGenerator.AddHeader(Header);
            documentGenerator.AddTable(tableData);

            return(documentGenerator);
        }