回答編集履歴
2
誤字
test
CHANGED
@@ -29,5 +29,3 @@
|
|
29
29
|
```
|
30
30
|
|
31
31
|
|
32
|
-
|
33
|
-
https://teratail.com/questions/47701#
|
1
根本的に間違っていたため
test
CHANGED
@@ -1,14 +1,30 @@
|
|
1
|
-
ここを
|
1
|
+
ここにあるように下の行を1行ずつ詰めるやり方しかなさそうです。(標準には無さそう)
|
2
2
|
|
3
|
-
[Open
|
3
|
+
[Delete a row in Excel Sheet using OpenXML](https://social.msdn.microsoft.com/Forums/office/en-US/d4e654bf-3a62-49b2-99e3-0b62b9439786/delete-a-row-in-excel-sheet-using-openxml?forum=oxmlsdk)
|
4
4
|
|
5
5
|
|
6
6
|
|
7
7
|
```c#
|
8
8
|
|
9
|
-
|
9
|
+
Row refRow = ((WorksheetPart)(workbookPart.GetPartById(theSheet.Id))).Worksheet.Descendants<Row>().Where(r => r.RowIndex == refRowIndex).First();
|
10
10
|
|
11
|
+
|
12
|
+
|
13
|
+
// delete row
|
14
|
+
|
15
|
+
refRow.Remove();
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
for (int index = refRowIndex + 1; index <= iEndRowIndex; index++)
|
20
|
+
|
21
|
+
{
|
22
|
+
|
23
|
+
Row refRow1 = workSheetPart.Worksheet.Descendants<Row>().Where(r => r.RowIndex == index).First();
|
24
|
+
|
11
|
-
|
25
|
+
refRow1.RowIndex.Value--;
|
26
|
+
|
27
|
+
}
|
12
28
|
|
13
29
|
```
|
14
30
|
|