Exemple #1
0
        public static Document CreateDocument(IList <Person> people)
        {
            var document = Word.Documents.Add();

            document.EmbedTrueTypeFonts = true;

            var range = document.Range();

            range.Font.Name = "Centaur Festive MT Italic";
            range.Font.Size = 14;
            range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
            range.PageSetup.LeftMargin      = range.PageSetup.RightMargin = 24;
            range.PageSetup.TextColumns.SetCount(ColumnCount);

            var colSize = (int)Math.Ceiling(people.Count / (double)ColumnCount);

            for (int col = 0; col < ColumnCount; col++)
            {
                range.Text = people.Skip(col * colSize).Take(colSize).Join("\v", p => p.FullName);

                if (col == ColumnCount - 1)
                {
                    break;
                }
                range.Collapse(WdCollapseDirection.wdCollapseEnd);
                range.InsertBreak(WdBreakType.wdColumnBreak);
            }

            document.Activate();
            Word.Activate();
            document.Activate();
            return(document);
        }
Exemple #2
0
    void SpawnNewWord()
    {
        Word newWord = Instantiate(wordPrefab).GetComponent <Word>();

        newWord.Activate(new WordDataManager.WordData());
    }