@@ -49,7 +49,7 @@ using (WordDocument document = new WordDocument())
4949
5050 IWParagraph paragraph = section .HeadersFooters .Header .AddParagraph ();
5151 // Get the image stream.
52- FileStream imageStream = new FileStream (@" ../../../ Data/AdventureCycle.jpg" , FileMode .Open , FileAccess .Read );
52+ FileStream imageStream = new FileStream (@Path . GetFullPath ( " Data/AdventureCycle.jpg" ) , FileMode .Open , FileAccess .Read );
5353 IWPicture picture = paragraph .AppendPicture (imageStream );
5454 picture .TextWrappingStyle = TextWrappingStyle .InFrontOfText ;
5555 picture .VerticalOrigin = VerticalOrigin .Margin ;
@@ -105,7 +105,7 @@ using (WordDocument document = new WordDocument())
105105 paragraph .ParagraphFormat .AfterSpacing = 0 ;
106106 paragraph .BreakCharacterFormat .FontSize = 12 f ;
107107 // Append picture to the paragraph.
108- FileStream image1 = new FileStream (@" ../../../ Data/Mountain-200.jpg" , FileMode .Open , FileAccess .Read );
108+ FileStream image1 = new FileStream (Path . GetFullPath ( @" Data/Mountain-200.jpg" ) , FileMode .Open , FileAccess .Read );
109109 picture = paragraph .AppendPicture (image1 );
110110 picture .TextWrappingStyle = TextWrappingStyle .TopAndBottom ;
111111 picture .VerticalOrigin = VerticalOrigin .Paragraph ;
@@ -180,7 +180,7 @@ using (WordDocument document = new WordDocument())
180180 paragraph .ApplyStyle (" Heading 1" );
181181 paragraph .ParagraphFormat .LineSpacing = 12 f ;
182182 // Append picture to the paragraph.
183- FileStream image2 = new FileStream (@" ../../../ Data/Mountain-300.jpg" , FileMode .Open , FileAccess .Read );
183+ FileStream image2 = new FileStream (Path . GetFullPath ( @" Data/Mountain-300.jpg" ) , FileMode .Open , FileAccess .Read );
184184 picture = paragraph .AppendPicture (image2 );
185185 picture .TextWrappingStyle = TextWrappingStyle .TopAndBottom ;
186186 picture .VerticalOrigin = VerticalOrigin .Paragraph ;
@@ -195,7 +195,7 @@ using (WordDocument document = new WordDocument())
195195 paragraph .ApplyStyle (" Heading 1" );
196196 paragraph .ParagraphFormat .LineSpacing = 12 f ;
197197 // Append picture to the paragraph.
198- FileStream image3 = new FileStream (@" ../../../ Data/Road-550-W.jpg" , FileMode .Open , FileAccess .Read );
198+ FileStream image3 = new FileStream (Path . GetFullPath ( @" Data/Road-550-W.jpg" ) , FileMode .Open , FileAccess .Read );
199199 picture = paragraph .AppendPicture (image3 );
200200 picture .TextWrappingStyle = TextWrappingStyle .TopAndBottom ;
201201 picture .VerticalOrigin = VerticalOrigin .Paragraph ;
@@ -233,7 +233,7 @@ using (WordDocument document = new WordDocument())
233233 section .AddParagraph ();
234234
235235 // Save the Word document to FileStream
236- using (FileStream stream = new FileStream (@" ../../../ Sample.docx" , FileMode .OpenOrCreate ))
236+ using (FileStream stream = new FileStream (Path . GetFullPath ( @" Output/ Sample.docx" ) , FileMode .OpenOrCreate ))
237237 {
238238 document .Save (stream , FormatType .Docx );
239239 }
0 commit comments