質問するログイン新規登録

質問編集履歴

5

誤字修正

2019/09/05 14:02

投稿

f_tonakai
f_tonakai

スコア15

title CHANGED
File without changes
body CHANGED
@@ -112,7 +112,7 @@
112
112
  ExcelShape shape = sheet.Drawings.AddShape("test001", eShapeStyle.RoundRect);
113
113
  shape.SetPosition(0, 7, 37, 10);
114
114
  shape.SetSize(500, 30);
115
- shape.Text = "該当データなし";
115
+ shape.Text = "あいうえおかきくけこ";
116
116
  shape.Fill.Style = eFillStyle.SolidFill;
117
117
  shape.Fill.Color = Color.White;
118
118
  shape.Fill.Transparancy = 20;
@@ -131,7 +131,7 @@
131
131
  shape = sheet.Drawings.AddShape("test002", eShapeStyle.RoundRect);
132
132
  shape.SetPosition(0, 7, 36, 10);
133
133
  shape.SetSize(500, 30);
134
- shape.Text = "該当データなし";
134
+ shape.Text = "あいうえおかきくけこ";
135
135
  shape.Fill.Style = eFillStyle.SolidFill;
136
136
  shape.Fill.Color = Color.White;
137
137
  shape.Fill.Transparancy = 20;
@@ -151,7 +151,7 @@
151
151
  shape = sheet.Drawings.AddShape("test003", eShapeStyle.RoundRect);
152
152
  shape.SetPosition(0, 7, 35, 10);
153
153
  shape.SetSize(500, 30);
154
- shape.Text = "該当データなし";
154
+ shape.Text = "あいうえおかきくけこ";
155
155
  shape.Fill.Style = eFillStyle.SolidFill;
156
156
  shape.Fill.Color = Color.White;
157
157
  shape.Fill.Transparancy = 20;
@@ -172,7 +172,7 @@
172
172
  shape = sheet.Drawings.AddShape("test004", eShapeStyle.RoundRect);
173
173
  shape.SetPosition(0, 7, 34, 10);
174
174
  shape.SetSize(500, 30);
175
- shape.Text = "該当データなし";
175
+ shape.Text = "あいうえおかきくけこ";
176
176
  shape.Fill.Style = eFillStyle.SolidFill;
177
177
  shape.Fill.Color = Color.White;
178
178
  shape.Fill.Transparancy = 20;

4

体裁修正

2019/09/05 14:02

投稿

f_tonakai
f_tonakai

スコア15

title CHANGED
File without changes
body CHANGED
@@ -62,9 +62,7 @@
62
62
 
63
63
  自己解決したソース
64
64
  ```
65
- メモ
66
65
 
67
- ```
68
66
  using System;
69
67
  using System.Diagnostics;
70
68
  using System.IO;
@@ -197,6 +195,4 @@
197
195
  }
198
196
  }
199
197
  }
200
-
201
- ```
202
198
  ```

3

自己解決した内容を記載

2019/09/05 14:01

投稿

f_tonakai
f_tonakai

スコア15

title CHANGED
File without changes
body CHANGED
@@ -58,4 +58,145 @@
58
58
  // 保存
59
59
  package.Save();
60
60
  }
