質問編集履歴

3

2020/10/09 15:55

投稿

Yamamin
Yamamin

スコア18

test CHANGED
File without changes
test CHANGED
@@ -32,7 +32,9 @@
32
32
 
33
33
  row = ws.GetRow(0);
34
34
 
35
- cell = row.GetCell(0) ?? row.CreateCell(0); cell.SetCellValue(20000);
35
+ cell = row.GetCell(0) ?? row.CreateCell(0);
36
+
37
+ cell.SetCellValue(20000);
36
38
 
37
39
 
38
40
 
@@ -40,9 +42,9 @@
40
42
 
41
43
  {
42
44
 
43
- wb.Write(f);
45
+ wb.Write(f);
44
46
 
45
- f.Close();
47
+ f.Close();
46
48
 
47
49
  }
48
50
 

2

2020/10/09 15:55

投稿

Yamamin
Yamamin

スコア18

test CHANGED
File without changes
test CHANGED
@@ -18,35 +18,33 @@
18
18
 
19
19
 
20
20
 
21
-  ```   IWorkbook wb = WorkbookFactory.Create(ExcelFilePath);
21
+  ``` IWorkbook wb = WorkbookFactory.Create(ExcelFilePath);
22
22
 
23
- ISheet ws = wb.GetSheet("Sheet2");
23
+ ISheet ws = wb.GetSheet("Sheet2");
24
24
 
25
25
 
26
26
 
27
- IRow row = null;
27
+ IRow row = null;
28
28
 
29
- ICell cell = null;
29
+ ICell cell = null;
30
30
 
31
31
 
32
32
 
33
- row = ws.GetRow(0);
33
+ row = ws.GetRow(0);
34
34
 
35
- cell = row.GetCell(0) ?? row.CreateCell(0);
35
+ cell = row.GetCell(0) ?? row.CreateCell(0); cell.SetCellValue(20000);
36
-
37
- cell.SetCellValue(20000);
38
36
 
39
37
 
40
38
 
41
- using (System.IO.FileStream f = new System.IO.FileStream(ExcelFilePath, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write))
39
+ using (System.IO.FileStream f = new System.IO.FileStream(ExcelFilePath, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write))
42
40
 
43
- {
41
+ {
44
42
 
45
- wb.Write(f);
43
+ wb.Write(f);
46
44
 
47
- f.Close();
45
+ f.Close();
48
46
 
49
- }
47
+ }
50
48
 
51
49
 
52
50
 

1

2020/10/09 15:53

投稿

Yamamin
Yamamin

スコア18

test CHANGED
File without changes
test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
 
20
20
 
21
-     IWorkbook wb = WorkbookFactory.Create(ExcelFilePath);
21
+  ```   IWorkbook wb = WorkbookFactory.Create(ExcelFilePath);
22
22
 
23
23
  ISheet ws = wb.GetSheet("Sheet2");
24
24
 
@@ -50,6 +50,10 @@
50
50
 
51
51
 
52
52
 
53
+ コード
54
+
55
+ ```
56
+
53
57
  3. エクセルファイルを開いて、「Sheet2」の「A1」セルには「20000」と設定
54
58
 
55
59
    されていますが、「Sheet1」の「A1」セルを見ても0のままです。