回答編集履歴

2

リンクの変更

2022/09/07 09:27

投稿

Gia2apo
Gia2apo

スコア62

test CHANGED
@@ -1,4 +1,4 @@
1
- [Free Spire.Doc for .NET](https://www.e-iceblue.cn/Introduce/Free-Spire-Doc-NET.html)
1
+ [Free Spire.Doc for .NET](https://jp.e-iceblue.com/introduce/free-spire-doc-for-net.html)
2
2
  この製品にはフッターに画像を挿入する機能があります。
3
3
  無料版があります。
4
4
  https://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/Word-Header/Footer-Insert-Image-Header-and-Footer-for-Word.html

1

コードの変更

2022/09/07 09:23

投稿

Gia2apo
Gia2apo

スコア62

test CHANGED
@@ -1,39 +1,36 @@
1
1
  [Free Spire.Doc for .NET](https://www.e-iceblue.cn/Introduce/Free-Spire-Doc-NET.html)
2
2
  この製品にはフッターに画像を挿入する機能があります。
3
3
  無料版があります。
4
- 次はコード
4
+ https://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/Word-Header/Footer-Insert-Image-Header-and-Footer-for-Word.html
5
+
5
6
  ```ここに言語を入力
6
- using System.Drawing;
7
+ Imports System.Drawing
7
- using Spire.Doc;
8
+ Imports Spire.Doc
8
- using Spire.Doc.Documents;
9
+ Imports Spire.Doc.Documents
9
- using Spire.Doc.Fields;
10
+ Imports Spire.Doc.Fields
10
11
 
11
- namespace ImageHeaderFooter
12
+ Namespace ImageHeaderFooter
12
- {
13
- class Program
13
+ Friend Class Program
14
- {
15
- static void Main(string[] args)
14
+ Shared Sub Main(ByVal args() As String)
16
- {
17
- //サプルファイルのロード
15
+ 'ドキュメのロード
18
- Document document = new Document();
16
+ Dim document As New Document()
19
- document.LoadFromFile(@"E:\Work\Documents\Spire.Doc for .NET.docx");
17
+ document.LoadFromFile("E:\Work\Documents\Spire.Doc for .NET.docx")
20
18
 
19
+ 'Footerインスタンスの初期化
20
+ Dim footer As HeaderFooter = document.Sections(0).HeadersFooters.Footer
21
+ 'フッターに段落と書式設定を追加する
22
+ Dim paragraph2 As Paragraph = footer.AddParagraph()
23
+ paragraph2.Format.HorizontalAlignment = HorizontalAlignment.Left
24
+ 'フッター段落に画像とテキストを追加する
25
+ Dim footerimage As DocPicture = paragraph2.AppendPicture(Image.FromFile("E:\Logo\logo.jpeg"))
26
+ Dim TR As TextRange = paragraph2.AppendText("Copyright © 2013 e-iceblue. All Rights Reserved.")
27
+ TR.CharacterFormat.FontName = "Arial"
28
+ TR.CharacterFormat.FontSize = 10
29
+ TR.CharacterFormat.TextColor = Color.Black
21
30
 
22
- //Footerインスタンスの初期化
23
- HeaderFooter footer = document.Sections[0].HeadersFooters.Footer;
24
- //フッターの段落と書式設定の追加
25
- Paragraph paragraph2 = footer.AddParagraph();
26
- paragraph2.Format.HorizontalAlignment = HorizontalAlignment.Left;
27
- //フッター段落に画像とテキストを追加する
28
- DocPicture footerimage = paragraph2.AppendPicture(Image.FromFile(@"E:\Logo\logo.jpeg"));
29
- TextRange TR = paragraph2.AppendText("Copyright © 2013 e-iceblue. All Rights Reserved.");
30
- TR.CharacterFormat.FontName = "Arial";
31
- TR.CharacterFormat.FontSize = 10;
32
- TR.CharacterFormat.TextColor = Color.Black;
33
-
34
- document.SaveToFile("ImageHeaderFooter.docx", FileFormat.Docx);
31
+ document.SaveToFile("ImageHeaderFooter.docx", FileFormat.Docx)
35
- System.Diagnostics.Process.Start("ImageHeaderFooter.docx");
32
+ System.Diagnostics.Process.Start("ImageHeaderFooter.docx")
36
- }
33
+ End Sub
37
- }
34
+ End Class
38
- }
35
+ End Namespace
39
36
  ```