コード例 #1
0
        private static void AddInteractionTable(Document doc, InteractionShadow interactionShadow)
        {
            Selection content = doc.Application.Selection;

            if (addMSWordMapMarkers)
            {
                content.Font.Name = "Arial";
                content.Font.Size = 2;
                content.Font.Color = WdColor.wdColorWhite;//change this to white late to make it more hidden
                content.TypeText(interactionShadow.GetStateId());
                content.set_Style(WdBuiltinStyle.wdStyleHeading3);
                content.TypeParagraph();
                content = doc.Application.Selection;//re-read all current content
            }

            doc.Tables[Templates.Interaction].Range.Copy();
            content.Bookmarks.Add("bm" + Left(AlphaNumericCharsOnly(interactionShadow.GetStateId()), 38));
            content.Move(WdUnits.wdStory);
            content.Paste();

            Microsoft.Office.Interop.Word.Table wordTable = doc.Tables[doc.Tables.Count];

            wordTable.Range.ParagraphFormat.KeepWithNext = -1;
            wordTable.Cell(1, 1).Range.InsertAfter(interactionShadow.GetStateId());
            wordTable.Cell(1, 2).Range.InsertAfter("Interaction");
            FillEnteringFrom(wordTable.Cell(3, 1), interactionShadow);

            Cell cell = wordTable.Cell(17, 1);
            Table table = interactionShadow.GetDeveloperNotes();
            if (!table.IsEmpty()) {
                string notes = table.GetData(0, (int)TableColumns.DeveloperNotes.Text);
                string notesDate = table.GetData(0, (int)TableColumns.DeveloperNotes.TextDateStamp);
                cell.Range.InsertAfter(notes);
                SetCellBackgroundColorIfNecessary(cell, notesDate);
            }

            cell = wordTable.Cell(15, 1);
            table = interactionShadow.GetSpecialSettings();
            if (!table.IsEmpty()) {
                string settings = table.GetData(0, (int)TableColumns.SpecialSettings.Text);
                string settingsDate = table.GetData(0, (int)TableColumns.SpecialSettings.TextDateStamp);
                cell.Range.InsertAfter(settings);
                SetCellBackgroundColorIfNecessary(cell, settingsDate);
            }

            table = interactionShadow.GetMaxHandling();
            bool hasOverride = false;
            for (int r = 0; r < table.GetNumRows() && hasOverride == false; r++)
                for (int c = 1; c < table.GetNumColumns() && hasOverride == false; c++)
                    if (table.GetData(r, c).Length > 0)
                        hasOverride = true;
            if (hasOverride)
                FillMaxHandling(wordTable, 13, table);
            else {
                wordTable.Range.Rows[12].Delete();
                wordTable.Range.Rows[12].Delete();
            }

            table = interactionShadow.GetConfirmationPrompts();
            FillConfirmationPromptTable(wordTable, 11, table);
            table = interactionShadow.GetCommandTransitions();
            FillCommandTransitionTable(wordTable, 8, table);
            table = interactionShadow.GetPromptTypes();
            FillPromptTypesTable(wordTable, 6, table);

            //SetCellBackgroundColorIfNecessary(wordTable.Cell(1, 1), interactionShadow.GetLastChangeDate());
            SetCellBackgroundColorIfNecessary(wordTable.Cell(1, 1), interactionShadow.GetLastChangeVersion());//JDK

            content.Move(WdUnits.wdStory);
            content.set_Style("Normal");
            content.TypeParagraph();
            content.Move(WdUnits.wdStory);
        }
コード例 #2
0
 private static void AddInteractionElement(XmlDocument xmlDoc, InteractionShadow shadow)
 {
     XmlElement stateElement = CreateElement(xmlDoc.DocumentElement, xmlStrings.Interaction);
     stateElement.SetAttribute(xmlStrings.StateId, shadow.GetStateId());
     AddEnteringFrom(shadow, stateElement);
     AddPromptTypes(shadow.GetPromptTypes(), stateElement);
     AddCommandTransitions(shadow, shadow.GetCommandTransitions(), stateElement);
     AddConfirmationList(shadow.GetConfirmationPrompts(), stateElement);
     AddMaxHandling(shadow, shadow.GetMaxHandling(), stateElement);
     AddSpecialSettings(shadow.GetSpecialSettings(), stateElement);
     AddDeveloperNotes(shadow.GetDeveloperNotes(), stateElement);
 }