| Line 1... |
Line 1... |
| 1 |
using System;
|
1 |
using System;
|
| 2 |
using Word;
|
2 |
using Microsoft.Office.Interop.Word;
|
| 3 |
using Microsoft.Office.Core;
|
3 |
using Microsoft.Office.Core;
|
| 4 |
|
4 |
|
| 5 |
|
5 |
|
| 6 |
namespace EA_DocGen
|
6 |
namespace EA_DocGen
|
| 7 |
{
|
7 |
{
|
| Line 20... |
Line 20... |
| 20 |
/// </summary>
|
20 |
/// </summary>
|
| 21 |
/// <param name="newStyleName"></param>
|
21 |
/// <param name="newStyleName"></param>
|
| 22 |
/// <param name="followingStyleName"></param>
|
22 |
/// <param name="followingStyleName"></param>
|
| 23 |
/// <param name="baseStyle"></param>
|
23 |
/// <param name="baseStyle"></param>
|
| 24 |
/// <returns></returns>
|
24 |
/// <returns></returns>
|
| 25 |
private static Word.Style createParagrapghStyle(string newStyleName, string followingStyleName, Word.Style baseStyle)
|
25 |
private static Style createParagrapghStyle(string newStyleName, string followingStyleName, Style baseStyle)
|
| 26 |
{
|
26 |
{
|
| 27 |
Word.Style s = getStyle(newStyleName);
|
27 |
Style s = getStyle(newStyleName);
|
| 28 |
if (s == null)
|
28 |
if (s == null)
|
| 29 |
{
|
29 |
{
|
| 30 |
object o_styleType = Word.WdStyleType.wdStyleTypeParagraph;
|
30 |
object o_styleType = WdStyleType.wdStyleTypeParagraph;
|
| 31 |
s = createWordDoc.WordDocument.Styles.Add(newStyleName, ref o_styleType);
|
31 |
s = createWordDoc.WordDocument.Styles.Add(newStyleName, ref o_styleType);
|
| 32 |
|
32 |
|
| 33 |
object o_baseStyle = baseStyle.NameLocal;
|
33 |
object o_baseStyle = baseStyle.NameLocal;
|
| 34 |
object o_followingStyle = followingStyleName;
|
34 |
object o_followingStyle = followingStyleName;
|
| 35 |
s.set_BaseStyle(ref o_baseStyle);
|
35 |
s.set_BaseStyle(ref o_baseStyle);
|
| 36 |
s.set_NextParagraphStyle(ref o_followingStyle);
|
36 |
s.set_NextParagraphStyle(ref o_followingStyle);
|
| 37 |
|
37 |
|
| 38 |
s.Font = baseStyle.Font;
|
38 |
s.Font = baseStyle.Font;
|
| 39 |
s.ParagraphFormat = baseStyle.ParagraphFormat;
|
39 |
s.ParagraphFormat = baseStyle.ParagraphFormat;
|
| 40 |
s.LanguageID = Word.WdLanguageID.wdEnglishAUS;
|
40 |
s.LanguageID = WdLanguageID.wdEnglishAUS;
|
| 41 |
s.NoProofing = 0;
|
41 |
s.NoProofing = 0;
|
| 42 |
s.Frame.Delete();
|
42 |
s.Frame.Delete();
|
| 43 |
s.NoSpaceBetweenParagraphsOfSameStyle = false;
|
43 |
s.NoSpaceBetweenParagraphsOfSameStyle = false;
|
| 44 |
|
44 |
|
| 45 |
}
|
45 |
}
|
| Line 50... |
Line 50... |
| 50 |
/// Creates a wdStyleTypeCharacter based style
|
50 |
/// Creates a wdStyleTypeCharacter based style
|
| 51 |
/// </summary>
|
51 |
/// </summary>
|
| 52 |
/// <param name="newStyleName"></param>
|
52 |
/// <param name="newStyleName"></param>
|
| 53 |
/// <param name="baseStyle"></param>
|
53 |
/// <param name="baseStyle"></param>
|
| 54 |
/// <returns></returns>
|
54 |
/// <returns></returns>
|
| 55 |
private static Word.Style createCharacterStyle(string newStyleName, Word.Style baseStyle)
|
55 |
private static Style createCharacterStyle(string newStyleName, Style baseStyle)
|
| 56 |
{
|
56 |
{
|
| 57 |
Word.Style s = getStyle(newStyleName);
|
57 |
Style s = getStyle(newStyleName);
|
| 58 |
if (s == null)
|
58 |
if (s == null)
|
| 59 |
{
|
59 |
{
|
| 60 |
object o_styleType = Word.WdStyleType.wdStyleTypeCharacter;
|
60 |
object o_styleType = WdStyleType.wdStyleTypeCharacter;
|
| 61 |
s = createWordDoc.WordDocument.Styles.Add(newStyleName, ref o_styleType);
|
61 |
s = createWordDoc.WordDocument.Styles.Add(newStyleName, ref o_styleType);
|
| 62 |
object o_baseStyle = baseStyle.NameLocal;
|
62 |
object o_baseStyle = baseStyle.NameLocal;
|
| 63 |
s.set_BaseStyle(ref o_baseStyle);
|
63 |
s.set_BaseStyle(ref o_baseStyle);
|
| 64 |
s.Font = baseStyle.Font;
|
64 |
s.Font = baseStyle.Font;
|
| 65 |
s.LanguageID = Word.WdLanguageID.wdEnglishAUS;
|
65 |
s.LanguageID = WdLanguageID.wdEnglishAUS;
|
| 66 |
s.NoProofing = 0;
|
66 |
s.NoProofing = 0;
|
| 67 |
}
|
67 |
}
|
| 68 |
return s;
|
68 |
return s;
|
| 69 |
}
|
69 |
}
|
| 70 |
|
70 |
|
| 71 |
public static void fixupNumParaStyles()
|
71 |
public static void fixupNumParaStyles()
|
| 72 |
{
|
72 |
{
|
| 73 |
// Remove all NumPara styles, some of which are known to be faulty.
|
73 |
// Remove all NumPara styles, some of which are known to be faulty.
|
| 74 |
Word.Style np = getStyle(EA_Constants.styleName_NumPara1);
|
74 |
Style np = getStyle(EA_Constants.styleName_NumPara1);
|
| 75 |
if (np != null) np.Delete();
|
75 |
if (np != null) np.Delete();
|
| 76 |
np = getStyle(EA_Constants.styleName_NumPara2);
|
76 |
np = getStyle(EA_Constants.styleName_NumPara2);
|
| 77 |
if (np != null) np.Delete();
|
77 |
if (np != null) np.Delete();
|
| 78 |
np = getStyle(EA_Constants.styleName_NumPara3);
|
78 |
np = getStyle(EA_Constants.styleName_NumPara3);
|
| 79 |
if (np != null) np.Delete();
|
79 |
if (np != null) np.Delete();
|
| Line 91... |
Line 91... |
| 91 |
if (np != null) np.Delete();
|
91 |
if (np != null) np.Delete();
|
| 92 |
np = getStyle("Numpara 6"); // ERG template has this one too - Note the lower case p
|
92 |
np = getStyle("Numpara 6"); // ERG template has this one too - Note the lower case p
|
| 93 |
if (np != null) np.Delete();
|
93 |
if (np != null) np.Delete();
|
| 94 |
|
94 |
|
| 95 |
// Re-Create Good Num Para styles based on the now good Heading styles
|
95 |
// Re-Create Good Num Para styles based on the now good Heading styles
|
| 96 |
Word.Style baseStyle;
|
96 |
Style baseStyle;
|
| 97 |
baseStyle = getStyle(EA_Constants.styleName_Heading1);
|
97 |
baseStyle = getStyle(EA_Constants.styleName_Heading1);
|
| 98 |
if (baseStyle != null)
|
98 |
if (baseStyle != null)
|
| 99 |
{
|
99 |
{
|
| 100 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara1, EA_Constants.styleName_Body1, baseStyle);
|
100 |
np = createParagrapghStyle(EA_Constants.styleName_NumPara1, EA_Constants.styleName_Body1, baseStyle);
|
| 101 |
np.Font.Size = 10;
|
101 |
np.Font.Size = 10;
|
| Line 159... |
Line 159... |
| 159 |
}
|
159 |
}
|
| 160 |
}
|
160 |
}
|
| 161 |
|
161 |
|
| 162 |
public static void forceHeadingsToUse2_5cmTabStops()
|
162 |
public static void forceHeadingsToUse2_5cmTabStops()
|
| 163 |
{
|
163 |
{
|
| 164 |
object alignment = Word.WdTabAlignment.wdAlignTabLeft;
|
164 |
object alignment = WdTabAlignment.wdAlignTabLeft;
|
| 165 |
object leader = Word.WdTabLeader.wdTabLeaderSpaces;
|
165 |
object leader = WdTabLeader.wdTabLeaderSpaces;
|
| 166 |
Word.Style h = getStyle(EA_Constants.styleName_Heading6);
|
166 |
Style h = getStyle(EA_Constants.styleName_Heading6);
|
| 167 |
if (h != null)
|
167 |
if (h != null)
|
| 168 |
{
|
168 |
{
|
| 169 |
h.ParagraphFormat.TabStops.ClearAll();
|
169 |
h.ParagraphFormat.TabStops.ClearAll();
|
| 170 |
h.ParagraphFormat.TabStops.Add((float)2.5, ref alignment, ref leader);
|
170 |
h.ParagraphFormat.TabStops.Add((float)2.5, ref alignment, ref leader);
|
| 171 |
}
|
171 |
}
|
| Line 198... |
Line 198... |
| 198 |
public static void correctErrorsInTemplateStyles()
|
198 |
public static void correctErrorsInTemplateStyles()
|
| 199 |
{
|
199 |
{
|
| 200 |
// Go through the document's list levels and make sure any faults are fixed up
|
200 |
// Go through the document's list levels and make sure any faults are fixed up
|
| 201 |
int i = 0;
|
201 |
int i = 0;
|
| 202 |
int j = 0;
|
202 |
int j = 0;
|
| 203 |
foreach (Word.ListTemplate lt in createWordDoc.WordDocument.ListTemplates)
|
203 |
foreach (ListTemplate lt in createWordDoc.WordDocument.ListTemplates)
|
| 204 |
{
|
204 |
{
|
| 205 |
j = 0;
|
205 |
j = 0;
|
| 206 |
foreach (Word.ListLevel lv in lt.ListLevels)
|
206 |
foreach (ListLevel lv in lt.ListLevels)
|
| 207 |
{
|
207 |
{
|
| 208 |
// An old ERG template had a flaw where the list numbering restarts were not
|
208 |
// An old ERG template had a flaw where the list numbering restarts were not
|
| 209 |
// configured correctly, so fix up if needed.
|
209 |
// configured correctly, so fix up if needed.
|
| 210 |
if (lv.ResetOnHigher != j)
|
210 |
if (lv.ResetOnHigher != j)
|
| 211 |
lv.ResetOnHigher = j;
|
211 |
lv.ResetOnHigher = j;
|
| Line 213... |
Line 213... |
| 213 |
}
|
213 |
}
|
| 214 |
i++;
|
214 |
i++;
|
| 215 |
}
|
215 |
}
|
| 216 |
|
216 |
|
| 217 |
// Ensure heading levels 7 to 9 are bold
|
217 |
// Ensure heading levels 7 to 9 are bold
|
| 218 |
Word.Style h7 = getStyle(EA_Constants.styleName_Heading7);
|
218 |
Style h7 = getStyle(EA_Constants.styleName_Heading7);
|
| 219 |
if (h7 != null)
|
219 |
if (h7 != null)
|
| 220 |
{
|
220 |
{
|
| 221 |
h7.Font.Bold = 1;
|
221 |
h7.Font.Bold = 1;
|
| 222 |
}
|
222 |
}
|
| 223 |
Word.Style h8 = getStyle(EA_Constants.styleName_Heading8);
|
223 |
Style h8 = getStyle(EA_Constants.styleName_Heading8);
|
| 224 |
if (h8 != null)
|
224 |
if (h8 != null)
|
| 225 |
{
|
225 |
{
|
| 226 |
h8.Font.Bold = 1;
|
226 |
h8.Font.Bold = 1;
|
| 227 |
}
|
227 |
}
|
| 228 |
Word.Style h9 = getStyle(EA_Constants.styleName_Heading9);
|
228 |
Style h9 = getStyle(EA_Constants.styleName_Heading9);
|
| 229 |
if (h9 != null)
|
229 |
if (h9 != null)
|
| 230 |
{
|
230 |
{
|
| 231 |
h9.Font.Bold = 1;
|
231 |
h9.Font.Bold = 1;
|
| 232 |
}
|
232 |
}
|
| 233 |
|
233 |
|
| Line 239... |
Line 239... |
| 239 |
/// does not support level numbering above 9, EA_DocGen can fake the heading number and use the
|
239 |
/// does not support level numbering above 9, EA_DocGen can fake the heading number and use the
|
| 240 |
/// styles created in this method for the fake headings.
|
240 |
/// styles created in this method for the fake headings.
|
| 241 |
/// </summary>
|
241 |
/// </summary>
|
| 242 |
public static void createAdditionalHeadingLevelStyles()
|
242 |
public static void createAdditionalHeadingLevelStyles()
|
| 243 |
{
|
243 |
{
|
| 244 |
Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
244 |
Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
| 245 |
if (s_Body1 != null)
|
245 |
if (s_Body1 != null)
|
| 246 |
{
|
246 |
{
|
| 247 |
// Heading 10 or above
|
247 |
// Heading 10 or above
|
| 248 |
Word.Style h10 = createParagrapghStyle(EA_Constants.styleName_Heading10OrAbove, EA_Constants.styleName_Body1, s_Body1);
|
248 |
Style h10 = createParagrapghStyle(EA_Constants.styleName_Heading10OrAbove, EA_Constants.styleName_Body1, s_Body1);
|
| 249 |
h10.Font.Size = 10;
|
249 |
h10.Font.Size = 10;
|
| 250 |
h10.Font.Bold = 1;
|
250 |
h10.Font.Bold = 1;
|
| 251 |
h10.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)0.0);
|
251 |
h10.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)0.0);
|
| 252 |
h10.ParagraphFormat.SpaceAfter = 6;
|
252 |
h10.ParagraphFormat.SpaceAfter = 6;
|
| 253 |
h10.ParagraphFormat.SpaceBefore = 12;
|
253 |
h10.ParagraphFormat.SpaceBefore = 12;
|
| 254 |
|
254 |
|
| 255 |
// NumPara 10 or above
|
255 |
// NumPara 10 or above
|
| 256 |
Word.Style np10 = createParagrapghStyle(EA_Constants.styleName_NumPara10OrAbove, EA_Constants.styleName_Body1, s_Body1);
|
256 |
Style np10 = createParagrapghStyle(EA_Constants.styleName_NumPara10OrAbove, EA_Constants.styleName_Body1, s_Body1);
|
| 257 |
h10.Font.Size = 10;
|
257 |
h10.Font.Size = 10;
|
| 258 |
h10.Font.Bold = 0;
|
258 |
h10.Font.Bold = 0;
|
| 259 |
h10.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)0.0);
|
259 |
h10.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)0.0);
|
| 260 |
h10.ParagraphFormat.SpaceAfter = 6;
|
260 |
h10.ParagraphFormat.SpaceAfter = 6;
|
| 261 |
h10.ParagraphFormat.SpaceBefore = 12;
|
261 |
h10.ParagraphFormat.SpaceBefore = 12;
|
| Line 265... |
Line 265... |
| 265 |
/// <summary>
|
265 |
/// <summary>
|
| 266 |
/// Create the styles used to display class element details
|
266 |
/// Create the styles used to display class element details
|
| 267 |
/// </summary>
|
267 |
/// </summary>
|
| 268 |
public static void createElementDetailsStyles()
|
268 |
public static void createElementDetailsStyles()
|
| 269 |
{
|
269 |
{
|
| 270 |
Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
270 |
Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
| 271 |
if (s_Body1 != null)
|
271 |
if (s_Body1 != null)
|
| 272 |
{
|
272 |
{
|
| 273 |
// A couple of indented body 1 styles
|
273 |
// A couple of indented body 1 styles
|
| 274 |
Word.Style s_B1_3_5 = createParagrapghStyle(EA_Constants.styleName_Body1_Left_3_5cm, EA_Constants.styleName_Body1_Left_3_5cm, s_Body1);
|
274 |
Style s_B1_3_5 = createParagrapghStyle(EA_Constants.styleName_Body1_Left_3_5cm, EA_Constants.styleName_Body1_Left_3_5cm, s_Body1);
|
| 275 |
s_B1_3_5.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)3.5);
|
275 |
s_B1_3_5.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)3.5);
|
| 276 |
|
276 |
|
| 277 |
Word.Style s_B1_4_5 = createParagrapghStyle(EA_Constants.styleName_Body1_Left_4_5cm, EA_Constants.styleName_Body1_Left_4_5cm, s_Body1);
|
277 |
Style s_B1_4_5 = createParagrapghStyle(EA_Constants.styleName_Body1_Left_4_5cm, EA_Constants.styleName_Body1_Left_4_5cm, s_Body1);
|
| 278 |
s_B1_4_5.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)4.5);
|
278 |
s_B1_4_5.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)4.5);
|
| 279 |
|
279 |
|
| 280 |
// A couple of pseudo-heading styles
|
280 |
// A couple of pseudo-heading styles
|
| 281 |
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);
|
281 |
Style s_B1_2_5_Italic = createParagrapghStyle(EA_Constants.styleName_Body1_Left_2_5cm_Italic, EA_Constants.styleName_Body1_Left_3_5cm, s_Body1);
|
| 282 |
s_B1_2_5_Italic.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)2.5);
|
282 |
s_B1_2_5_Italic.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)2.5);
|
| 283 |
s_B1_2_5_Italic.Font.Italic = 1;
|
283 |
s_B1_2_5_Italic.Font.Italic = 1;
|
| 284 |
s_B1_2_5_Italic.Font.Bold = 1;
|
284 |
s_B1_2_5_Italic.Font.Bold = 1;
|
| 285 |
|
285 |
|
| 286 |
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);
|
286 |
Style s_B1_3_5_Italic = createParagrapghStyle(EA_Constants.styleName_Body1_Left_3_5cm_Italic, EA_Constants.styleName_Body1_Left_4_5cm, s_Body1);
|
| 287 |
s_B1_3_5_Italic.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)3.5);
|
287 |
s_B1_3_5_Italic.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)3.5);
|
| 288 |
s_B1_3_5_Italic.Font.Italic = 1;
|
288 |
s_B1_3_5_Italic.Font.Italic = 1;
|
| 289 |
s_B1_3_5_Italic.Font.Bold = 1;
|
289 |
s_B1_3_5_Italic.Font.Bold = 1;
|
| 290 |
|
290 |
|
| 291 |
// Style for use when detailing parameter descriptions
|
291 |
// Style for use when detailing parameter descriptions
|
| 292 |
Word.Style s_ParamDesc = createParagrapghStyle(EA_Constants.stylename_Parameter_Description, EA_Constants.styleName_Body1, s_Body1);
|
292 |
Style s_ParamDesc = createParagrapghStyle(EA_Constants.stylename_Parameter_Description, EA_Constants.styleName_Body1, s_Body1);
|
| 293 |
s_ParamDesc.ParagraphFormat.TabStops.ClearAll();
|
293 |
s_ParamDesc.ParagraphFormat.TabStops.ClearAll();
|
| 294 |
object alignment = Word.WdTabAlignment.wdAlignTabLeft;
|
294 |
object alignment = WdTabAlignment.wdAlignTabLeft;
|
| 295 |
object leader = Word.WdTabLeader.wdTabLeaderSpaces;
|
295 |
object leader = WdTabLeader.wdTabLeaderSpaces;
|
| 296 |
s_ParamDesc.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)9.0);
|
296 |
s_ParamDesc.ParagraphFormat.LeftIndent = createWordDoc.WordApp.CentimetersToPoints((float)9.0);
|
| 297 |
s_ParamDesc.ParagraphFormat.TabStops.Add( createWordDoc.WordApp.CentimetersToPoints((float)9.0), ref alignment, ref leader );
|
297 |
s_ParamDesc.ParagraphFormat.TabStops.Add( createWordDoc.WordApp.CentimetersToPoints((float)9.0), ref alignment, ref leader );
|
| 298 |
s_ParamDesc.ParagraphFormat.FirstLineIndent = createWordDoc.WordApp.CentimetersToPoints((float)-5.5);
|
298 |
s_ParamDesc.ParagraphFormat.FirstLineIndent = createWordDoc.WordApp.CentimetersToPoints((float)-5.5);
|
| 299 |
}
|
299 |
}
|
| 300 |
}
|
300 |
}
|
| Line 303... |
Line 303... |
| 303 |
/// Creates the styles needed for generating requirement documentation, if they do not
|
303 |
/// Creates the styles needed for generating requirement documentation, if they do not
|
| 304 |
/// already exist.
|
304 |
/// already exist.
|
| 305 |
/// </summary>
|
305 |
/// </summary>
|
| 306 |
public static void createRequirementStyles()
|
306 |
public static void createRequirementStyles()
|
| 307 |
{
|
307 |
{
|
| 308 |
Word.Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
308 |
Style s_Body1 = getStyle(EA_Constants.styleName_Body1);
|
| 309 |
if (s_Body1 != null)
|
309 |
if (s_Body1 != null)
|
| 310 |
{
|
310 |
{
|
| 311 |
// APPROVED ///////////////////////////////////////////////////////////////////////////////////////////////
|
311 |
// APPROVED ///////////////////////////////////////////////////////////////////////////////////////////////
|
| 312 |
Word.Style s_ReqAppBody = createParagrapghStyle(EA_Constants.styleName_ReqAppBody, EA_Constants.styleName_ReqAppBody, s_Body1);
|
312 |
Style s_ReqAppBody = createParagrapghStyle(EA_Constants.styleName_ReqAppBody, EA_Constants.styleName_ReqAppBody, s_Body1);
|
| 313 |
if (s_ReqAppBody != null)
|
313 |
if (s_ReqAppBody != null)
|
| 314 |
{
|
314 |
{
|
| 315 |
// No changes needed - this is just a copy of Body 1
|
315 |
// No changes needed - this is just a copy of Body 1
|
| 316 |
}
|
316 |
}
|
| 317 |
|
317 |
|
| 318 |
Word.Style s_ReqAppHdr = null;
|
318 |
Style s_ReqAppHdr = null;
|
| 319 |
if (s_ReqAppBody != null)
|
319 |
if (s_ReqAppBody != null)
|
| 320 |
{
|
320 |
{
|
| 321 |
s_ReqAppHdr = createParagrapghStyle(EA_Constants.styleName_ReqAppHdr, EA_Constants.styleName_ReqAppBody, s_Body1);
|
321 |
s_ReqAppHdr = createParagrapghStyle(EA_Constants.styleName_ReqAppHdr, EA_Constants.styleName_ReqAppBody, s_Body1);
|
| 322 |
if (s_ReqAppHdr != null)
|
322 |
if (s_ReqAppHdr != null)
|
| 323 |
{
|
323 |
{
|
| 324 |
// Indent:Hanging: 2.5cm, Space After: 3pt, Keep with next, Tabs: 16.5cm, Right
|
324 |
// Indent:Hanging: 2.5cm, Space After: 3pt, Keep with next, Tabs: 16.5cm, Right
|
| 325 |
s_ReqAppHdr.ParagraphFormat.FirstLineIndent = createWordDoc.WordApp.CentimetersToPoints((float)-2.5);
|
325 |
s_ReqAppHdr.ParagraphFormat.FirstLineIndent = createWordDoc.WordApp.CentimetersToPoints((float)-2.5);
|
| 326 |
s_ReqAppHdr.ParagraphFormat.SpaceAfter = 3;
|
326 |
s_ReqAppHdr.ParagraphFormat.SpaceAfter = 3;
|
| 327 |
s_ReqAppHdr.ParagraphFormat.KeepWithNext = (int)MsoTriState.msoTrue;
|
327 |
s_ReqAppHdr.ParagraphFormat.KeepWithNext = (int)MsoTriState.msoTrue;
|
| 328 |
s_ReqAppHdr.ParagraphFormat.TabStops.ClearAll();
|
328 |
s_ReqAppHdr.ParagraphFormat.TabStops.ClearAll();
|
| 329 |
object alignment = Word.WdTabAlignment.wdAlignTabRight;
|
329 |
object alignment = WdTabAlignment.wdAlignTabRight;
|
| 330 |
object leader = Word.WdTabLeader.wdTabLeaderSpaces;
|
330 |
object leader = WdTabLeader.wdTabLeaderSpaces;
|
| 331 |
s_ReqAppHdr.ParagraphFormat.TabStops.Add( createWordDoc.WordApp.CentimetersToPoints((float)16.5), ref alignment, ref leader );
|
331 |
s_ReqAppHdr.ParagraphFormat.TabStops.Add( createWordDoc.WordApp.CentimetersToPoints((float)16.5), ref alignment, ref leader );
|
| 332 |
}
|
332 |
}
|
| 333 |
}
|
333 |
}
|
| 334 |
|
334 |
|
| 335 |
// PROPOSED ///////////////////////////////////////////////////////////////////////////////////////////////
|
335 |
// PROPOSED ///////////////////////////////////////////////////////////////////////////////////////////////
|
| 336 |
Word.Style s_ReqPropBody = null;
|
336 |
Style s_ReqPropBody = null;
|
| 337 |
if (s_ReqAppBody != null)
|
337 |
if (s_ReqAppBody != null)
|
| 338 |
{
|
338 |
{
|
| 339 |
s_ReqPropBody = createParagrapghStyle(EA_Constants.styleName_ReqPropBody, EA_Constants.styleName_ReqPropBody, s_ReqAppBody );
|
339 |
s_ReqPropBody = createParagrapghStyle(EA_Constants.styleName_ReqPropBody, EA_Constants.styleName_ReqPropBody, s_ReqAppBody );
|
| 340 |
if (s_ReqPropBody != null)
|
340 |
if (s_ReqPropBody != null)
|
| 341 |
{
|
341 |
{
|
| Line 344... |
Line 344... |
| 344 |
}
|
344 |
}
|
| 345 |
}
|
345 |
}
|
| 346 |
|
346 |
|
| 347 |
if (s_ReqAppHdr != null && s_ReqPropBody != null)
|
347 |
if (s_ReqAppHdr != null && s_ReqPropBody != null)
|
| 348 |
{
|
348 |
{
|
| 349 |
Word.Style s_ReqPropHdr = createParagrapghStyle(EA_Constants.styleName_ReqPropHdr, EA_Constants.styleName_ReqPropBody, s_ReqAppHdr );
|
349 |
Style s_ReqPropHdr = createParagrapghStyle(EA_Constants.styleName_ReqPropHdr, EA_Constants.styleName_ReqPropBody, s_ReqAppHdr );
|
| 350 |
if (s_ReqPropHdr != null)
|
350 |
if (s_ReqPropHdr != null)
|
| 351 |
{
|
351 |
{
|
| 352 |
// Font: Italic
|
352 |
// Font: Italic
|
| 353 |
s_ReqPropHdr.Font.Italic = (int)MsoTriState.msoTrue;
|
353 |
s_ReqPropHdr.Font.Italic = (int)MsoTriState.msoTrue;
|
| 354 |
}
|
354 |
}
|
| 355 |
}
|
355 |
}
|
| 356 |
|
356 |
|
| 357 |
// REJECTED ///////////////////////////////////////////////////////////////////////////////////////////////
|
357 |
// REJECTED ///////////////////////////////////////////////////////////////////////////////////////////////
|
| 358 |
Word.Style s_ReqRejBody = null;
|
358 |
Style s_ReqRejBody = null;
|
| 359 |
if (s_ReqAppBody != null)
|
359 |
if (s_ReqAppBody != null)
|
| 360 |
{
|
360 |
{
|
| 361 |
s_ReqRejBody = createParagrapghStyle(EA_Constants.styleName_ReqRejBody, EA_Constants.styleName_ReqRejBody, s_ReqAppBody );
|
361 |
s_ReqRejBody = createParagrapghStyle(EA_Constants.styleName_ReqRejBody, EA_Constants.styleName_ReqRejBody, s_ReqAppBody );
|
| 362 |
if (s_ReqRejBody != null)
|
362 |
if (s_ReqRejBody != null)
|
| 363 |
{
|
363 |
{
|
| Line 366... |
Line 366... |
| 366 |
}
|
366 |
}
|
| 367 |
}
|
367 |
}
|
| 368 |
|
368 |
|
| 369 |
if (s_ReqAppHdr != null && s_ReqRejBody != null)
|
369 |
if (s_ReqAppHdr != null && s_ReqRejBody != null)
|
| 370 |
{
|
370 |
{
|
| 371 |
Word.Style s_ReqRejHdr = createParagrapghStyle(EA_Constants.styleName_ReqRejHdr, EA_Constants.styleName_ReqRejBody, s_ReqAppHdr );
|
371 |
Style s_ReqRejHdr = createParagrapghStyle(EA_Constants.styleName_ReqRejHdr, EA_Constants.styleName_ReqRejBody, s_ReqAppHdr );
|
| 372 |
if (s_ReqRejHdr != null)
|
372 |
if (s_ReqRejHdr != null)
|
| 373 |
{
|
373 |
{
|
| 374 |
// Font: Italic
|
374 |
// Font: Italic
|
| 375 |
s_ReqRejHdr.Font.StrikeThrough = (int)MsoTriState.msoTrue;
|
375 |
s_ReqRejHdr.Font.StrikeThrough = (int)MsoTriState.msoTrue;
|
| 376 |
}
|
376 |
}
|
| 377 |
}
|
377 |
}
|
| 378 |
|
378 |
|
| 379 |
// REQUIREMENT NAME ///////////////////////////////////////////////////////////////////////////////////////////////
|
379 |
// REQUIREMENT NAME ///////////////////////////////////////////////////////////////////////////////////////////////
|
| 380 |
Word.Style s_DefParaFont = getStyle("Default Paragraph Font");
|
380 |
Style s_DefParaFont = getStyle("Default Paragraph Font");
|
| 381 |
if (s_DefParaFont != null)
|
381 |
if (s_DefParaFont != null)
|
| 382 |
{
|
382 |
{
|
| 383 |
Word.Style s_ReqName = createCharacterStyle(EA_Constants.styleName_ReqName, s_DefParaFont );
|
383 |
Style s_ReqName = createCharacterStyle(EA_Constants.styleName_ReqName, s_DefParaFont );
|
| 384 |
if (s_ReqName != null)
|
384 |
if (s_ReqName != null)
|
| 385 |
{
|
385 |
{
|
| 386 |
s_ReqName.Font.Bold = (int)MsoTriState.msoTrue;
|
386 |
s_ReqName.Font.Bold = (int)MsoTriState.msoTrue;
|
| 387 |
}
|
387 |
}
|
| 388 |
}
|
388 |
}
|
| Line 394... |
Line 394... |
| 394 |
/// the style name given. Everything else I tried, didn't work, even code from Visual Basic
|
394 |
/// the style name given. Everything else I tried, didn't work, even code from Visual Basic
|
| 395 |
/// examples failed to work or even compile (once converted) in C#.
|
395 |
/// examples failed to work or even compile (once converted) in C#.
|
| 396 |
/// </summary>
|
396 |
/// </summary>
|
| 397 |
/// <param name="styleText"></param>
|
397 |
/// <param name="styleText"></param>
|
| 398 |
/// <returns></returns>
|
398 |
/// <returns></returns>
|
| 399 |
public static Word.Style getStyle(string styleText)
|
399 |
public static Style getStyle(string styleText)
|
| 400 |
{
|
400 |
{
|
| 401 |
foreach(Word.Style aStyle in createWordDoc.WordDocument.Styles)
|
401 |
foreach(Style aStyle in createWordDoc.WordDocument.Styles)
|
| 402 |
{
|
402 |
{
|
| 403 |
//MessageBox.Show( aStyle.NameLocal );
|
403 |
//MessageBox.Show( aStyle.NameLocal );
|
| 404 |
if (aStyle.NameLocal.Equals(styleText))
|
404 |
if (aStyle.NameLocal.Equals(styleText))
|
| 405 |
{
|
405 |
{
|
| 406 |
return aStyle;
|
406 |
return aStyle;
|