回答編集履歴
2
誤字
answer
CHANGED
@@ -13,5 +13,3 @@
|
|
13
13
|
refRow1.RowIndex.Value--;
|
14
14
|
}
|
15
15
|
```
|
16
|
-
|
17
|
-
https://teratail.com/questions/47701#
|
1
根本的に間違っていたため
answer
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
-
ここを参考にしてみてください。
|
2
|
-
|
1
|
+
ここにあるように下の行を1行ずつ詰めるやり方しかなさそうです。(標準には無さそう)
|
2
|
+
[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)
|
3
3
|
|
4
4
|
```c#
|
5
|
+
Row refRow = ((WorksheetPart)(workbookPart.GetPartById(theSheet.Id))).Worksheet.Descendants<Row>().Where(r => r.RowIndex == refRowIndex).First();
|
6
|
+
|
7
|
+
// delete row
|
5
|
-
|
8
|
+
refRow.Remove();
|
9
|
+
|
10
|
+
for (int index = refRowIndex + 1; index <= iEndRowIndex; index++)
|
11
|
+
{
|
12
|
+
Row refRow1 = workSheetPart.Worksheet.Descendants<Row>().Where(r => r.RowIndex == index).First();
|
6
|
-
|
13
|
+
refRow1.RowIndex.Value--;
|
14
|
+
}
|
7
15
|
```
|
8
16
|
|
9
17
|
https://teratail.com/questions/47701#
|