|
32 | 32 |
|
33 | 33 | IWParagraph paragraph = section.HeadersFooters.Header.AddParagraph(); |
34 | 34 | // Get the image stream. |
35 | | - FileStream imageStream = new FileStream(@"../../../Data/AdventureCycle.jpg", FileMode.Open, FileAccess.Read); |
| 35 | + FileStream imageStream = new FileStream(@Path.GetFullPath("Data/AdventureCycle.jpg"), FileMode.Open, FileAccess.Read); |
36 | 36 | IWPicture picture = paragraph.AppendPicture(imageStream); |
37 | 37 | picture.TextWrappingStyle = TextWrappingStyle.InFrontOfText; |
38 | 38 | picture.VerticalOrigin = VerticalOrigin.Margin; |
|
88 | 88 | paragraph.ParagraphFormat.AfterSpacing = 0; |
89 | 89 | paragraph.BreakCharacterFormat.FontSize = 12f; |
90 | 90 | //Append picture to the paragraph. |
91 | | - FileStream image1 = new FileStream(@"../../../Data/Mountain-200.jpg", FileMode.Open, FileAccess.Read); |
| 91 | + FileStream image1 = new FileStream(Path.GetFullPath(@"Data/Mountain-200.jpg"), FileMode.Open, FileAccess.Read); |
92 | 92 | picture = paragraph.AppendPicture(image1); |
93 | 93 | picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom; |
94 | 94 | picture.VerticalOrigin = VerticalOrigin.Paragraph; |
|
163 | 163 | paragraph.ApplyStyle("Heading 1"); |
164 | 164 | paragraph.ParagraphFormat.LineSpacing = 12f; |
165 | 165 | //Append picture to the paragraph. |
166 | | - FileStream image2 = new FileStream(@"../../../Data/Mountain-300.jpg", FileMode.Open, FileAccess.Read); |
| 166 | + FileStream image2 = new FileStream(Path.GetFullPath(@"Data/Mountain-300.jpg"), FileMode.Open, FileAccess.Read); |
167 | 167 | picture = paragraph.AppendPicture(image2); |
168 | 168 | picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom; |
169 | 169 | picture.VerticalOrigin = VerticalOrigin.Paragraph; |
|
178 | 178 | paragraph.ApplyStyle("Heading 1"); |
179 | 179 | paragraph.ParagraphFormat.LineSpacing = 12f; |
180 | 180 | //Append picture to the paragraph. |
181 | | - FileStream image3 = new FileStream(@"../../../Data/Road-550-W.jpg", FileMode.Open, FileAccess.Read); |
| 181 | + FileStream image3 = new FileStream(Path.GetFullPath(@"Data/Road-550-W.jpg"), FileMode.Open, FileAccess.Read); |
182 | 182 | picture = paragraph.AppendPicture(image3); |
183 | 183 | picture.TextWrappingStyle = TextWrappingStyle.TopAndBottom; |
184 | 184 | picture.VerticalOrigin = VerticalOrigin.Paragraph; |
|
216 | 216 | section.AddParagraph(); |
217 | 217 |
|
218 | 218 | //Save the Word document to FileStream |
219 | | - using (FileStream stream = new FileStream(@"../../../Sample.docx", FileMode.OpenOrCreate)) |
| 219 | + using (FileStream stream = new FileStream(Path.GetFullPath(@"Output/Sample.docx"), FileMode.OpenOrCreate)) |
220 | 220 | { |
221 | 221 | document.Save(stream, FormatType.Docx); |
222 | 222 | } |
|
0 commit comments