61
+ ```
62
+
63
+ 自己解決したソース
64
+ ```
65
+ メモ
66
+
67
+ ```
68
+ using System;
69
+ using System.Diagnostics;
70
+ using System.IO;
71
+ using System.Collections.Generic;
72
+ using System.ComponentModel;
73
+ using System.Data;
74
+ using System.Drawing;
75
+ using System.Linq;
76
+ using System.Text;
77
+ using System.Threading.Tasks;
78
+ using System.Windows.Forms;
79
+
80
+ using System.Drawing;
81
+ using OfficeOpenXml;
82
+ using OfficeOpenXml.Drawing;
83
+
84
+ using OfficeOpenXml;
85
+
86
+ namespace EppluseTest
87
+ {
88
+ public partial class Form1 : Form
89
+ {
90
+ public Form1()
91
+ {
92
+ InitializeComponent();
93
+ }
94
+
95
+ private void Form1_Load(object sender, EventArgs e)
96
+ {
97
+
98
+ }
99
+
100
+ private void Button1_Click(object sender, EventArgs e)
101
+ {
102
+
103
+ string filePath1 = @"C:\Debug\SampleBook.xlsx";
104
+ string filePath2 = @"C:\Debug\SampleBook_a.xlsx";
105
+
106
+ File.Delete(filePath2);
107
+ File.Copy(filePath1, filePath2);
108
+
109
+ FileInfo excelFile = new FileInfo(filePath2);
110
+
111
+ using (var inputFile = new ExcelPackage(excelFile))
112
+ {
113
+ var sheet = inputFile.Workbook.Worksheets["work001"];
114
+ ExcelShape shape = sheet.Drawings.AddShape("test001", eShapeStyle.RoundRect);
115
+ shape.SetPosition(0, 7, 37, 10);
116
+ shape.SetSize(500, 30);
117
+ shape.Text = "該当データなし";
118
+ shape.Fill.Style = eFillStyle.SolidFill;
119
+ shape.Fill.Color = Color.White;
120
+ shape.Fill.Transparancy = 20;
121
+ shape.Border.Fill.Style = eFillStyle.SolidFill;
122
+ shape.Border.LineStyle = eLineStyle.Solid;
123
+ shape.Border.Width = 2;
124
+ shape.Border.Fill.Color = Color.Black;
125
+ shape.Border.LineCap = eLineCap.Round;
126
+ shape.TextAnchoring = eTextAnchoringType.Center;
127
+ shape.TextVertical = eTextVerticalType.Horizontal;
128
+ shape.TextAlignment = eTextAlignment.Center;
129
+ shape.TextAnchoringControl = false;
130
+
131
+ sheet = inputFile.Workbook.Worksheets["work002"];
132
+ sheet.Column(45).Hidden = true;
133
+ shape = sheet.Drawings.AddShape("test002", eShapeStyle.RoundRect);
134
+ shape.SetPosition(0, 7, 36, 10);
135
+ shape.SetSize(500, 30);
136
+ shape.Text = "該当データなし";
137
+ shape.Fill.Style = eFillStyle.SolidFill;
138
+ shape.Fill.Color = Color.White;
139
+ shape.Fill.Transparancy = 20;
140
+ shape.Border.Fill.Style = eFillStyle.SolidFill;
141
+ shape.Border.LineStyle = eLineStyle.Solid;
142
+ shape.Border.Width = 2;
143
+ shape.Border.Fill.Color = Color.Red;
144
+ shape.Border.LineCap = eLineCap.Round;
145
+ shape.TextAnchoring = eTextAnchoringType.Center;
146
+ shape.TextVertical = eTextVerticalType.Horizontal;
147
+ shape.TextAlignment = eTextAlignment.Center;
148
+ shape.TextAnchoringControl = false;
149
+
150
+ sheet = inputFile.Workbook.Worksheets["work003"];
151
+ sheet.Column(45).Hidden = true;
152
+ sheet.Column(44).Hidden = true;
153
+ shape = sheet.Drawings.AddShape("test003", eShapeStyle.RoundRect);
154
+ shape.SetPosition(0, 7, 35, 10);
155
+ shape.SetSize(500, 30);
156
+ shape.Text = "該当データなし";
157
+ shape.Fill.Style = eFillStyle.SolidFill;
158
+ shape.Fill.Color = Color.White;
159
+ shape.Fill.Transparancy = 20;
160
+ shape.Border.Fill.Style = eFillStyle.SolidFill;
161
+ shape.Border.LineStyle = eLineStyle.Solid;
162
+ shape.Border.Width = 2;
163
+ shape.Border.Fill.Color = Color.Green;
164
+ shape.Border.LineCap = eLineCap.Round;
165
+ shape.TextAnchoring = eTextAnchoringType.Center;
166
+ shape.TextVertical = eTextVerticalType.Horizontal;
167
+ shape.TextAlignment = eTextAlignment.Center;
168
+ shape.TextAnchoringControl = false;
169
+
170
+ sheet = inputFile.Workbook.Worksheets["work004"];
171
+ sheet.Column(45).Hidden = true;
172
+ sheet.Column(44).Hidden = true;
173
+ sheet.Column(43).Hidden = true;
174
+ shape = sheet.Drawings.AddShape("test004", eShapeStyle.RoundRect);
175
+ shape.SetPosition(0, 7, 34, 10);
176
+ shape.SetSize(500, 30);
177
+ shape.Text = "該当データなし";
178
+ shape.Fill.Style = eFillStyle.SolidFill;
179
+ shape.Fill.Color = Color.White;
180
+ shape.Fill.Transparancy = 20;
181
+ shape.Border.Fill.Style = eFillStyle.SolidFill;
182
+ shape.Border.LineStyle = eLineStyle.Solid;
183
+ shape.Border.Width = 2;
184
+ shape.Border.Fill.Color = Color.Magenta;
185
+ shape.Border.LineCap = eLineCap.Round;
186
+ shape.TextAnchoring = eTextAnchoringType.Center;
187
+ shape.TextVertical = eTextVerticalType.Horizontal;
188
+ shape.TextAlignment = eTextAlignment.Center;
189
+ shape.TextAnchoringControl = false;
190
+
191
+ inputFile.Save();
192
+
193
+ Process.Start(filePath2);
194
+
195
+ Close();
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
+ ```
61
202
  ```

2

誤字

2019/09/05 14:01

投稿

f_tonakai
f_tonakai

スコア15

title CHANGED
File without changes
body CHANGED
@@ -11,7 +11,7 @@
11
11
  図形の右端(S列とT列)の位置を固定にして描画をしたいのですが、
12
12
  図形のサイズが非表示に伴い変わってしまいます。
13
13
 
14
- ```ここに言語を入力
14
+ ```
15
15
  // 出力ファイルの準備(実行ファイルと同じフォルダに出力される)
16
16
  FileInfo newFile = new FileInfo("result.xlsx");
17
17
  if (newFile.Exists)
@@ -57,4 +57,5 @@
57
57
 
58
58
  // 保存
59
59
  package.Save();
60
- }
60
+ }
61
+ ```

1

ソース変更

2019/09/03 14:00

投稿

f_tonakai
f_tonakai

スコア15

title CHANGED
File without changes
body CHANGED
@@ -26,12 +26,6 @@
26
26
  // ワークシートを1枚追加
27
27
  ExcelWorksheet sheet = package.Workbook.Worksheets.Add("シート名");
28
28
 
29
- // A1セルに書き込み
30
- //sheet.Cells["A1"].Value = "Hello World";
31
-
32
- // セルはR1C1形式でも指定可
33
- //sheet.Cells[2, 1].Value = 27;
34
-
35
29
  // セル幅
36
30
  for (int i=1; i<200; i++)
37
31
  {
@@ -63,5 +57,4 @@
63
57
 
64
58
  // 保存
65
59
  package.Save();
66
- }
60
+ }
67
- ```