| 2094 |
ghuddy |
1 |
using System;
|
|
|
2 |
using Word;
|
|
|
3 |
using Microsoft.Office.Core;
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
namespace EA_DocGen
|
|
|
7 |
{
|
|
|
8 |
/// <summary>
|
|
|
9 |
/// Summary description for StyleContent.
|
|
|
10 |
/// </summary>
|
|
|
11 |
public class StyleContent
|
|
|
12 |
{
|
| 2106 |
ghuddy |
13 |
public static void initialise()
|
| 2094 |
ghuddy |
14 |
{
|
|
|
15 |
}
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
/// <summary>
|
|
|
19 |
/// Creates a wdStyleTypeParagraph based style
|
|
|
20 |
/// </summary>
|
|
|
21 |
/// <param name="newStyleName"></param>
|
|
|
22 |
/// <param name="followingStyleName"></param>
|
|
|
23 |
/// <param name="baseStyle"></param>
|
|
|
24 |
/// <returns></returns>
|
| 2106 |
ghuddy |
25 |
private static Word.Style createParagrapghStyle(string newStyleName, string followingStyleName, Word.Style baseStyle)
|
| 2094 |
ghuddy |
26 |
{
|
|
|
27 |
Word.Style s = getStyle(newStyleName);
|
|
|
28 |
if (s == null)
|
|
|
29 |
{
|
|
|
30 |
object o_styleType = Word.WdStyleType.wdStyleTypeParagraph;
|
| 2106 |
ghuddy |
31 |
s = createWordDoc.WordDocument.Styles.Add(newStyleName, ref o_styleType);
|
| 2094 |
ghuddy |
32 |
|
|
|
33 |
object o_baseStyle = baseStyle.NameLocal;
|
|
|
34 |
object o_followingStyle = followingStyleName;
|
|
|
35 |
s.set_BaseStyle(ref o_baseStyle);
|
|
|
36 |
s.set_NextParagraphStyle(ref o_followingStyle);
|
|
|
37 |
|
|
|
38 |
s.Font = baseStyle.Font;
|
|
|
39 |
s.ParagraphFormat = baseStyle.ParagraphFormat;
|
|
|
40 |
s.LanguageID = Word.WdLanguageID.wdEnglishAUS;
|
|
|
41 |
s.NoProofing = 0;
|
|
|
42 |
s.Frame.Delete();
|
|
|
43 |
s.NoSpaceBetweenParagraphsOfSameStyle = false;
|
|
|
44 |
|
|
|
45 |
}
|
|
|
46 |
return s;
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
/// <summary>
|
|
|
50 |
/// Creates a wdStyleTypeCharacter based style
|
|
|
51 |
/// </summary>
|
|
|
52 |
/// <param name="newStyleName"></param>
|
|
|
53 |
/// <param name="baseStyle"></param>
|
|
|
54 |
/// <returns></returns>
|
| 2106 |
ghuddy |
55 |
private static Word.Style createCharacterStyle(string newStyleName, Word.Style baseStyle)
|
| 2094 |
ghuddy |
56 |
{
|
|
|
57 |
Word.Style s = getStyle(newStyleName);
|
|
|
58 |
if (s == null)
|
|
|
59 |
{
|
|
|
60 |
object o_styleType = Word.WdStyleType.wdStyleTypeCharacter;
|
| 2106 |
ghuddy |
61 |
s = createWordDoc.WordDocument.Styles.Add(newStyleName, ref o_styleType);
|
| 2094 |
ghuddy |
62 |
object o_baseStyle = baseStyle.NameLocal;
|
|
|
63 |
s.set_BaseStyle(ref o_baseStyle);
|
|
|
64 |
s.Font = baseStyle.Font;
|
|
|
65 |
s.LanguageID = Word.WdLanguageID.wdEnglishAUS;
|
|
|
66 |
s.NoProofing = 0;
|
|
|
67 |
}
|
|
|
68 |
return s;
|
|
|
69 |
}
|
|
|
70 |
|
| 2116 |
ghuddy |
71 |
public static void fixupNumParaStyles()
|
|
|
72 |
{
|
|
|
73 |
// Remove all NumPara styles, some of which are known to be faulty.
|
|
|
74 |
Word.Style np = getStyle(EA_Constants.styleName_NumPara1);
|
|
|
75 |
if (np != null) np.Delete();
|
|
|
76 |
np = getStyle(EA_Constants.styleName_NumPara2);
|
|
|
77 |
if (np != null) np.Delete();
|
|
|
78 |
np = getStyle(EA_Constants.styleName_NumPara3);
|
|
|
79 |
if (np != null) np.Delete();
|
|
|
80 |
np = getStyle(EA_Constants.styleName_NumPara4);
|
|
|
81 |
if (np != null) np.Delete();
|
|
|
82 |
np = getStyle(EA_Constants.styleName_NumPara5);
|
|
|
83 |
if (np != null) np.Delete();
|
|
|
84 |
np = getStyle(EA_Constants.styleName_NumPara6);
|
|
|
85 |
if (np != null) np.Delete();
|
|
|
86 |
np = getStyle(EA_Constants.styleName_NumPara7);
|
|
|
87 |
if (np != null) np.Delete();
|
|
|
88 |
np = getStyle(EA_Constants.styleName_NumPara8);
|
|
|
89 |
if (np != null) np.Delete();
|
|
|
90 |
np = getStyle(EA_Constants.styleName_NumPara9);
|
|
|
91 |
if (np != null) np.Delete();
|
|
|
92 |
np = getStyle("Numpara 6"); // ERG template has this one too - Note the lower case p
|
|
|
93 |
if (np != null) np.Delete();
|
|
|
94 |
|
|
|
95 |
// Re-Create Good Num Para styles based on the now good Heading styles
|
|
|
96 |
Word.Style baseStyle;
|
|
|
97 |
baseStyle = getStyle(EA_Constants.styleName_Heading1);
|
|
|
98 |
if (baseStyle != null)
|
|
|
99 |
{
|
|
|
100 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara1, EA_Constants.styleName_Body1, baseStyle);
|
|
|
101 |
np.Font.Size = 10;
|
|
|
102 |
np.Font.Bold = 0;
|
|
|
103 |
}
|
|
|
104 |
baseStyle = getStyle(EA_Constants.styleName_Heading2);
|
|
|
105 |
if (baseStyle != null)
|
|
|
106 |
{
|
|
|
107 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara2, EA_Constants.styleName_Body1, baseStyle);
|
|
|
108 |
np.Font.Size = 10;
|
|
|
109 |
np.Font.Bold = 0;
|
|
|
110 |
}
|
|
|
111 |
baseStyle = getStyle(EA_Constants.styleName_Heading3);
|
|
|
112 |
if (baseStyle != null)
|
|
|
113 |
{
|
|
|
114 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara3, EA_Constants.styleName_Body1, baseStyle);
|
|
|
115 |
np.Font.Size = 10;
|
|
|
116 |
np.Font.Bold = 0;
|
|
|
117 |
}
|
|
|
118 |
baseStyle = getStyle(EA_Constants.styleName_Heading4);
|
|
|
119 |
if (baseStyle != null)
|
|
|
120 |
{
|
|
|
121 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara4, EA_Constants.styleName_Body1, baseStyle);
|
|
|
122 |
np.Font.Size = 10;
|
|
|
123 |
np.Font.Bold = 0;
|
|
|
124 |
}
|
|
|
125 |
baseStyle = getStyle(EA_Constants.styleName_Heading5);
|
|
|
126 |
if (baseStyle != null)
|
|
|
127 |
{
|
|
|
128 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara5, EA_Constants.styleName_Body1, baseStyle);
|
|
|
129 |
np.Font.Size = 10;
|
|
|
130 |
np.Font.Bold = 0;
|
|
|
131 |
}
|
|
|
132 |
baseStyle = getStyle(EA_Constants.styleName_Heading6);
|
|
|
133 |
if (baseStyle != null)
|
|
|
134 |
{
|
|
|
135 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara6, EA_Constants.styleName_Body1, baseStyle);
|
|
|
136 |
np.Font.Size = 10;
|
|
|
137 |
np.Font.Bold = 0;
|
|
|
138 |
}
|
|
|
139 |
baseStyle = getStyle(EA_Constants.styleName_Heading7);
|
|
|
140 |
if (baseStyle != null)
|
|
|
141 |
{
|
|
|
142 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara7, EA_Constants.styleName_Body1, baseStyle);
|
|
|
143 |
np.Font.Size = 10;
|
|
|
144 |
np.Font.Bold = 0;
|
|
|
145 |
}
|
|
|
146 |
baseStyle = getStyle(EA_Constants.styleName_Heading8);
|
|
|
147 |
if (baseStyle != null)
|
|
|
148 |
{
|
|
|
149 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara8, EA_Constants.styleName_Body1, baseStyle);
|
|
|
150 |
np.Font.Size = 10;
|
|
|
151 |
np.Font.Bold = 0;
|
|
|
152 |
}
|
|
|
153 |
baseStyle = getStyle(EA_Constants.styleName_Heading9);
|
|
|
154 |
if (baseStyle != null)
|
|
|
155 |
{
|
|
|
156 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara9, EA_Constants.styleName_Body1, baseStyle);
|
|
|
157 |
np.Font.Size = 10;
|
|
|
158 |
np.Font.Bold = 0;
|
|
|
159 |
}
|
|
|
160 |
}
|
|
|
161 |
|
| 2104 |
ghuddy |
162 |
/// <summary>
|
|
|
163 |
/// This method is designed to correct problems that have been reported in the styles
|
|
|
164 |
/// contained in the input templates being used. These can be corrected programmatically
|
|
|
165 |
/// much quicker than waiting for a fix to be done to the templates and having them re-deployed
|
|
|
166 |
/// to the shared drive where MS-Word templates are retrieved from by most users.
|
|
|
167 |
/// </summary>
|
| 2106 |
ghuddy |
168 |
public static void correctErrorsInTemplateStyles()
|
| 2104 |
ghuddy |
169 |
{
|
|
|
170 |
// Go through the document's list levels and make sure any faults are fixed up
|
|
|
171 |
int i = 0;
|
|
|
172 |
int j = 0;
|
| 2106 |
ghuddy |
173 |
foreach (Word.ListTemplate lt in createWordDoc.WordDocument.ListTemplates)
|
| 2104 |
ghuddy |
174 |
{
|
|
|
175 |
j = 0;
|
|
|
176 |
foreach (Word.ListLevel lv in lt.ListLevels)
|
|
|
177 |
{
|
|
|
178 |
// An old ERG template had a flaw where the list numbering restarts were not
|
|
|
179 |
// configured correctly, so fix up if needed.
|
|
|
180 |
if (lv.ResetOnHigher != j)
|
|
|
181 |
lv.ResetOnHigher = j;
|
|
|
182 |
j++;
|
|
|
183 |
}
|
|
|
184 |
i++;
|
|
|
185 |
}
|
| 2094 |
ghuddy |
186 |
|
| 2104 |
ghuddy |
187 |
// Ensure heading levels 7 to 9 are bold
|
|
|
188 |
Word.Style h7 = getStyle(EA_Constants.styleName_Heading7);
|
|
|
189 |
if (h7 != null)
|
|
|
190 |
{
|
|
|
191 |
h7.Font.Bold = 1;
|
|
|
192 |
}
|
|
|
193 |
Word.Style h8 = getStyle(EA_Constants.styleName_Heading8);
|
|
|
194 |
if (h8 != null)
|
|
|
195 |
{
|
|
|
196 |
h8.Font.Bold = 1;
|
|
|
197 |
}
|
|
|
198 |
Word.Style h9 = getStyle(EA_Constants.styleName_Heading9);
|
|
|
199 |
if (h9 != null)
|
|
|
200 |
{
|
|
|
201 |
h9.Font.Bold = 1;
|
|
|
202 |
}
|
| 2116 |
ghuddy |
203 |
|
|
|
204 |
fixupNumParaStyles();
|
| 2104 |
ghuddy |
205 |
}
|
|
|
206 |
|
|
|
207 |
/// <summary>
|
|
|
208 |
/// This method creates a heading level style for heading levels 10 or above. Although MS-Word
|
|
|
209 |
/// does not support level numbering above 9, EA_DocGen can fake the heading number and use the
|
|
|
210 |
/// styles created in this method for the fake headings.
|
|
|
211 |
/// </summary>
|
| 2106 |
ghuddy |
212 |
public static void createAdditionalHeadingLevelStyles()
|
| 2104 |
ghuddy |
213 |
{
|
|
|
214 |
Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
|
|
215 |
if (s_Body1 != null)
|
|
|
216 |
{
|
| 2116 |
ghuddy |
217 |
// Heading 10 or above
|
| 2104 |
ghuddy |
218 |
Word.Style h10 = createParagrapghStyle(EA_Constants.styleName_Heading10OrAbove, EA_Constants.styleName_Body1, s_Body1);
|
|
|
219 |
h10.Font.Size = 10;
|
|
|
220 |
h10.Font.Bold = 1;
|
| 2106 |
ghuddy |
221 |
h10.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)0.0);
|
| 2104 |
ghuddy |
222 |
h10.ParagraphFormat.SpaceAfter = 6;
|
|
|
223 |
h10.ParagraphFormat.SpaceBefore = 12;
|
| 2116 |
ghuddy |
224 |
|
|
|
225 |
// NumPara 10 or above
|
|
|
226 |
Word.Style np10 = createParagrapghStyle(EA_Constants.styleName_NumPara10OrAbove, EA_Constants.styleName_Body1, s_Body1);
|
|
|
227 |
h10.Font.Size = 10;
|
|
|
228 |
h10.Font.Bold = 0;
|
|
|
229 |
h10.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)0.0);
|
|
|
230 |
h10.ParagraphFormat.SpaceAfter = 6;
|
|
|
231 |
h10.ParagraphFormat.SpaceBefore = 12;
|
| 2104 |
ghuddy |
232 |
}
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
/// <summary>
|
|
|
236 |
/// Create the styles used to display class element details
|
|
|
237 |
/// </summary>
|
| 2106 |
ghuddy |
238 |
public static void createElementDetailsStyles()
|
| 2098 |
ghuddy |
239 |
{
|
|
|
240 |
Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
|
|
241 |
if (s_Body1 != null)
|
|
|
242 |
{
|
|
|
243 |
// A couple of indented body 1 styles
|
|
|
244 |
Word.Style s_B1_3_5 = createParagrapghStyle(EA_Constants.styleName_Body1_Left_3_5cm, EA_Constants.styleName_Body1_Left_3_5cm, s_Body1);
|
| 2106 |
ghuddy |
245 |
s_B1_3_5.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)3.5);
|
| 2098 |
ghuddy |
246 |
|
|
|
247 |
Word.Style s_B1_4_5 = createParagrapghStyle(EA_Constants.styleName_Body1_Left_4_5cm, EA_Constants.styleName_Body1_Left_4_5cm, s_Body1);
|
| 2106 |
ghuddy |
248 |
s_B1_4_5.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)4.5);
|
| 2098 |
ghuddy |
249 |
|
|
|
250 |
// A couple of pseudo-heading styles
|
|
|
251 |
Word.Style s_B1_2_5_Italic = createParagrapghStyle(EA_Constants.styleName_Body1_Left_2_5cm_Italic, EA_Constants.styleName_Body1_Left_3_5cm, s_Body1);
|
| 2106 |
ghuddy |
252 |
s_B1_2_5_Italic.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)2.5);
|
| 2098 |
ghuddy |
253 |
s_B1_2_5_Italic.Font.Italic = 1;
|
|
|
254 |
s_B1_2_5_Italic.Font.Bold = 1;
|
|
|
255 |
|
|
|
256 |
Word.Style s_B1_3_5_Italic = createParagrapghStyle(EA_Constants.styleName_Body1_Left_3_5cm_Italic, EA_Constants.styleName_Body1_Left_4_5cm, s_Body1);
|
| 2106 |
ghuddy |
257 |
s_B1_3_5_Italic.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)3.5);
|
| 2098 |
ghuddy |
258 |
s_B1_3_5_Italic.Font.Italic = 1;
|
|
|
259 |
s_B1_3_5_Italic.Font.Bold = 1;
|
|
|
260 |
|
|
|
261 |
// Style for use when detailing parameter descriptions
|
|
|
262 |
Word.Style s_ParamDesc = createParagrapghStyle(EA_Constants.stylename_Parameter_Description, EA_Constants.styleName_Body1, s_Body1);
|
|
|
263 |
s_ParamDesc.ParagraphFormat.TabStops.ClearAll();
|
|
|
264 |
object alignment = Word.WdTabAlignment.wdAlignTabLeft;
|
|
|
265 |
object leader = Word.WdTabLeader.wdTabLeaderSpaces;
|
| 2106 |
ghuddy |
266 |
s_ParamDesc.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)9.0);
|
|
|
267 |
s_ParamDesc.ParagraphFormat.TabStops.Add( createWordDoc.WordApp.CentimetersToPoints((float)9.0), ref alignment, ref leader );
|
|
|
268 |
s_ParamDesc.ParagraphFormat.FirstLineIndent = createWordDoc.WordApp.CentimetersToPoints((float)-5.5);
|
| 2098 |
ghuddy |
269 |
}
|
|
|
270 |
}
|
|
|
271 |
|
| 2094 |
ghuddy |
272 |
/// <summary>
|
|
|
273 |
/// Creates the styles needed for generating requirement documentation, if they do not
|
|
|
274 |
/// already exist.
|
|
|
275 |
/// </summary>
|
| 2106 |
ghuddy |
276 |
public static void createRequirementStyles()
|
| 2094 |
ghuddy |
277 |
{
|
|
|
278 |
Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
|
|
279 |
if (s_Body1 != null)
|
|
|
280 |
{
|
|
|
281 |
// APPROVED ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
282 |
Word.Style s_ReqAppBody = createParagrapghStyle(EA_Constants.styleName_ReqAppBody, EA_Constants.styleName_ReqAppBody, s_Body1);
|
|
|
283 |
if (s_ReqAppBody != null)
|
|
|
284 |
{
|
|
|
285 |
// No changes needed - this is just a copy of Body 1
|
|
|
286 |
}
|
|
|
287 |
|
|
|
288 |
Word.Style s_ReqAppHdr = null;
|
|
|
289 |
if (s_ReqAppBody != null)
|
|
|
290 |
{
|
|
|
291 |
s_ReqAppHdr = createParagrapghStyle(EA_Constants.styleName_ReqAppHdr, EA_Constants.styleName_ReqAppBody, s_Body1);
|
|
|
292 |
if (s_ReqAppHdr != null)
|
|
|
293 |
{
|
|
|
294 |
// Indent:Hanging: 2.5cm, Space After: 3pt, Keep with next, Tabs: 16.5cm, Right
|
| 2106 |
ghuddy |
295 |
s_ReqAppHdr.ParagraphFormat.FirstLineIndent = createWordDoc.WordApp.CentimetersToPoints((float)-2.5);
|
| 2094 |
ghuddy |
296 |
s_ReqAppHdr.ParagraphFormat.SpaceAfter = 3;
|
|
|
297 |
s_ReqAppHdr.ParagraphFormat.KeepWithNext = (int)MsoTriState.msoTrue;
|
|
|
298 |
s_ReqAppHdr.ParagraphFormat.TabStops.ClearAll();
|
|
|
299 |
object alignment = Word.WdTabAlignment.wdAlignTabRight;
|
|
|
300 |
object leader = Word.WdTabLeader.wdTabLeaderSpaces;
|
| 2106 |
ghuddy |
301 |
s_ReqAppHdr.ParagraphFormat.TabStops.Add( createWordDoc.WordApp.CentimetersToPoints((float)16.5), ref alignment, ref leader );
|
| 2094 |
ghuddy |
302 |
}
|
|
|
303 |
}
|
|
|
304 |
|
|
|
305 |
// PROPOSED ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
306 |
Word.Style s_ReqPropBody = null;
|
|
|
307 |
if (s_ReqAppBody != null)
|
|
|
308 |
{
|
|
|
309 |
s_ReqPropBody = createParagrapghStyle(EA_Constants.styleName_ReqPropBody, EA_Constants.styleName_ReqPropBody, s_ReqAppBody );
|
|
|
310 |
if (s_ReqPropBody != null)
|
|
|
311 |
{
|
|
|
312 |
// Font: Italic
|
|
|
313 |
s_ReqPropBody.Font.Italic = (int)MsoTriState.msoTrue;
|
|
|
314 |
}
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
if (s_ReqAppHdr != null && s_ReqPropBody != null)
|
|
|
318 |
{
|
|
|
319 |
Word.Style s_ReqPropHdr = createParagrapghStyle(EA_Constants.styleName_ReqPropHdr, EA_Constants.styleName_ReqPropBody, s_ReqAppHdr );
|
|
|
320 |
if (s_ReqPropHdr != null)
|
|
|
321 |
{
|
|
|
322 |
// Font: Italic
|
|
|
323 |
s_ReqPropHdr.Font.Italic = (int)MsoTriState.msoTrue;
|
|
|
324 |
}
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
// REJECTED ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
328 |
Word.Style s_ReqRejBody = null;
|
|
|
329 |
if (s_ReqAppBody != null)
|
|
|
330 |
{
|
|
|
331 |
s_ReqRejBody = createParagrapghStyle(EA_Constants.styleName_ReqRejBody, EA_Constants.styleName_ReqRejBody, s_ReqAppBody );
|
|
|
332 |
if (s_ReqRejBody != null)
|
|
|
333 |
{
|
|
|
334 |
// Font: Italic
|
|
|
335 |
s_ReqRejBody.Font.StrikeThrough = (int)MsoTriState.msoTrue;
|
|
|
336 |
}
|
|
|
337 |
}
|
|
|
338 |
|
|
|
339 |
if (s_ReqAppHdr != null && s_ReqRejBody != null)
|
|
|
340 |
{
|
|
|
341 |
Word.Style s_ReqRejHdr = createParagrapghStyle(EA_Constants.styleName_ReqRejHdr, EA_Constants.styleName_ReqRejBody, s_ReqAppHdr );
|
|
|
342 |
if (s_ReqRejHdr != null)
|
|
|
343 |
{
|
|
|
344 |
// Font: Italic
|
|
|
345 |
s_ReqRejHdr.Font.StrikeThrough = (int)MsoTriState.msoTrue;
|
|
|
346 |
}
|
|
|
347 |
}
|
|
|
348 |
|
|
|
349 |
// REQUIREMENT NAME ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
350 |
Word.Style s_DefParaFont = getStyle("Default Paragraph Font");
|
|
|
351 |
if (s_DefParaFont != null)
|
|
|
352 |
{
|
|
|
353 |
Word.Style s_ReqName = createCharacterStyle(EA_Constants.styleName_ReqName, s_DefParaFont );
|
|
|
354 |
if (s_ReqName != null)
|
|
|
355 |
{
|
|
|
356 |
s_ReqName.Font.Bold = (int)MsoTriState.msoTrue;
|
|
|
357 |
}
|
|
|
358 |
}
|
|
|
359 |
}
|
|
|
360 |
}
|
|
|
361 |
|
|
|
362 |
/// <summary>
|
|
|
363 |
/// This function was the only way I could figure out how to obtain a style object for
|
|
|
364 |
/// the style name given. Everything else I tried, didn't work, even code from Visual Basic
|
|
|
365 |
/// examples failed to work or even compile (once converted) in C#.
|
|
|
366 |
/// </summary>
|
|
|
367 |
/// <param name="styleText"></param>
|
|
|
368 |
/// <returns></returns>
|
| 2106 |
ghuddy |
369 |
public static Word.Style getStyle(string styleText)
|
| 2094 |
ghuddy |
370 |
{
|
| 2106 |
ghuddy |
371 |
foreach(Word.Style aStyle in createWordDoc.WordDocument.Styles)
|
| 2094 |
ghuddy |
372 |
{
|
|
|
373 |
//MessageBox.Show( aStyle.NameLocal );
|
| 2104 |
ghuddy |
374 |
if (aStyle.NameLocal.Equals(styleText))
|
| 2094 |
ghuddy |
375 |
{
|
|
|
376 |
return aStyle;
|
|
|
377 |
}
|
|
|
378 |
}
|
|
|
379 |
return null;
|
|
|
380 |
}
|
|
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
}
|
|
|
385 |
}
|