Subversion Repositories DevTools

Rev

Rev 2098 | Rev 2106 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2098 Rev 2104
Line 30... Line 30...
30
      /// </summary>
30
      /// </summary>
31
      /// <param name="newStyleName"></param>
31
      /// <param name="newStyleName"></param>
32
      /// <param name="followingStyleName"></param>
32
      /// <param name="followingStyleName"></param>
33
      /// <param name="baseStyle"></param>
33
      /// <param name="baseStyle"></param>
34
      /// <returns></returns>
34
      /// <returns></returns>
35
      public Word.Style createParagrapghStyle(string newStyleName, 
35
      private Word.Style createParagrapghStyle(string newStyleName, 
36
         string followingStyleName, 
36
         string followingStyleName, 
37
         Word.Style baseStyle)
37
         Word.Style baseStyle)
38
      {
38
      {
39
         Word.Style s = getStyle(newStyleName);
39
         Word.Style s = getStyle(newStyleName);
40
         if (s == null)
40
         if (s == null)
Line 62... Line 62...
62
      /// Creates a wdStyleTypeCharacter based style
62
      /// Creates a wdStyleTypeCharacter based style
63
      /// </summary>
63
      /// </summary>
64
      /// <param name="newStyleName"></param>
64
      /// <param name="newStyleName"></param>
65
      /// <param name="baseStyle"></param>
65
      /// <param name="baseStyle"></param>
66
      /// <returns></returns>
66
      /// <returns></returns>
67
      public Word.Style createCharacterStyle(string newStyleName, Word.Style baseStyle)
67
      private Word.Style createCharacterStyle(string newStyleName, Word.Style baseStyle)
68
      {
68
      {
69
         Word.Style s = getStyle(newStyleName);
69
         Word.Style s = getStyle(newStyleName);
70
         if (s == null)
70
         if (s == null)
71
         {
71
         {
72
            object o_styleType = Word.WdStyleType.wdStyleTypeCharacter;
72
            object o_styleType = Word.WdStyleType.wdStyleTypeCharacter;
Line 78... Line 78...
78
            s.NoProofing = 0;
78
            s.NoProofing = 0;
79
         }
79
         }
80
         return s;
80
         return s;
81
      }
81
      }
82
 
82
 
-
 
83
      /// <summary>
-
 
84
      /// This method is designed to correct problems that have been reported in the styles
-
 
85
      /// contained in the input templates being used. These can be corrected programmatically
-
 
86
      /// much quicker than waiting for a fix to be done to the templates and having them re-deployed
-
 
87
      /// to the shared drive where MS-Word templates are retrieved from by most users.
-
 
88
      /// </summary>
-
 
89
      public void correctErrorsInTemplateStyles()
-
 
90
      {
-
 
91
         // Go through the document's list levels and make sure any faults are fixed up
-
 
92
         int i = 0;
-
 
93
         int j = 0;
-
 
94
         foreach (Word.ListTemplate lt in WordDocument.ListTemplates)
-
 
95
         {
-
 
96
            j = 0;
-
 
97
            foreach (Word.ListLevel lv in lt.ListLevels)
-
 
98
            {
-
 
99
               // An old ERG template had a flaw where the list numbering restarts were not 
-
 
100
               // configured correctly, so fix up if needed.
-
 
101
               if (lv.ResetOnHigher != j)
-
 
102
                  lv.ResetOnHigher = j;
-
 
103
               j++;
-
 
104
            }
-
 
105
            i++;
-
 
106
         }
-
 
107
 
-
 
108
         // Ensure heading levels 7 to 9 are bold
-
 
109
         Word.Style h7 = getStyle(EA_Constants.styleName_Heading7);
-
 
110
         if (h7 != null)
-
 
111
         {
-
 
112
            h7.Font.Bold = 1;
-
 
113
         }
-
 
114
         Word.Style h8 = getStyle(EA_Constants.styleName_Heading8);
-
 
115
         if (h8 != null)
-
 
116
         {
-
 
117
            h8.Font.Bold = 1;
-
 
118
         }
-
 
119
         Word.Style h9 = getStyle(EA_Constants.styleName_Heading9);
-
 
120
         if (h9 != null)
-
 
121
         {
-
 
122
            h9.Font.Bold = 1;
-
 
123
         }
-
 
124
      }
83
 
125
 
-
 
126
      /// <summary>
-
 
127
      /// This method creates a heading level style for heading levels 10 or above. Although MS-Word 
-
 
128
      /// does not support level numbering above 9, EA_DocGen can fake the heading number and use the
-
 
129
      /// styles created in this method for the fake headings.
-
 
130
      /// </summary>
-
 
131
      public void createAdditionalHeadingLevelStyles()
-
 
132
      {
-
 
133
         Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
-
 
134
         if (s_Body1 != null)
-
 
135
         {
-
 
136
            Word.Style h10 = createParagrapghStyle(EA_Constants.styleName_Heading10OrAbove, EA_Constants.styleName_Body1, s_Body1);
-
 
137
            h10.Font.Size = 10;
-
 
138
            h10.Font.Bold = 1;
-
 
139
            h10.ParagraphFormat.LeftIndent  = WordApp.CentimetersToPoints((float)0.0);
-
 
140
            h10.ParagraphFormat.SpaceAfter  = 6;
-
 
141
            h10.ParagraphFormat.SpaceBefore = 12;
-
 
142
         }
-
 
143
      }
-
 
144
 
-
 
145
      /// <summary>
-
 
146
      /// Create the styles used to display class element details
-
 
147
      /// </summary>
84
      public void createElementDetailsStyles()
148
      public void createElementDetailsStyles()
85
      {
149
      {
86
         Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
150
         Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
87
         if (s_Body1 != null)
151
         if (s_Body1 != null)
88
         {
152
         {
Line 117... Line 181...
117
 
181
 
118
      /// <summary>
182
      /// <summary>
119
      /// Creates the styles needed for generating requirement documentation, if they do not
183
      /// Creates the styles needed for generating requirement documentation, if they do not
120
      /// already exist.
184
      /// already exist.
121
      /// </summary>
185
      /// </summary>
122
      public void createRequirementStylesIfNecessary()
186
      public void createRequirementStyles()
123
      {
187
      {
124
         Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
188
         Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
125
         if (s_Body1 != null)
189
         if (s_Body1 != null)
126
         {
190
         {
127
            // APPROVED ///////////////////////////////////////////////////////////////////////////////////////////////
191
            // APPROVED ///////////////////////////////////////////////////////////////////////////////////////////////
Line 215... Line 279...
215
      public Word.Style getStyle(string styleText)
279
      public Word.Style getStyle(string styleText)
216
      {
280
      {
217
         foreach(Word.Style aStyle in WordDocument.Styles)
281
         foreach(Word.Style aStyle in WordDocument.Styles)
218
         {
282
         {
219
            //MessageBox.Show( aStyle.NameLocal );
283
            //MessageBox.Show( aStyle.NameLocal );
220
            if (aStyle.NameLocal.StartsWith(styleText))
284
            if (aStyle.NameLocal.Equals(styleText))
221
            {
285
            {
222
               return aStyle;
286
               return aStyle;
223
            }
287
            }
224
         }
288
         }
225
         return null;
289
         return null;